protected void btn_grabar_Click(object sender, EventArgs e) { int nivel = Convert.ToInt32(txt_perfilPermisos.Text); if (nivel >= user.NIVEL_PERMISOS) { if (!string.IsNullOrEmpty(this.hf_checkMenus.Value)) { PerfilBC perfil = new PerfilBC(); perfil.NOMBRE = txt_nombreEdita.Text; perfil.DESCRIPCION = txt_perfilDescripcion.Text; perfil.MENU = this.hf_checkMenus.Value; perfil.MOBILE = false; perfil.NIVEL_PERMISOS = nivel; string texto; if (this.hf_id.Value == "") { if (perfil.Ingresa(perfil)) { texto = "Perfil creado con éxito!"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true); } else { texto = "Error!"; } } else { perfil.ID = int.Parse(hf_id.Value); if (perfil.Modifica(perfil)) { texto = "Perfil modificado con éxito!"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true); } else { texto = "Ha ocurrido un problema al intentar modificar el perfil!"; } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('No hay módulos seleccionados');", true); } ObtenerPerfiles(true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Nivel de permiso no autorizado.');", true); } }
protected void btn_grabarPerfil_Click(object sender, EventArgs e) { PerfilBC perfil = new PerfilBC(); perfil.NOMBRE = txt_nombreEdita.Text; perfil.DESCRIPCION = txt_descripcionEdita.Text; perfil.MENU = this.hf_checkMenus.Value; perfil.MOBILE = true; perfil.NIVEL_PERMISOS = Convert.ToInt32(txt_editPermisos.Text); if (perfil.MENU != "") { if (this.hf_id.Value == "") { if (perfil.Ingresa(perfil)) { ObtenerPerfiles(true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Perfil creado con éxito!');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error!');", true); } } else { perfil.ID = int.Parse(hf_id.Value); if (perfil.Modifica(perfil)) { ObtenerPerfiles(true); string texto = "Perfil modificado con éxito!"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPerfil');", true); } else { string texto = "Ha ocurrido un problema al intentar modificar el perfil!"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + texto + "');", true); } } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('No hay módulos seleccionados');", true); } hf_checkMenus.Value = ""; hf_id.Value = ""; }