Example #1
0
        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);
            }
        }
Example #2
0
        private void SetPanel(RolActionTypes RolActionType, Int32 idItem = 0)
        {
            try
            {

                // Acciones comunes
                this.pnlAction.Visible = true;
                this.hddRol.Value = idItem.ToString();

                // Detalle de acción
                switch (RolActionType)
                {
                    case RolActionTypes.InsertRol:
                        this.lblActionTitle.Text = "Nuevo Rol";
                        this.btnAction.Text = "Crear Rol";

                        break;

                    case RolActionTypes.UpdateRol:
                        this.lblActionTitle.Text = "Edición de Rol";
                        this.btnAction.Text = "Actualizar Rol";
                        SelectRol_ForEdit(idItem);
                        break;

                    default:
                        throw (new Exception("Opción inválida"));
                }

                // Foco
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "focusControl('" + this.txtActionNombre.ClientID + "');", true);

            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }