SelectRol() public method

Consulta el catálogo de Rols
BPRol.SelectRol 21-Octubre-2013 GCSoft - Web Project Creator BETA 1.0
public SelectRol ( ENTRol oENTRol ) : ENTResponse
oENTRol SIAQ.Entity.Object.ENTRol Entidad de Rol con los filtros necesarios para la consulta
return SIAQ.Entity.Object.ENTResponse
Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        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);
            }
        }