public DataTable GetData(ref Ent_ttdcol524 ParametrosIn, ref string strError) { method = MethodBase.GetCurrentMethod(); paramList = new Dictionary <string, object>(); paramList.Add("p1", ParametrosIn.item.Trim().ToUpperInvariant()); paramList.Add("p2", ParametrosIn.adjustmentQuantity.Trim().ToUpperInvariant()); strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla, paramList); try { consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strSentencia, ref parametersOut, null, true); if (consulta.Rows.Count < 1) { strError = "Not found records for confirm"; } } catch (Exception ex) { strError = "Error when querying data [ttdcol524]. Try again or contact your administrator"; log.escribirError(strError + Console.Out.NewLine + ex.Message, stackTrace.GetFrame(1).GetMethod().Name, method.Name, method.ReflectedType.Name); } return(consulta); }
public DataTable GetData(ref Ent_ttdcol524 ParametrosIn, ref string strError) { DataTable retorno; try { retorno = dal.GetData(ref ParametrosIn, ref strError); return(retorno); } catch (Exception ex) { throw new Exception(ex.InnerException.ToString()); } }
private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_ttdcol524 parametros, bool blnUsarPRetorno = false) { method = MethodBase.GetCurrentMethod(); string strError = string.Empty; List <Ent_ParametrosDAL> parameterCollection = new List <Ent_ParametrosDAL>(); try { Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$ORNO$EAM", DbType.String, parametros.orderNumber); //Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$DATE", DbType.DateTime, parametros.date.ToString("dd/MM/yyyy HH:mm:ss")); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$EMNO", DbType.String, parametros.employee); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$CWAR", DbType.String, parametros.warehouse); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$ITEM", DbType.String, parametros.item); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$VSTK", DbType.Int64, parametros.adjustmentQuantity); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$STUN", DbType.String, parametros.unit); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$RECD", DbType.String, parametros.adjustmentReason); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$ESTA", DbType.Int16, parametros.status); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$ORNO", DbType.String, parametros.adjustmentBaanOrder); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$PONO", DbType.String, parametros.adjustmentBaanOrderLine); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$REFCNTD", DbType.Int64, parametros.refcntd); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, "T$REFCNTU", DbType.Int64, parametros.refcntu); if (blnUsarPRetorno) { Ent_ParametrosDAL pDal = new Ent_ParametrosDAL(); pDal.Name = "@p_Int_Resultado"; pDal.Type = DbType.Int32; pDal.ParDirection = ParameterDirection.Output; parameterCollection.Add(pDal); } } catch (Exception ex) { strError = "Error when creating parameters [524]. Try again or contact your administrator \n"; log.escribirError(strError + Console.Out.NewLine + ex.Message, stackTrace.GetFrame(1).GetMethod().Name, method.Name, method.ReflectedType.Name); } return(parameterCollection); }
protected void btnContinue_Click(object sender, EventArgs e) { string strError = string.Empty; Ent_ttdcol524 ParametrosIn = new Ent_ttdcol524(); List <Ent_ttdcol524> parametros = new List <Ent_ttdcol524>(); InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); List <Ent_tticol132> param = new List <Ent_tticol132>(); DataTable DSReturnBox = new DataTable(); try { if (ValidarDatos(ref strError)) { string item = string.Empty; string quantity = string.Empty; for (int i = 0; i < 5; i++) { string barcode = string.Empty; int type = 0; switch (i) { case 0: item = txtCover.Text.Trim().ToUpperInvariant(); quantity = txtQCover.Text; barcode = txtCoverBarCode.Text.Trim().ToUpperInvariant(); type = 3; break; case 1: item = txtMaster1.Text.Trim().ToUpperInvariant(); quantity = txtQMaster1.Text; barcode = txtMasterBarCode1.Text.Trim().ToUpperInvariant(); type = 2; break; case 2: item = txtMaster2.Text.Trim().ToUpperInvariant(); quantity = txtQMaster2.Text; barcode = txtMasterBarCode2.Text.Trim().ToUpperInvariant(); type = 2; break; case 3: item = txtMaster3.Text.Trim().ToUpperInvariant(); quantity = txtQMaster3.Text; barcode = txtMasterBarCode3.Text.Trim().ToUpperInvariant(); type = 2; break; case 4: item = txtBox.Text.Trim().ToUpperInvariant(); quantity = txtQBox.Text; barcode = string.Empty; type = 1; break; } ParametrosIn.item = item; ParametrosIn.adjustmentQuantity = quantity; long lOrderNumber; //Obtener datos DSReturnBox = ttdcol524.GetData(ref ParametrosIn, ref strError); if (!string.IsNullOrEmpty(barcode)) { param.Add(new Ent_tticol132() { barcode = barcode, date = DateTime.Now, type = type, item = string.Format(" {0}", item.Trim().ToUpperInvariant()), user = Session["user"].ToString(), status = 2, machine = " ", refcntd = 0, refcntu = 0 }); } if (DSReturnBox.Rows.Count > 0) { if (DSReturnBox.Rows.Count == 1) { if (long.TryParse(DSReturnBox.Rows[0]["orderNumber"].ToString(), out lOrderNumber)) { Ent_ttdcol524 entidad = new Ent_ttdcol524(); entidad.orderNumber = (lOrderNumber + i).ToString().PadLeft(9, '0'); entidad.employee = DSReturnBox.Rows[0]["Employee"].ToString(); entidad.warehouse = DSReturnBox.Rows[0]["Warehouse"].ToString(); entidad.item = DSReturnBox.Rows[0]["Item"].ToString(); entidad.adjustmentQuantity = quantity; entidad.unit = DSReturnBox.Rows[0]["Unit"].ToString(); entidad.adjustmentReason = DSReturnBox.Rows[0]["AdjustmentReason"].ToString(); entidad.status = DSReturnBox.Rows[0]["Status"].ToString(); entidad.adjustmentBaanOrderLine = DSReturnBox.Rows[0]["AdjustmentBaanOrderLine"].ToString(); entidad.adjustmentBaanOrder = DSReturnBox.Rows[0]["AdjustmentBaanOrder"].ToString(); entidad.refcntd = 0; entidad.refcntu = 0; parametros.Add(entidad); } } } } //Guardar en tdcol524 if (parametros.Count > 0 && param.Count > 0) { if (ttdcol524.insertarDatos(ref parametros, ref strError) == 1) { if (tticol132.insertarRegistro(ref param, ref strError) == 1) { if (ttdcol524.actualizarContadores(ref strError) < 1) { strError = "Save successfully but the counters were not updated"; } else { strError = "Save successfully"; } LimpiarControles(); } else { strError = "An error occurred while saving the information"; } } } else { strError = "Save unsuccessfully"; } } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } lblMensaje.Text = strError; }