I have the following problem, my Date cell in the excel sheet is a required field, however, leaving unfilled would have to return a message with the log to the user, however, it did not return any log message stating that cell S line 1 should be filled with a date, but it does not appear. Could someone please help me?
Follow my code below:
- private void setProcInter(Process process, Interested interested , DataRow line)
- {
- int i = 0;
- try
- {
- DateTime DateSep = DateTime.Parse(line.ItemArray[18].ToString());
- processInterested.DateSep = DateSep;
- }
- catch
- {
- i = i + 1;
- logErro.Append("The S cell" + (i) + " must be completed with a date. <br>");
- fileInvalidated= true;
- }
-
- }
-
-
- private void PreliminaryVerification(IEnumerable<DataRow> data)
- {
- int i = 0;
-
- bool imported= false;
- foreach(var line in data)
- {
- i = i + 1;
-
-
- if (!line.ItemArray[17].ToString().Equals(""))
- {
- if (aplProcessinterested.listProcInterPorCodSep(decimal.Parse(line.ItemArray[17].ToString())).Count != 0)
- {
- imported= true;
- break;
- }
- }
- else
- {
- log.Append("The S cell for the line " + (i) + " must be completed. <br>");
- fileInvalidated= true;
- }
- }
I have this method where I close all the processes related to the interested one, and I load the information of the worksheet, just the date, that if it is blank it should appear the log informing the user to fill, but it does not appear, the same thing is in the others validations below, but does not pass the line when compiling. Can you help me?