private void SelectRol_Action() { ENTResponse oENTResponse = new ENTResponse(); ENTRol oENTRol = new ENTRol(); ENTSession oENTSession; BPRol oBPRol = new BPRol(); DataTable tblRol; try { // Estado inicial this.lblActionMessage.Text = ""; // Formulario oENTRol.idRol = 0; oENTRol.sNombre = ""; oENTRol.tiActivo = Int16.Parse(this.ddlActionStatus.SelectedItem.Value); // Transacción oENTResponse = oBPRol.SelectRol(oENTRol); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { this.lblActionMessage.Text = oENTResponse.sMessage; } // Seguridad oENTSession = (ENTSession)this.Session["oENTSession"]; tblRol = (oENTSession.idRol != 1 ? deleteDataTableRow(oENTResponse.dsResponse.Tables[1], "idRol", "1") : oENTResponse.dsResponse.Tables[1]); // Llenado de combo this.ddlActionRol.DataTextField = "sNombre"; this.ddlActionRol.DataValueField = "idRol"; this.ddlActionRol.DataSource = tblRol; this.ddlActionRol.DataBind(); // Agregar Item de selección this.ddlActionRol.Items.Insert(0, new ListItem("[Seleccione]", "0")); } catch (Exception ex) { throw (ex); } }
void SelectRol(ENTRol oENTRol) { ENTResponse oENTResponse = new ENTResponse(); BPRol oBPRol = new BPRol(); try{ // Transacción oENTResponse = oBPRol.SelectRol(oENTRol); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Transacción exitosa ExportExcel(oENTResponse.dsResponse.Tables[2], "Rol"); }catch (Exception ex){ throw (ex); } }
private void UpdateRol_Estatus(Int32 idRol, RolActionTypes RolActionType) { ENTRol oENTRol = new ENTRol(); ENTResponse oENTResponse = new ENTResponse(); BPRol oBPRol = new BPRol(); try { // Formulario oENTRol.idRol = idRol; switch (RolActionType) { case RolActionTypes.DeleteRol: oENTRol.tiActivo = 0; break; case RolActionTypes.ReactivateRol: oENTRol.tiActivo = 1; break; default: throw new Exception("Opción inválida"); } // Transacción oENTResponse = oBPRol.UpdateRol_Estatus(oENTRol); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); } // Actualizar datos SelectRol(); } catch (Exception ex) { throw (ex); } }
private void UpdateRol(Int32 idRol) { ENTRol oENTRol = new ENTRol(); ENTResponse oENTResponse = new ENTResponse(); BPRol oBPRol = new BPRol(); DataTable tblSelected; DataRow rowSelected; try { // Formulario oENTRol.idRol = idRol; oENTRol.sDescripcion = this.txtActionDescripcion.Text.Trim(); oENTRol.sNombre = this.txtActionNombre.Text.Trim(); oENTRol.tiActivo = Int16.Parse(this.ddlActionStatus.SelectedValue); // Listado de SubMenús asociados tblSelected = (DataTable)this.ViewState["tblSubMenu"]; oENTRol.tblSubMenu = new DataTable("tblSubMenu"); oENTRol.tblSubMenu.Columns.Add("idSubMenu", typeof(Int32)); foreach (DataRow rowCurrentSelected in tblSelected.Select("tiSelected = 1")) { rowSelected = oENTRol.tblSubMenu.NewRow(); rowSelected["idSubMenu"] = rowCurrentSelected["idSubMenu"]; oENTRol.tblSubMenu.Rows.Add(rowSelected); } // Transacción oENTResponse = oBPRol.UpdateRol(oENTRol); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); } // Transacción exitosa ClearActionPanel(); // Actualizar grid SelectRol(); // Mensaje de usuario ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "alert('Rol actualizado con éxito!'); focusControl('" + this.txtNombre.ClientID + "');", true); } catch (Exception ex) { throw (ex); } }
private void SelectRol_ForEdit(Int32 idRol) { ENTRol oENTRol = new ENTRol(); ENTResponse oENTResponse = new ENTResponse(); BPRol oBPRol = new BPRol(); DataTable tblSubMenu = null; try { // Formulario oENTRol.idRol = idRol; oENTRol.sNombre = ""; oENTRol.tiActivo = 2; // Transacción oENTResponse = oBPRol.SelectRol(oENTRol); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD this.lblActionMessage.Text = oENTResponse.sMessage; // Llenado de formulario this.txtActionNombre.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sNombre"].ToString(); this.txtActionDescripcion.Text = oENTResponse.dsResponse.Tables[1].Rows[0]["sDescripcion"].ToString(); this.ddlActionStatus.SelectedValue = oENTResponse.dsResponse.Tables[1].Rows[0]["tiActivo"].ToString(); this.ddlActionMenu.SelectedIndex = 0; // SubMenus asociados al Rol tblSubMenu = (DataTable)this.ViewState["tblSubMenu"]; foreach (DataRow rowAssociated in oENTResponse.dsResponse.Tables[3].Rows) { if (tblSubMenu.Select("idSubMenu = " + rowAssociated["idSubMenu"]).Length == 1) { tblSubMenu.Select("idSubMenu = " + rowAssociated["idSubMenu"])[0]["tiSelected"] = "1"; } } // Actualizar ViewState this.ViewState["tblSubMenu"] = tblSubMenu; this.ViewState["tblSubMenu_Filtered"] = this.ViewState["tblSubMenu"]; // Llenado de controles this.gvActionSubMenu.DataSource = tblSubMenu; this.gvActionSubMenu.DataBind(); } catch (Exception ex) { throw (ex); } }
private void SelectRol() { ENTRol oENTRol = new ENTRol(); ENTResponse oENTResponse = new ENTResponse(); BPRol oBPRol = new BPRol(); String sMessage = ""; try { // Formulario oENTRol.sNombre = this.txtNombre.Text; oENTRol.tiActivo = Int16.Parse(this.ddlStatus.SelectedItem.Value); // Transacción oENTResponse = oBPRol.SelectRol(oENTRol); // Validaciones if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); } // Mensaje de la BD if (oENTResponse.sMessage != "") { sMessage = "alert('" + gcJavascript.ClearText(oENTResponse.sMessage) + "');"; } // Llenado de controles this.gvRol.DataSource = oENTResponse.dsResponse.Tables[1]; this.gvRol.DataBind(); // Mensaje al usuario ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), sMessage, true); } catch (Exception ex) { throw (ex); } }