Example #1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            DM.Menu       objMenu    = new DM.Menu();
            MenuWCFClient objMenuWCF = new MenuWCFClient();

            try
            {
                objMenu.idMenu            = int.Parse((string)ViewState["idMenu"]);
                objMenu.nombreMenu        = txtNombre.Text;
                objMenu.url               = txtURL.Text;
                objMenu.activo            = ckbActivo.Checked;
                objMenu.defecto           = ckbDefecto.Checked;
                objMenu.idUsuarioModifico = ((Usuario_LoginResult)Session["Usuario"]).idUsuario;
                string lstPerfil = "";
                if (ltbPerfil.CheckedItems.Count > 0)
                {
                    foreach (RadListBoxItem item in ltbPerfil.Items)
                    {
                        if (item.Checked)
                        {
                            lstPerfil = lstPerfil + "," + item.Value;
                        }
                    }
                    lstPerfil = lstPerfil.Substring(1, lstPerfil.Length - 1);
                }

                objMenuWCF.Menu_Modificar(objMenu, int.Parse(cboEmpresa.SelectedValue), lstPerfil);

                btnGuardar.Visible  = false;
                btnCancelar.Visible = false;
                btnEditar.Visible   = true;

                txtNombre.Enabled  = false;
                txtURL.Enabled     = false;
                cboEmpresa.Enabled = false;
                ltbPerfil.Enabled  = false;

                rtvMenu.Enabled = true;

                lblMensaje.Text     = "Se guardo el menú con código: " + txtCodigo.Text;
                lblMensaje.CssClass = "mensajeExito";
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void Menu_Cargar(int idPerfil)
        {
            MenuWCFClient objMenuWCF;

            try {
                objMenuWCF = new MenuWCFClient();
                rmMenuPrincipal.DataSource           = objMenuWCF.Menu_CargarInicio(idPerfil);
                rmMenuPrincipal.DataTextField        = "nombreMenu";
                rmMenuPrincipal.DataNavigateUrlField = "url";
                rmMenuPrincipal.DataFieldID          = "codigo";
                rmMenuPrincipal.DataFieldParentID    = "codigoPadre";
                rmMenuPrincipal.DataBind();
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            MenuWCFClient objMenuWCF;

            try
            {
                objMenuWCF = new MenuWCFClient();
                objMenuWCF.Menu_Registrar(Menu_Obtener());

                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebind();", true);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Example #4
0
        private void MenuPerfil_Cargar(int idEmpresa, int idMenu)
        {
            MenuWCFClient objMenuWCF = new MenuWCFClient();

            try {
                ltbPerfil.ClearChecked();
                List <MenuPerfil_ListarResult> lst = objMenuWCF.MenuPerfil_Listar(idEmpresa, idMenu).ToList();
                foreach (RadListBoxItem item in ltbPerfil.Items)
                {
                    if (lst.FindAll(x => x.idPerfil.ToString() == item.Value).Count > 0)
                    {
                        item.Checked = true;
                    }
                }
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Example #5
0
        private void Menu_Listar()
        {
            MenuWCFClient objMenuWCF;

            try
            {
                objMenuWCF           = new MenuWCFClient();
                ViewState["lstMenu"] = JsonHelper.JsonSerializer <Menu_ListarResult[]>(objMenuWCF.Menu_Listar());

                rtvMenu.DataSource        = JsonHelper.JsonDeserialize <Menu_ListarResult[]>((string)ViewState["lstMenu"]);
                rtvMenu.DataTextField     = "nombreMenu";
                rtvMenu.DataValueField    = "idMenu";
                rtvMenu.DataFieldParentID = "codigoPadre";
                rtvMenu.DataFieldID       = "codigo";
                rtvMenu.DataBind();

                lblMensaje.Text     = "Información cargada con éxito.";
                lblMensaje.CssClass = "mensajeExito";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }