public StringBuilder RPU() { ADO.ConnectionDB cn = new ConnectionDB(); String RPU = System.String.Empty; Boolean bRespostExistsRPU = false; strRPUrepeated = new StringBuilder(); clsDivision oclsDivision = new clsDivision(); clsZone oclsZone = new clsZone(); clsGrupo oclsGroup = new clsGrupo(); clsTarifa oclsTarifa = new clsTarifa(); clsGestores oclsGestor = new clsGestores(); Boolean bexistgroup = false; Boolean bExistZone = false; Boolean bExistDivision = false; Boolean bExistTarifa = false; Boolean bExistGestorComercial = false; Boolean bExistGestorMedicion = false; int iNewConvenio = 0; int newRup = 0; DataTable dtConvenio = new DataTable("Convenio"); dtConvenio = InsertConvenio(); if (dtConvenio.Rows.Count > 0) { iNewConvenio = int.Parse(dtConvenio.Rows[0][0].ToString()); intConvenio = iNewConvenio; foreach (DataRow drChargeShiping in dtResult.Rows) { try { //Select Query String strRPU = String.Empty; strRPU = Convert.ToString(drChargeShiping[2]); strRPU = strRPU.Replace(" ", ""); strServiceCFE = strRPU; RPU = GetRPU(); bExistTarifa = oclsTarifa.ExistTarifa(Convert.ToString(drChargeShiping[4])); bexistgroup = oclsGroup.ExistGroup(Convert.ToString(drChargeShiping[6])); bExistDivision = oclsDivision.ExistDivision(Convert.ToString(drChargeShiping[8])); bExistZone = oclsZone.ExistZonaCve(Convert.ToString(drChargeShiping[8]), Convert.ToString(drChargeShiping[7]), Convert.ToString(drChargeShiping[9])); bExistGestorMedicion = oclsGestor.ExistIniciales(Convert.ToString(drChargeShiping[11]), "2"); bExistGestorComercial = oclsGestor.ExistIniciales(Convert.ToString(drChargeShiping[12]), "1"); if (bExistTarifa) { if (bexistgroup) { if (bExistDivision) { //if (bExistZone){ if (bExistGestorMedicion) { if (bExistGestorComercial) { if (!string.IsNullOrEmpty(strServiceCFE)) { strDivision = Convert.ToString(drChargeShiping[8]); strZona = Convert.ToString(drChargeShiping[9]); if (!bExistZone) { // oclsZone.NewZoneByDiv(Convert.ToString(drChargeShiping[7]).Substring(0, 2), strZona, strDivision, strDivision); } strLoadPoint = Convert.ToString(drChargeShiping[1]); strAddressPoint = Convert.ToString(drChargeShiping[3]); strRate = Convert.ToString(drChargeShiping[4]); dblMaxShipping = Convert.ToDouble(drChargeShiping[5]); strGroup = Convert.ToString(drChargeShiping[6]); strCta = Convert.ToString(drChargeShiping[7]); dblDemanda = Convert.ToDouble("0" + drChargeShiping[10]); strGestorComercial = Convert.ToString(drChargeShiping[11]); strGestorMedicion = Convert.ToString(drChargeShiping[12]); //se asignan los campos nuevos if (Convert.ToString(drChargeShiping[13]) != "") { strIdEstatusOferta = Convert.ToString(drChargeShiping[13]); } else { strRPUrepeated.Append("El Estatus Oferta del RPU: " + strServiceCFE + " Contiene datos incorrectos!" + "<br>"); } if (Convert.ToString(drChargeShiping[14]) != "" && Convert.ToUInt32(drChargeShiping[14]) >= 0 && Convert.ToUInt32(drChargeShiping[14]) <= 1) { strConPrelacion = Convert.ToInt32(drChargeShiping[14]); } else { strRPUrepeated.Append("El campo Esta en prelacion del RPU: " + strServiceCFE + " Contiene datos incorrectos!" + "<br>"); } if (Convert.ToString(drChargeShiping[15]) != "" && Convert.ToUInt32(drChargeShiping[15]) >= 0 && Convert.ToUInt32(drChargeShiping[15]) <= 1) { strFirmado = Convert.ToInt32(drChargeShiping[15]); } else { strRPUrepeated.Append("El campo Firmado o prospecto del RPU: " + strServiceCFE + " Contiene datos incorrectos!" + "<br>"); } DataTable DtRup = new DataTable("Convenio"); DtRup = InsertRPU(); if (dtConvenio.Rows.Count > 0) { newRup = int.Parse(dtConvenio.Rows[0][0].ToString()); } } } else { strRPUrepeated.Append("No existe el Gestor Comercial: " + Convert.ToString(drChargeShiping[12]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } else { strRPUrepeated.Append("No existe el Gestor Medición: " + Convert.ToString(drChargeShiping[11]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } //}else{strRPUrepeated.Append("No existe la Zona " + Convert.ToString(drChargeShiping[7]).ToUpper() + " del RPU: " + strServiceCFE + "<br>");} } else { strRPUrepeated.Append("No existe la División: " + Convert.ToString(drChargeShiping[8]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } else { strRPUrepeated.Append("No existe el Grupo: " + Convert.ToString(drChargeShiping[6]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } else { strRPUrepeated.Append("No existe la Tarifa: " + Convert.ToString(drChargeShiping[4]).ToUpper() + " del RPU: " + strServiceCFE + "<br>"); } } catch (Exception ex) { LogError.LogErrorMedicion clsError = new LogError.LogErrorMedicion(); clsError.logMessage = ex.ToString(); clsError.logModule = "RPU"; clsError.LogWrite(); } } } if (strRPUrepeated.Length > 0) { DataTable dtR = new DataTable("dtres"); dtR = EliminaCarga(); int iRes = 0; if (dtR.Rows.Count > 0) { iRes = int.Parse(dtR.Rows[0][0].ToString()); } } return(strRPUrepeated); }