public void GetRelationshipOwedDataFromExcelConfig(string excelPath) { List <RelationshipOwed> lstRelationshipOwedData = null; try { using (var package = new ExcelPackage(new FileInfo(excelPath))) { var workbook = package.Workbook; var worksheet = workbook.Worksheets[1]; var totalRow = worksheet.Dimension.End.Row; //string patron = @"[^\d+]"; //Regex regex = new Regex(patron); lstRelationshipOwedData = new List <RelationshipOwed>(); for (int i = 2; i <= totalRow; i++) { //if (worksheet.Cells["B" + i].Value != null && worksheet.Cells["C" + i].Value != null && // worksheet.Cells["D" + i].Value != null && worksheet.Cells["E" + i].Value != null && // worksheet.Cells["F" + i].Value != null) if (!String.IsNullOrEmpty(Convert.ToString(worksheet.Cells["A" + i].Value).Trim()) && !String.IsNullOrEmpty(Convert.ToString(worksheet.Cells["B" + i].Value).Trim())) { if (Convert.ToString(worksheet.Cells["C" + i].Value).Trim() == "CARGADO") { RelationshipOwed relationshipOwedData = new RelationshipOwed() { ContractNumberDue = (worksheet.Cells["B" + i].Value ?? "").ToString().Trim(), FundingNumber = (worksheet.Cells["A" + i].Value ?? "").ToString().Trim() }; lstRelationshipOwedData.Add(relationshipOwedData); } } else { RelationshipOwed relationshipOwedData = new RelationshipOwed() { State = "ERROR" }; lstRelationshipOwedData.Add(relationshipOwedData); } } } } #pragma warning disable CS0168 // La variable 'e' se ha declarado pero nunca se usa catch (Exception e) #pragma warning restore CS0168 // La variable 'e' se ha declarado pero nunca se usa { //TODO: especificar error que no se ha leído correctamente el archivo de configuracón disbursement config //Methods.LogProceso(e.ToString()); } RelationshipOweds = lstRelationshipOwedData; }
public RelationshipOwed GetRelationshipOwed(string plot, int yCoordenates) { //me aseguro de que no tendré un fuera de rango... . //plot = plot.PadRight(80 * rowsByItem); //TODO: manejo de nulos //if (plot.Substring(20, 10) //ContractNumberDue or Funding? RelationshipOwed e = RelationshipOweds.FirstOrDefault(x => plot.Substring(3, 12).Trim() == x.ContractNumberDue); if (e != null) { e.State = "AUTORIZADO"; ehllapi.SetCursorPos(yCoordenates + ",2"); EhllapiWrapper.Wait(); ehllapi.SendStr("I"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); ehllapi.SetCursorPos(yCoordenates + ",2"); EhllapiWrapper.Wait(); ehllapi.SendStr("Y"); EhllapiWrapper.Wait(); ehllapi.SendStr("@E"); EhllapiWrapper.Wait(); } e.Plot = plot; return(e); }