How do I populate my dataTable in the mue method import and grab the index from the correct line from my initated file from line 6? Here's my code:
- protected void Page_Load (object sender, EventArgs, and)
-
- {
-
- }
-
-
-
- protected void import_Click (object sender, EventArgs and)
-
- {
-
-
- DataTable Data = new DataTable ();
-
- if (selectFileContent! = null)
-
- {
-
- string Excel = AppDomain.CurrentDomain.BaseDirectory + select File.FileName;
-
- select File.SaveAs (Excel);
-
- Data = Excel Data (Excel);
-
-
-
- var recordsValid = ((DataTable) Data) .Rows.OfType <DataRow> (). Skip (5);
-
-
-
- recordsValid = RecordsValid.Take (RecordsValid.Count () - 1);
-
-
-
- int amount_for_page = 100;
-
- int total_of_page;
-
-
-
- int qtd_total_registers = recordsValids.Count ();
-
-
-
- total_of_pages = (int) Math.Ceiling ((double) qtd_total_records / amount_by_page);
-
- if (recordsValid.Count ()> 0)
-
- {
-
- bool layoutValid = CheckLayout (Data);
-
-
-
- if (! layoutValid)
-
- ClientScript.RegisterStartupScript (typeof (string), "Error", "<script> alert ('Non-standard file layout defined for import.') </ Script>");
-
-
-
- else
-
- {
-
-
-
- VerificationPreliminary (valid records);
-
-
-
-
-
- if (!
-
- {
-
- this.ValidateDuplicityInterested ();
-
-
-
- List <System.Threading.Tasks.Task> TasksParallel = new List <System.Threading.Tasks.Task> ();
-
-
- for (int j = 0; j <total_of_pages; j ++)
-
- {
-
-
-
- var page = j;
-
-
-
- var linesPerPage = recordsResults.Skip (page * quantity_by_page) .Take (quantity_by_page);
-
-
-
-
-
- var data_rows_divididos = linesPerPagina.SplitList (10);
-
-
-
- foreach (var linesDivided in data_rows_divided)
-
- {
-
-
-
- TasksParalelas.Add (TableTransform (split lines, j, userLog));
-
- }
-
- }
-
-
-
-
- foreach (var task in TasksParallel)
-
- task.Start ();
-
-
-
-
-
- System.Threading.Tasks.Task.WaitAll (TasksParalelas.ToArray ());
-
- }
- }
-
- private System.Threading.Tasks.Task Processing table (IEnumerable <DataRow> dataparam, int i, UserLibrary user)
-
- {
-
-
-
-
-
- Action <object> processing = (data) =>
-
- {
-
-
- NHibernate.Context.ThreadStaticSessionContext.Bind (NhibernateHelper.HelpThreading (). OpenSession ());
-
-
-
-
- foreach (var line in (IEnumerable <DataRow>) data)
-
- {
-
-
-
-
-
- List <Process> listProcessOpen = new List <Process> ();
-
- Process process = null;
-
- Interested interested = new Interested ();
-
-
-
-
-
- if (! line.ItemArray [1] .ToString ().) Equals (""))
-
- process = aplProcess.consultPerNProcessOER (line.ItemArray [1] .ToString ());
-
- if (process == null)
-
- {
-
- if (! line.ItemArray [2] .ToString ().) Equals (""))
-
- process = aplProcess.consultPerNProcessOER (line.ItemArray [2] .ToString ());
-
- }
-
-
-
-
- if (line.ItemArray [7] .ToString (). Length == 14)
-
- interested = aplInterado.ConsultaPorCPF (AuxiliarCPF_CNPJ.DesformataCPF (line.ItemArray [7] .ToString ()));
-
-
-
- if (line.ItemArray [7] .ToString (). Length == 18)
-
- interested = apl
- Interested.ConsultPerCPF (HelpCPF_CNPJ.DesformatCNPJ (line.ItemArray [7] .ToString ()));
-
-
-
-
- if (process! = null)
-
- {
-
-
-
- List <ProcessInterest> listprocinter = ProcessInterested.consultProcesso(process.Code);
-
- if (listprocinter.Exists (o => o.interest == interested))
-
-
-
- I can not get the index of the interested one of the correct line here, here lives the problem, therefore I thought of popular the dataTable in the beginning and to pass the index here direct, however I do not know how to do.
- log.Append ("The interested" + process.Interested.Name + ", entered in the line" + (i + 1) + "was added again to the process" + process.NumProcesso + "");
-
-
-
-
- else
-
- {
-
-
-
- process = new Process ();
-
- process.Interested = interested;
-
- }
- }
- }
- }