public int insertarRegistro(ref Ent_twhcol120 parametrosIn, ref string strError) { int retorno = -1; try { retorno = dal.insertarRegistro(ref parametrosIn, ref strError); return(retorno); } catch (Exception ex) { throw new Exception(strError += "\nPila: " + ex.Message); } }
private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_twhcol120 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$UNID", DbType.String, parametros.unid.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$LOGN", DbType.String, parametros.logn.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$IDTR", DbType.String, parametros.idtr.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$WHSO", DbType.String, parametros.whso.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$WHTA", DbType.String, parametros.whta.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$SHPO", DbType.String, parametros.shpo.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$ENPI", DbType.Int32, parametros.enpi); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$ENRE", DbType.Int32, parametros.enre); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$RCNO", DbType.String, parametros.rcno.ToUpper()); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PRNT", DbType.Int32, parametros.prnt); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PROO", DbType.Int32, parametros.proo); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PROR", DbType.Int32, parametros.pror); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$MES1", DbType.String, parametros.mes1); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$MES2", DbType.String, parametros.mes2); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTD", DbType.Int32, parametros.refcntd); Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTU", DbType.Int32, 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 [301]. 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); }
public int insertarRegistro(ref Ent_twhcol120 parametro, ref string strError) { method = MethodBase.GetCurrentMethod(); bool retorno = false; try { strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla); parametrosIn = AdicionaParametrosComunes(parametro); retorno = DAL.BaseDAL.BaseDal.EjecutarCrud("text", strSentencia, ref parametersOut, parametrosIn, false); return(Convert.ToInt32(retorno)); } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } return(Convert.ToInt32(retorno)); }
protected void btnGenerateUI_Click(object sender, EventArgs e) { if (validarCampos()) { var CWARSOURCE = txtSourceWareHouse.Text.ToUpper(); var CWARDESTINATION = txtDestinationWareHouse.Text.ToUpper(); var respuesta = _idaltwhwmd300.consultaSourceAndDestinationWarehouse(ref CWARSOURCE, ref CWARDESTINATION, ref strError); var validationSource = false; var validationDestination = false; //Validate Source and Destination Warehouse if (respuesta.Rows.Count > 0) { for (int i = 0; i < respuesta.Rows.Count; i++) { if (respuesta.Rows[i]["FILTRO"].ToString().ToUpper() == "SOURCE") { validationSource = true; } else if (respuesta.Rows[i]["FILTRO"].ToString().ToUpper() == "DESTINATION") { validationDestination = true; } } if (!validationSource) { lblError.Text = mensajes("sourceblank"); return; } else if (!validationDestination) { lblError.Text = mensajes("destinationblank"); return; } var dateNow = DateTime.Now; var ui = String.Concat(txtTruckID.Text.ToUpper(), dateNow.ToString("MMddyyyy"), dateNow.Hour.ToString().Length == 1 ? "0" + dateNow.Hour.ToString() : dateNow.Hour.ToString() , dateNow.Minute.ToString().Length == 1 ? "0" + dateNow.Minute.ToString() : dateNow.Minute.ToString()); //Save data in table whcol120 Ent_twhcol120 datatwhcol120 = new Ent_twhcol120() { unid = ui, date = dateNow.ToString(), logn = HttpContext.Current.Session["user"].ToString(), idtr = txtTruckID.Text.Trim().ToUpper(), whso = txtSourceWareHouse.Text.Trim().ToUpper(), whta = txtDestinationWareHouse.Text.Trim().ToUpper(), shpo = " ", enpi = 2, enre = 2, rcno = " ", prnt = 2, proo = 3, pror = 3, mes1 = " ", mes2 = " ", refcntd = 0, refcntu = 0 }; var resptwhcol120 = _idaltwhcol120.insertarRegistro(ref datatwhcol120, ref strError); if (resptwhcol120 > 0) { txtUI.Text = ui; divUniqueIdentifier.Visible = true; lblConfirm.Text = mensajes("msjsave"); Response.Redirect(String.Format("whInvPrintUI.aspx?tipoFormulario=print&UID={0}", ui)); return; } else { lblError.Text = mensajes("errorsave"); return; } } else { lblError.Text = mensajes("warehouseblank"); return; } } else { lblError.Text = mensajes("formempty"); return; } }