public static string validarCantidades(object fila, string valor, string lote, string qty) { InterfazDAL_tticol125 idal = new InterfazDAL_tticol125(); Ent_tticol125 obj = new Ent_tticol125(); string strError = string.Empty; string retorno = string.Empty; Factor MyConvertionFactor = new Factor { }; Array row = fila.ToString().Replace(" ", "").Replace("\"", "").Split(','); try { valor = valor.Trim(); lote = lote.Trim().ToUpperInvariant(); if (!string.IsNullOrEmpty(valor)) { if (row.GetValue(10).ToString().Trim() == "1") { MyConvertionFactor = FactorConversion(row.GetValue(4).ToString().Trim(), row.GetValue(6).ToString().Trim(), "plt"); decimal QUANTITYCUNI = (MyConvertionFactor.Tipo == "Div") ? Convert.ToDecimal((Convert.ToDecimal(qty) * MyConvertionFactor.FactorB) / MyConvertionFactor.FactorD) : Convert.ToDecimal((Convert.ToDecimal(qty) * MyConvertionFactor.FactorD) / MyConvertionFactor.FactorB); if (QUANTITYCUNI > 1) { strError = Returnedquantityhigherthanpalletsize; return(strError); } } } if (!string.IsNullOrEmpty(valor) && !string.IsNullOrEmpty(lote)) { double iCantMax = 0; obj.pdno = row.GetValue(1).ToString().Trim(); obj.pono = Convert.ToInt32(row.GetValue(2).ToString().Trim()); obj.item = row.GetValue(4).ToString().Trim(); obj.clot = lote.ToString().Trim(); iCantMax = idal.cantidadMaximaPorLote(ref obj, ref strError); if (double.Parse(valor) <= iCantMax) { return(retorno); } else if (string.IsNullOrEmpty(strError)) { strError = Theamounttoreturnisinvalid; } } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } return(strError); }
public static string validarCantidades(object fila, string valor, string lote) { InterfazDAL_tticol125 idal = new InterfazDAL_tticol125(); Ent_tticol125 obj = new Ent_tticol125(); string strError = string.Empty; string retorno = string.Empty; try { valor = valor.Trim(); lote = lote.Trim().ToUpperInvariant(); if (!string.IsNullOrEmpty(valor) && !string.IsNullOrEmpty(lote)) { Array row = fila.ToString().Replace(" ", "").Replace("\"", "").Split(','); double iCantMax = 0; obj.pdno = row.GetValue(1).ToString().Trim(); obj.pono = Convert.ToInt32(row.GetValue(2).ToString().Trim()); obj.item = row.GetValue(4).ToString().Trim(); obj.clot = lote.ToString().Trim(); iCantMax = idal.cantidadMaximaPorLote(ref obj, ref strError); if (double.Parse(valor) <= iCantMax) { return(retorno); } else if (string.IsNullOrEmpty(strError)) { strError = "The amount to return is invalid"; } } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } return(strError); }