I have a time consuming code to validate a file, as well as customize the terms of time. I need help, north of what can be done. Any tips? My application is in dotnet, and my database is oracle sql developed. I have identified that within the for is where it is consuming more time, but I do not know how to remedy the situation. can anybody help me?
for (int i = 5; i < (numLines - 1); i++)
{
List<Process> listProcessExistente = new List<Process>();
Process process= null;
Interested interested= new Interested ();
//search for the process by the previous or current judicial //number
if (!ds.Tables[0].Rows[i].ItemArray[1].ToString().Equals(""))
process= aplprocess.consultarPorNprocessER(ds.Tables[0].Rows[i].ItemArray[1].ToString());
if (process== null)
{
if (!ds.Tables[0].Rows[i].ItemArray[2].ToString().Equals(""))
process= aplprocess.consultarPorNprocessER(ds.Tables[0].Rows[i].ItemArray[2].ToString());
}
//performing test
//find the person interested by cpf / cnpj
if (ds.Tables[0].Rows[i].ItemArray[7].ToString().Length == 14)
interested= aplInterested.ConsultarPorCPF(AuxiliarCPF_CNPJ.DeformationCPF(ds.Tables[0].Rows[i].ItemArray[7].ToString()));
if (ds.Tables[0].Rows[i].ItemArray[7].ToString().Length == 18)
interested= aplInterested.ConsultarPorCPF(AuxiliarCPF_CNPJ.DeformationCNPJ(ds.Tables[0].Rows[i].ItemArray[7].ToString()));
if (process!= null)
{
//if the process is not null I search all procinter related to it
List<ProcessInterested> listprocinter = aplProcessInterested.consultarPorIdProcess(process.Code);
if (listaprocinter.Exists(o => o.Interested == interested))
log.Append("The person informed on the line " + (i + 1) + "was added again to the process " + process.NumJudicialprocess + " <br>");
//foreach(var item in listprocinter)
//{
// if (item.Interested== Interested)
// log.Append("The person informed on the line " + (i + 1) + " was added again to the process " + process.NumProcessJudicial + " <br>");
//}
setProcInter(process, interested, ds, i);
}
else
{
//New Process- 6.3
process= new Process();
process.Interested= interested;
}