Robson Amaral

Robson Amaral

  • NA
  • 132
  • 15.6k

Problems with error logging

Apr 10 2018 4:33 PM
I'm having trouble firing the log for the user, in my previous code it was that way and it worked: 
  1. privatevoidPreliminaryVerification(int count,DataSet ds)  
  2.   
  3. {           
  4.             bool imported=false;  
  5.             for(int i =5; i < count; i++)  
  6.             {  
  7.                 //Verifies that no worksheets with the numSEP entered have not already been imported                  
  8.                 if(!ds.Tables[0].Rows[i].ItemArray[17].ToString().Equals(""))  
  9.                 {  
  10.                     if(aplProcessInterested.listProcInterPorCodSep(decimal.Parse(ds.Tables[0].Rows[i].ItemArray[17].ToString())).Count!=0)  
  11.                     {  
  12.                         imported=true;  
  13.                         break;  
  14.                     }  
  15.                 }  
  16.                 else  
  17.                 {  
  18.                     log.Append("The cell S"+(i +1)+" must be completed. 
    "
    );  
  19.                     arquivoInvalidado =true;  
  20.                 }  
  21. }  
And due to changes it turned out to be that way :
  1. privatevoidPreliminaryVerification(IEnumerable data)  
  2.   
  3.   
  4.            bool imported=false;  
  5.            foreach(var line in data)  
  6.            {  
  7.                //Verifies that no worksheets with the numSEP entered have not already been imported                 
  8.                if(!line.ItemArray[17].ToString().Equals(""))  
  9.                {  
  10.                    if(aplProcessInterested.listProcInterPorCodSep(decimal.Parse(line.ItemArray[17].ToString())).Count!=0)  
  11.                    {  
  12.                        imported=true;  
  13.                        break;  
  14.                    }  
  15.                }  
  16.                else  
  17.                {  
  18.                    log.Append("The cell S"+(1)+" must be completed. 
    "
    );  
  19.                    fileInvalidated=true;  
  20.                }  
However, the log that was displayed to the user ended up incorrectly like this:
 
Import Log: In the system there is no execution stick associated with the comarca informed in line 1. Please correct the system. In the system there is no execution stick associated with the comarca informed in line 1. Please correct the system.
 
Here is the problem, but I do not know how to solve it:
  1. log.Append("The cell S"+(1)+" must be completed. 
    "
    );   

Answers (15)