protected void btnGuardar_Click(object sender, EventArgs e) { XElement vFunciones = new XElement("FUNCIONES"); grdMenuGeneral.ExpandAllItems(); //SE EXPANDEN LOS NODOS PARA OBTENER LA SELECCIÓN DE TODOS LOS NODOS QUE VISUALMENTE ESTÁN OCULTOS vFunciones.Add(grdMenuGeneral.SelectedItems.Select(i => new XElement("FUNCION", new XAttribute("ID_FUNCION", ((TreeListDataItem)i).GetDataKeyValue("ID_FUNCION").ToString())))); grdMenuModulos.ExpandAllItems(); //SE EXPANDEN LOS NODOS PARA OBTENER LA SELECCIÓN DE TODOS LOS NODOS QUE VISUALMENTE ESTÁN OCULTOS vFunciones.Add(grdMenuModulos.SelectedItems.Select(i => new XElement("FUNCION", new XAttribute("ID_FUNCION", ((TreeListDataItem)i).GetDataKeyValue("ID_FUNCION").ToString())))); grdMenuAdicionales.ExpandAllItems(); //SE EXPANDEN LOS NODOS PARA OBTENER LA SELECCIÓN DE TODOS LOS NODOS QUE VISUALMENTE ESTÁN OCULTOS vFunciones.Add(grdMenuAdicionales.SelectedItems.Select(i => new XElement("FUNCION", new XAttribute("ID_FUNCION", ((TreeListDataItem)i).GetDataKeyValue("ID_FUNCION").ToString())))); SPE_OBTIENE_C_ROL_Result vRol = new SPE_OBTIENE_C_ROL_Result { CL_ROL = txtClRol.Text, FG_ACTIVO = chkActivo.Checked, NB_ROL = txtNbRol.Text, XML_AUTORIZACION = vFunciones.ToString() }; if (vClOperacion.Equals(E_TIPO_OPERACION_DB.A) && vIdRol != null) { vRol.ID_ROL = (int)vIdRol; } RolNegocio nRol = new RolNegocio(); E_RESULTADO vResultado = nRol.InsertaActualizaRoles(vClOperacion, vRol, vFunciones, vClUsuario, vNbPrograma); string vMensaje = vResultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE; UtilMensajes.MensajeResultadoDB(rwmAlertas, vMensaje, vResultado.CL_TIPO_ERROR); }
public void CargarGrilla() { try { lstFiltros = ObtenerFiltros(); dgListado.DataSource = null; miRolNegocio = new RolNegocio(); lstRoles = miRolNegocio.ObtenerRoles(lstFiltros); dgListado.ColumnCount = 3; dgListado.AutoGenerateColumns = false; dgListado.Columns[0].Name = "Código"; dgListado.Columns[0].DataPropertyName = "Codigo"; //dgListado.Columns[0].Visible = false; dgListado.Columns[1].Name = "Nombre"; dgListado.Columns[1].DataPropertyName = "Nombre"; dgListado.Columns[1].Width = 200; dgListado.Columns[2].Name = "Estado"; dgListado.Columns[2].DataPropertyName = "EstadoString"; dgListado.Columns[2].Width = 129; //Agrego la colección a la grilla. dgListado.DataSource = lstRoles; } catch (Exception ex) { throw ex; } }
private void GuardarRol() { try { miRolNegocio = new RolNegocio(); rol = ObtenerRolFormulario(); miRolNegocio.GuardarRol(rol); MessageBox.Show("¡Se guardaron los datos correctamente!", "Operación exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information); Padre.CargarGrilla(); //Cierro el formulario actual. this.Dispose(); } catch (SqlException ex) { if (ex.Message.Contains("U_Rol_Nombre")) { var result = MessageBox.Show("El Nombre ingresado ya se encuentra en uso, por favor intente con otro.", "Nombre duplicado", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // MessageBox.Show(MensajesError.ErrMensajeGuardarRol); } } catch (Exception ex) { //MessageBox.Show(MensajesError.ErrMensajeGuardarRol); } }
private void CargarFormulario() { try { txtUsername.Text = Usuario.Username; txtUsername.ReadOnly = true; // es la clave, no se puede editar. //txtPassword.Text = Usuario.Password; txtPassword.ReadOnly = true; chkInhabilitado.Checked = Usuario.Inhabilitado; txtPregunta.Text = Usuario.PreguntaSecreta; //txtRespuesta.Text = Usuario.RespuestaSecreta; txtRespuesta.ReadOnly = true; lblFechaCreacion.Text = Convert.ToString(Usuario.FechaCreacion); lblFechaModificacion.Text = Usuario.FechaUltimaModificacion != DateTime.MinValue ? Convert.ToString(Usuario.FechaUltimaModificacion) : string.Empty; //Cargo los roles RolNegocio miRolNegocio = new RolNegocio(); List <Rol> lstRolesTodos = new List <Rol>(); List <Rol> lstRolesNoAsignados = new List <Rol>(); lstRolesTodos = miRolNegocio.ObtenerRoles(new Dictionary <string, object>()); lstRolesNoAsignados = lstRolesTodos.Where(item => !usuario.Roles.Exists(r => r.Codigo == item.Codigo)).ToList(); ManejadorCombos.CargarListBoxRoles(ref lstNoAsignados, lstRolesNoAsignados); ManejadorCombos.CargarListBoxRoles(ref lstAsignados, usuario.Roles); } catch (Exception ex) { throw ex; } }
protected void CargarDatos(int?pIdRol) { RolNegocio nRol = new RolNegocio(); E_ROL vRol = nRol.ObtieneFuncionesRol(pIdRol); txtClRol.Text = vRol.CL_ROL; txtNbRol.Text = vRol.NB_ROL; chkActivo.Checked = vRol.FG_ACTIVO; vLstFunciones = vRol.LST_FUNCIONES; }
protected void btnEliminar_Click(object sender, EventArgs e) { RolNegocio nRol = new RolNegocio(); foreach (GridDataItem item in grdRoles.SelectedItems) { E_RESULTADO vResultado = nRol.EliminaRol(int.Parse(item.GetDataKeyValue("ID_ROL").ToString()), vClUsuario, vNbPrograma); string vMensaje = vResultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE; UtilMensajes.MensajeResultadoDB(rwmAlertas, vMensaje, vResultado.CL_TIPO_ERROR, pCallBackFunction: "onCloseWindow"); } }
private void CargarCombos() { try { RolNegocio miRolNegocio = new RolNegocio(); List <Rol> lstRolesTodos = miRolNegocio.ObtenerRoles(new Dictionary <string, object>()); ManejadorCombos.CargarListBoxRoles(ref lstNoAsignados, lstRolesTodos); } catch (Exception ex) { throw ex; } }
protected void CargarDatos(int?pIdRol) { RolNegocio nRol = new RolNegocio(); E_ROL vRol = nRol.ObtieneFuncionesRol(pIdRol); txtClRol.Text = vRol.CL_ROL; txtNbRol.Text = vRol.NB_ROL; chkActivo.Checked = vRol.FG_ACTIVO; vLstFunciones = vRol.LST_FUNCIONES; PlantillaFormularioNegocio nPlantilla = new PlantillaFormularioNegocio(); List <SPE_OBTIENE_C_PLANTILLA_FORMULARIO_Result> vLstPlantillas = nPlantilla.ObtienePlantillas(); rcbPlantilla.DataSource = vLstPlantillas.Where(w => w.CL_FORMULARIO == "INVENTARIO").ToList(); rcbPlantilla.DataTextField = "NB_PLANTILLA_SOLICITUD"; rcbPlantilla.DataValueField = "ID_PLANTILLA_SOLICITUD"; rcbPlantilla.DataBind(); if (vRol.ID_PLANTILLA != null) { rcbPlantilla.ClearSelection(); rcbPlantilla.SelectedValue = vRol.ID_PLANTILLA.ToString(); } if (vRol.XML_GRUPOS != null) { vLstGruposPlaza = (XElement.Parse(vRol.XML_GRUPOS).Elements("GRUPOS")).Select(s => new E_GRUPOS { ID_GRUPO = int.Parse(s.Attribute("ID_GRUPO").Value), CL_GRUPO = s.Attribute("CL_GRUPO").Value, NB_GRUPO = s.Attribute("NB_GRUPO").Value }).ToList(); } else { vLstGruposPlaza.Add(new E_GRUPOS() { ID_GRUPO = 1, CL_GRUPO = "TODOS", NB_GRUPO = "Todos" }); } }
private void EliminarRegistro() { try { Rol miRol = new Rol(); DataGridViewRow miFilaSeleccionada = dgListado.SelectedRows[0]; int codigoRol = Convert.ToInt32(miFilaSeleccionada.Cells[0].Value); miRol = lstRoles.Find(x => x.Codigo == codigoRol); miRolNegocio = new RolNegocio(); miRolNegocio.EliminarRol(codigoRol); // MessageBox.Show(MensajesInfo.InfoRolEliminado); //Refresco la grilla. CargarGrilla(); } catch (Exception ex) { MessageBox.Show(MensajesError.ErrMensajeBaja); } }
protected void grdRoles_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { RolNegocio nRol = new RolNegocio(); grdRoles.DataSource = nRol.ObtieneRoles(null); }