private List <CatGeneralesBE> GetCatGenerales(string sIdCatGenerales = null) { List <CatGeneralesBE> lstCatGenerales = new List <CatGeneralesBE>(); CatalogosBR oCatBus = new CatalogosBR(); RespuestaComunBE RespuestaComun = new RespuestaComunBE(); CatGeneralesBE item = new CatGeneralesBE(); item.psIDCATGENERALES = sIdCatGenerales; RespuestaComun = oCatBus.GetCatGenerales(item); if (RespuestaComun.itemError.pbFlag) { if (sIdCatGenerales == null) { ViewState["lstCatGenerales"] = RespuestaComun.lstCatGenerales; } else { item.psNOMBRECATALOGO = RespuestaComun.lstCatGenerales[0].psNOMBRECATALOGO.ToString(); item.psIDCATALOGO = RespuestaComun.lstCatGenerales[0].psIDCATALOGO.ToString(); item.psFILTRO = RespuestaComun.lstCatGenerales[0].psFILTRO.ToString(); item.psDESCRIPCION = RespuestaComun.lstCatGenerales[0].psDESCRIPCION.ToString(); item.psACTIVO = RespuestaComun.lstCatGenerales[0].psACTIVO; CatGeneralesWUC.SetCatGenerales(item); } } lstCatGenerales = RespuestaComun.lstCatGenerales; return(lstCatGenerales); }
public RespuestaComunBE GetCatEspecifico(string sIdCatalogo, string sValorFiltro = "") { CatalogosDA oCatalogosDA = new CatalogosDA(); CatGeneralesBE item = new CatGeneralesBE(); ConfiguracionDA oConfiguracionDA = new ConfiguracionDA(); RespuestaComunBE Respuesta = new RespuestaComunBE(); ConfiguracionBE itemConfig = new ConfiguracionBE(); string sConexionString = string.Empty; //itemConfig.psIDCONFIGAPP = ConfigurationSettings.AppSettings["IELDBConn"].ToString(); //Respuesta = oConfiguracionDA.GetConfigAPP(itemConfig); sConexionString = System.Configuration.ConfigurationManager.ConnectionStrings["IELDBConn"].ConnectionString; item.psIDCATGENERALES = sIdCatalogo; Respuesta = GetCatGenerales(item); item = Respuesta.lstCatGenerales[0]; item.psVALORFILTRO = sValorFiltro; Respuesta = oCatalogosDA.GetCatEspecifico(Respuesta.lstCatGenerales[0], sConexionString); return(Respuesta); }
public void SetCatGenerales(CatGeneralesBE item) { txtColumnaId.Text = item.psIDCATALOGO.ToUpper(); ddlCatGenerales.SelectedValue = item.psIDCATGENERALES.ToUpper(); txtDescripcion.Text = item.psDESCRIPCION.ToUpper(); txtFiltro.Text = item.psFILTRO.ToUpper(); chkActivo.Checked = bool.Parse(item.psACTIVO); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); StringBuilder sMensajelbl = new StringBuilder(string.Empty); List <CatGeneralesBE> lstCatGenerales = (List <CatGeneralesBE>)ViewState["lstCatGenerales"]; CatGeneralesBE item = new CatGeneralesBE(); string sIdCatalogo = grdCatGenerales.DataKeys[index].Value.ToString(); item = lstCatGenerales[int.Parse(sIdCatalogo) - 1]; if (e.CommandName.Equals("AdmonCatalogo")) { GridViewRow gvrow = grdCatGenerales.Rows[index]; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#mdlAdmon').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "mdlAdmonScript", sb.ToString(), false); sMensajelbl.Append(" ADMINISTRAR CATALOGO "); sMensajelbl.Append(item.psNOMBRECATALOGO); lblAdministrar.Text = sMensajelbl.ToString(); CatalogosWUC.SetGrid(sIdCatalogo, true); CatalogosWUC.RegisterGridpaging(); } else if (e.CommandName.Equals("editRecord")) { GridViewRow gvrow = grdCatGenerales.Rows[index]; sIdCatalogo = grdCatGenerales.DataKeys[index].Value.ToString(); ViewState["sEditar"] = "1"; //GridViewRow gvrow = GridView1.Rows[index]; //lblIDAplicacion.Text = HttpUtility.HtmlDecode(gvrow.Cells[0].Text).ToString(); //txtDescripcion.Text = HttpUtility.HtmlDecode(gvrow.Cells[1].Text); //txtPassword.Text = HttpUtility.HtmlDecode(gvrow.Cells[2].Text); //lblResult.Visible = false; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#mdlCatalogo').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "mdlCatalogoScript", sb.ToString(), false); CatGeneralesWUC.SetDdlCatalogos(2); GetCatGenerales(sIdCatalogo); sMensajelbl.Append(" EDITAR CATALOGO "); sMensajelbl.Append(item.psNOMBRECATALOGO); lblTituloModal.Text = sMensajelbl.ToString(); } }
private void AddCatGenerales() { CatalogosBR oCatBus = new CatalogosBR(); RespuestaComunBE RespuestaComun = new RespuestaComunBE(); CatGeneralesBE item = new CatGeneralesBE(); item = CatGeneralesWUC.GetCatGenerales(); RespuestaComun = oCatBus.AddCatGenerales(item); if (RespuestaComun.itemError.pbFlag) { SetGrid(true); } }
public CatGeneralesBE GetCatGenerales() { CatGeneralesBE item = new CatGeneralesBE(); item.psIDCATALOGO = txtColumnaId.Text.ToUpper(); //item.psIDCATGENERALES = ddlCatGenerales.SelectedValue; item.psNOMBRECATALOGO = ddlCatGenerales.SelectedItem.ToString().ToUpper(); if (chkPersonalizado.Checked) { item.psNOMBRECATALOGO = txtCatGenerales.Text; } item.psDESCRIPCION = txtDescripcion.Text.ToUpper(); item.psFILTRO = txtFiltro.Text.ToUpper(); item.psACTIVO = chkActivo.Checked == true ? "1" : "0"; return(item); }
public RespuestaComunBE SetCatGenerales(CatGeneralesBE item) { CatalogosDA oCatalogosDA = new CatalogosDA(); ConfiguracionDA oConfiguracionDA = new ConfiguracionDA(); RespuestaComunBE Respuesta = new RespuestaComunBE(); ConfiguracionBE itemConfig = new ConfiguracionBE(); string sConexionString = string.Empty; //itemConfig.psIDCONFIGAPP = ConfigurationSettings.AppSettings["IELDBConn"].ToString(); //Respuesta = oConfiguracionDA.GetConfigAPP(itemConfig); sConexionString = System.Configuration.ConfigurationManager.ConnectionStrings["IELDBConn"].ConnectionString; Respuesta = oCatalogosDA.SetCatGenerales(item, sConexionString); return(Respuesta); }
/// <summary> /// Agrega la tabla CatGenerales. Definición de todos los catalogos de la aplicación /// </summary> /// <param name="item">Se usa CatGeneralesBE Total mente llena para insertar</param> /// <param name="sConexionString">cadena de conexión que se obtiene de la clase ConfiguracionDA</param> /// <returns>RespuestaComun.lstCatGenerales</returns> public RespuestaComunBE AddCatGenerales(CatGeneralesBE item, string sConexionString) { RespuestaComunBE RespuestaComun = new RespuestaComunBE(); OleDbCommand Comando = new OleDbCommand(); OleDbConnection Conexion = new OleDbConnection(); OleDbTransaction Transaccion = null; string sComando = string.Empty; StringBuilder sMensajeError = new StringBuilder(); string sResultado = string.Empty; RespuestaComun.itemError = new ErrorBE(); RespuestaComun.itemError.psMensaje = new StringBuilder(string.Empty); try { Conexion.ConnectionString = sConexionString; Conexion.Open(); Transaccion = Conexion.BeginTransaction(); Comando.Connection = Conexion; Comando.Transaction = Transaccion; sComando = "spAddCatGenerales"; Comando.CommandText = sComando; Comando.CommandType = CommandType.StoredProcedure; Comando.CommandTimeout = 0; Comando.Parameters.Clear(); Comando.Parameters.Add(new OleDbParameter("NOMBRECATALOGO", item.psNOMBRECATALOGO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("IDCATALOGO", item.psIDCATALOGO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("DESCRIPCION", item.psDESCRIPCION)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("FILTRO", item.psFILTRO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("ACTIVO", item.psACTIVO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("IDCATGENERALESNEW", OleDbType.BigInt)).Direction = ParameterDirection.Output; //[15102015][falta agregar la instruccion que obtiene el nombre del metodo]RespuestaComun.itemError.psMensaje.Append("[spGetConfigApp]"); RespuestaComun.itemError.psMensaje.Append("[spAddCatGenerales]"); Comando.ExecuteNonQuery(); RespuestaComun.psIDCONFIGAPP = Comando.Parameters["IDCATGENERALESNEW"].Value.ToString(); Transaccion.Commit(); RespuestaComun.itemError.pbFlag = true; } catch (Exception Ex) { //Generar una deccion para crear Log de errores RespuestaComun.itemError.psMensaje.Append("["); RespuestaComun.itemError.psMensaje.Append(Ex.Message); RespuestaComun.itemError.psMensaje.Append("]"); RespuestaComun.itemError.pbFlag = false; } finally { Transaccion.Dispose(); Transaccion = null; Comando.Dispose(); Comando = null; Conexion.Close(); Conexion = null; } return(RespuestaComun); }
/// <summary> /// Consulta de catalogo espeficico. Definición de todos los catalogos de la aplicación /// </summary> /// <param name="item">Se usa CatGeneralesBE para la consulta, Se requiere el idCatGenerales</param> /// <param name="sConexionString">cadena de conexión que se obtiene de la clase ConfiguracionDA</param> /// <returns>RespuestaComun.lstCatGenerales</returns> public RespuestaComunBE GetCatEspecifico(CatGeneralesBE item, string sConexionString) { RespuestaComunBE RespuestaComun = new RespuestaComunBE(); OleDbCommand Comando = new OleDbCommand(); OleDbConnection Conexion = new OleDbConnection(); OleDbDataReader Lector = null; string sComando = string.Empty; StringBuilder sMensajeError = new StringBuilder(); string sResultado = string.Empty; RespuestaComun.lstCatalogo = new List <CatalogosBE>(); RespuestaComun.itemError = new ErrorBE(); RespuestaComun.itemError.psMensaje = new StringBuilder(string.Empty); try { Conexion.ConnectionString = sConexionString; Conexion.Open(); Comando.Connection = Conexion; sComando = "spGetCatEspecifico"; Comando.CommandText = sComando; Comando.CommandType = CommandType.StoredProcedure; Comando.CommandTimeout = 0; Comando.Parameters.Clear(); Comando.Parameters.Add(new OleDbParameter("IDCATGENERALES", item.psIDCATGENERALES)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("NOMBRECATALOGO", item.psNOMBRECATALOGO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("IDCATALOGO", item.psIDCATALOGO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("DESCRIPCION", item.psDESCRIPCION)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("FILTRO", item.psFILTRO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("ACTIVO", item.psACTIVO)).Direction = ParameterDirection.Input; Comando.Parameters.Add(new OleDbParameter("VALORFILTRO", item.psVALORFILTRO)).Direction = ParameterDirection.Input; //[15102015][falta agregar la instruccion que obtiene el nombre del metodo]RespuestaComun.itemError.psMensaje.Append("[spGetConfigApp]"); RespuestaComun.itemError.psMensaje.Append("[spGetCatEspecifico]"); Lector = Comando.ExecuteReader(); if (Lector.HasRows) { while (Lector.Read()) { CatalogosBE itemLector = new CatalogosBE(); itemLector.ID = Lector["ID"].ToString(); itemLector.DESCRIPCION = Lector["DESCRIPCION"].ToString(); RespuestaComun.lstCatalogo.Add(itemLector); } } RespuestaComun.itemError.pbFlag = true; } catch (Exception Ex) { //Generar una deccion para crear Log de errores RespuestaComun.itemError.psMensaje.Append("["); RespuestaComun.itemError.psMensaje.Append(Ex.Message); RespuestaComun.itemError.psMensaje.Append("]"); RespuestaComun.itemError.pbFlag = false; } finally { Lector.Close(); Lector.Dispose(); Lector = null; Comando.Dispose(); Comando = null; Conexion.Close(); Conexion = null; } return(RespuestaComun); }