private void btnBAJAS_Click(object sender, EventArgs e) { if (dgvDATA.CurrentRow == null) { MessageBox.Show("Debe seleccionar un grupo de usuarios", "ATENCION!!"); return; } MODELO.GRUPO oGRUPO = cGRUPOS.OBTENER_GRUPO(Convert.ToInt32(dgvDATA.CurrentRow.Cells[0].Value)); DialogResult confirma = System.Windows.Forms.DialogResult.No; if (oGRUPO.USUARIO.Count > 1) { confirma = MessageBox.Show("El grupo " + oGRUPO.DESCRIPCION + " posee " + oGRUPO.USUARIO.Count + " usuarios asignados, por lo tanto no podrá ser eliminado pero si confirma la operación el estado del mismo será inactivo. ¿Confirma que desea desactivar el grupo?.", "ATENCION!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (oGRUPO.USUARIO.Count == 1) { confirma = MessageBox.Show("El grupo " + oGRUPO.DESCRIPCION + " posee " + oGRUPO.USUARIO.Count + " usuario asignado, por lo tanto no podrá ser eliminado pero si confirma la operación el estado del mismo será inactivo. ¿Confirma que desea desactivar el grupo?.", "ATENCION!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (oGRUPO.USUARIO.Count == 0) { confirma = MessageBox.Show("El grupo " + oGRUPO.DESCRIPCION + " no posee usuarios asignado, por lo tanto será eliminado. ¿Confirma que desea eliminar el grupo?.", "ATENCION!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (confirma == System.Windows.Forms.DialogResult.Yes) { cGRUPOS.ELIMINAR_GRUPO(oGRUPO); ARMA_GRILLA(); } }
public System.Collections.IEnumerable OBTENER_USUARIOS_GRUPOS_STRING(MODELO.GRUPO oGrupo, string APELLIDO) { var usuarios = from usuario in oMODELO_SEGURIDAD.USUARIOS.Include("GRUPOS").ToList() where (usuario.Apellido.ToLower().Contains(APELLIDO.ToLower()) && usuario.Grupos.Contains(oGrupo)) select usuario; return(usuarios.ToList()); }
public System.Collections.IEnumerable OBTENER_USUARIOS_GRUPOS(MODELO.GRUPO oGrupo) { var usuarios = from usuario in oMODELO_SEGURIDAD.USUARIOS.Include("GRUPOS").ToList() where usuario.Grupos.Contains(oGrupo) select usuario; return(usuarios.ToList()); }
public FrmMenu(MODELO.USUARIO unUsuario, MODELO.SEGURIDAD.ACCESO unAcceso) { InitializeComponent(); btnUSUARIOS.Enabled = false; btnGRUPOS.Enabled = false; btnVENTA.Enabled = false; //btnSEGURIDAD.Enabled = false; cSeguridad = CONTROLADORA.SEGURIDAD.Singleton(); oUsuario = unUsuario; oAcceso = unAcceso; //Cambiar_Clavebtn.Enabled = true; armarDatosUsuario(); oAcceso = new MODELO.SEGURIDAD.ACCESO(); oAccesos = CONTROLADORA.Seguridad.ACCESO.obtenerInstancia(); for (int i = 0; i < oUsuario.Grupos.Count(); i++) { oGrupo = oUsuario.Grupos[i]; if (oGrupo.Permisos.Count() > 0) { for (int z = 0; z < oGrupo.Permisos.Count(); z++) { if ((oGrupo.Permisos[z].Descripcion == "Agregar Usuario") || (oGrupo.Permisos[z].Descripcion == "Modificar Usuario") || (oGrupo.Permisos[z].Descripcion == "Eliminar Usuario")) { btnUSUARIOS.Enabled = true; accion1 = true; } if ((oGrupo.Permisos[z].Descripcion == "Agregar Grupo") || (oGrupo.Permisos[z].Descripcion == "Modificar Grupo") || (oGrupo.Permisos[z].Descripcion == "Eliminar Grupo") || (oGrupo.Permisos[z].Descripcion == "Consultar Grupo")) { btnGRUPOS.Enabled = true; accion2 = true; } if ((oGrupo.Permisos[z].Descripcion == "Agregar Venta") || (oGrupo.Permisos[z].Descripcion == "Modificar Venta") || (oGrupo.Permisos[z].Descripcion == "Eliminar Venta") || (oGrupo.Permisos[z].Descripcion == "Consultar Venta") || (oGrupo.Permisos[z].Descripcion == "Exportar Venta")) { btnVENTA.Enabled = true; accion3 = true; } if ((oGrupo.Permisos[z].Descripcion == "Agregar Compra") || (oGrupo.Permisos[z].Descripcion == "Modificar Compra") || (oGrupo.Permisos[z].Descripcion == "Eliminar Compra") || (oGrupo.Permisos[z].Descripcion == "Consultar Compra") || (oGrupo.Permisos[z].Descripcion == "Exportar Compra")) { accion4 = true; } if ((oGrupo.Permisos[z].Descripcion == "Agregar Stock") || (oGrupo.Permisos[z].Descripcion == "Modificar Stock") || (oGrupo.Permisos[z].Descripcion == "Eliminar Stock") || (oGrupo.Permisos[z].Descripcion == "Consultar Stock") || (oGrupo.Permisos[z].Descripcion == "Exportar Stock")) { accion5 = true; } if ((oGrupo.Permisos[z].Descripcion == "Resetear Clave")) { //btnSEGURIDAD.Enabled = true; // btnCAMBIARPASS.Enabled = true; accion6 = true; } } } } }
public FrmModificarGr(MODELO.GRUPO miGrupo) { InitializeComponent(); cSeguridad = CONTROLADORA.SEGURIDAD.Singleton(); oGrupo = miGrupo; txtNOMBRE.Text = oGrupo.Nombre; cbESTADO.Checked = oGrupo.Estado; ArmarUsuario(); ArmarPermiso(); }
private void btnMODIFICAR_Click_1(object sender, EventArgs e) { if (dgvGRUPO.CurrentRow == null) { MessageBox.Show("Debe seleccionar un grupo"); return; } oGrupo = (MODELO.GRUPO)dgvGRUPO.CurrentRow.DataBoundItem; GRUPO.FrmConsultaG frm = new GRUPO.FrmConsultaG(oGrupo); DialogResult dr = frm.ShowDialog(); }
public FrmAgregarGr(MODELO.GRUPO miGrupo, MODELO.USUARIO unUsuario) { InitializeComponent(); cSeguridad = CONTROLADORA.SEGURIDAD.Singleton(); oGrupo = miGrupo; oUsuario = unUsuario; ArmarUsuarios(); ArmarPermisos(); cAuditoria = new CONTROLADORA.Seguridad.AUDITORIA(); oAuditoria = new MODELO.SEGURIDAD.AUDITORIA(); }
public FrmConsultaG(MODELO.GRUPO miGrupo) { InitializeComponent(); cSeguridad = CONTROLADORA.SEGURIDAD.Singleton(); oGrupo = miGrupo; ArmarUsuario(); cblUSUARIOS.Enabled = false; cbxPERMISO.Enabled = false; ArmarUsuario(); ArmarPermiso(); }
public System.Collections.IEnumerable OBTENER_USUARIOS(string nombre, MODELO.GRUPO grupo, bool inactivos) { var usuarios = from usuario in oCATALOGO.USUARIOS.ToList() where usuario.NOMBRE.Contains(nombre) && (grupo != null ? usuario.GRUPO.Contains(grupo) : true) select new { ID = usuario.CODIGO, USUARIO = usuario.NOMBRE_USUARIO, NOMBRE = usuario.NOMBRE, GRUPOS = usuario.GRUPOS_USUARIO, ACTIVO = usuario.ACTIVO }; if (!inactivos) { usuarios = usuarios.Where(usu => usu.ACTIVO == true); } return(usuarios.ToList()); }
public void ELIMINAR_GRUPO(MODELO.GRUPO oGRUPO) { if (oGRUPO.USUARIO.Count > 0) { oGRUPO.ACTIVO = false; oCATALOGO.Entry(oGRUPO).State = System.Data.Entity.EntityState.Modified; } else { oCATALOGO.GRUPOS.Remove(oGRUPO); } oCATALOGO.SaveChanges(); }
private void ARMA_GRILLA() { if (rbTODOS.Checked) { oGRUPO = null; } else { oGRUPO = (MODELO.GRUPO)cmbGRUPO.SelectedItem; } dgvDATA.DataSource = null; dgvDATA.DataSource = cUSUARIOS.OBTENER_USUARIOS(txtDESCRIPCION.Text, oGRUPO, chkINACTIVOS.Checked); }
private void cmbGRUPO_SelectedIndexChanged(object sender, EventArgs e) { oGrupo = (MODELO.GRUPO)cmbGRUPO.SelectedItem; cmbESTADO.Text = "Todos"; if (oGrupo.Nombre == "Todos") { armar_grilla_todos(); } else { armar_grilla_grupos(); } }
private void button3_Click(object sender, EventArgs e) { if (dgvGRUPO.CurrentRow == null) { MessageBox.Show("Debe seleccionar un grupo"); return; } MODELO.GRUPO oGRUPO = (MODELO.GRUPO)dgvGRUPO.CurrentRow.DataBoundItem; DialogResult dr = MessageBox.Show("¿Desea eliminar el grupo " + oGRUPO.Nombre + "?", "CONFIRMA", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { cSeguridad.GRUPOS.ELIMINAR_GRUPO(oGRUPO); armar_grilla(); } }
private void button2_Click(object sender, EventArgs e) { if (dgvGRUPO.CurrentRow == null) { MessageBox.Show("Debe seleccionar un grupo"); return; } oGrupo = (MODELO.GRUPO)dgvGRUPO.CurrentRow.DataBoundItem; GRUPO.FrmModificarGr frm = new GRUPO.FrmModificarGr(oGrupo); DialogResult dr = frm.ShowDialog(); if (dr == DialogResult.OK) { armar_grilla(); } }
private void chkGRUPOS_ItemCheck(object sender, ItemCheckEventArgs e) { if (checkearA == false) { return; } MODELO.GRUPO oGrupo = (MODELO.GRUPO)chkGRUPOS.SelectedItem; if (e.NewValue == CheckState.Checked) { oUSUARIO.GRUPO.Add(oGrupo); } else { oUSUARIO.GRUPO.Remove(oGrupo); } }
public FrmGestionarU(MODELO.USUARIO unUsuario) { InitializeComponent(); cSeguridad = CONTROLADORA.SEGURIDAD.Singleton(); btnAGREGARR.Enabled = false; btnELIMINARR.Enabled = false; btnMODIFICARR.Enabled = false; btnRESETEAR_CLAVE.Enabled = false; cmbGRUPO.DataSource = cSeguridad.GRUPOS.AGREGAR_TODOS_GRUPOS(true); cmbGRUPO.Text = "Todos"; armar_grilla_todos(); oUsuario = unUsuario; for (int i = 0; i < oUsuario.Grupos.Count(); i++) { oGrupo = oUsuario.Grupos[i]; if (oGrupo.Permisos.Count() > 0) { for (int z = 0; z < oGrupo.Permisos.Count(); z++) { if (oGrupo.Permisos[z].Descripcion == "Agregar Usuario") { btnAGREGARR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "Modificar Usuario") { btnMODIFICARR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "Eliminar Usuario") { btnELIMINARR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "ResetearClave Usuario") { btnRESETEAR_CLAVE.Enabled = true; } } } } }
public FrmGestionarS(MODELO.USUARIO unUsuario) { InitializeComponent(); cSeguridad = CONTROLADORA.SEGURIDAD.Singleton(); btnAGREGAR.Enabled = false; btnELIMINAR.Enabled = false; btnMODIFICAR.Enabled = false; btnCONSULTAR.Enabled = false; btnEXPORTAR.Enabled = false; oUsuario = unUsuario; for (int i = 0; i < oUsuario.Grupos.Count(); i++) { oGrupo = oUsuario.Grupos[i]; if (oGrupo.Permisos.Count() > 0) { for (int z = 0; z < oGrupo.Permisos.Count(); z++) { if (oGrupo.Permisos[z].Descripcion == "Agregar Stock") { btnAGREGAR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "Modificar Stock") { btnMODIFICAR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "Eliminar Stock") { btnELIMINAR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "Consultar Stock") { btnCONSULTAR.Enabled = true; } if (oGrupo.Permisos[z].Descripcion == "Exportar Stock") { btnEXPORTAR.Enabled = true; } } } } }
private void frmUSUARIO_Load(object sender, EventArgs e) { chkGRUPOS.DataSource = null; chkGRUPOS.DataSource = cUSUARIOS.OBTENER_GRUPOS(); chkGRUPOS.DisplayMember = "DESCRIPCION"; checkearA = false; for (int i = 0; i < chkGRUPOS.Items.Count; i++) { MODELO.GRUPO oGrupo = (MODELO.GRUPO)chkGRUPOS.Items[i]; foreach (MODELO.GRUPO miGrupo in oUSUARIO.GRUPO) { if (miGrupo.CODIGO == oGrupo.CODIGO) { chkGRUPOS.SetItemChecked(i, true); } } } checkearA = true; }
public frmGRUPO_USUARIO(MODELO.GRUPO miGRUPO, string miACCION) { InitializeComponent(); cGRUPOS = CONTROLADORA.cGRUPOS.obtener_instancia(); ACCION = miACCION; oGRUPO = miGRUPO; if (ACCION != "A") { txtCODIGO.Text = oGRUPO.CODIGO.ToString(); txtDESCRIPCION.Text = oGRUPO.DESCRIPCION; chkEstado.Checked = oGRUPO.ACTIVO; if (ACCION == "C") { chkUSUARIOS.Enabled = false; pDATOS.Enabled = false; btnGUARDAR.Enabled = false; btnCANCELAR.Text = "Cerrar"; } } }
public void INICIA_USUARIOS() { if (oCATALOGO.GRUPOS.Count() == 0) { MODELO.GRUPO oGRUPO = new MODELO.GRUPO(); oGRUPO.DESCRIPCION = "SUPERUSUARIOS"; oGRUPO.ACTIVO = true; oCATALOGO.GRUPOS.Add(oGRUPO); MODELO.USUARIO oUSUARIO = new MODELO.USUARIO(); oUSUARIO.NOMBRE_USUARIO = "admin"; oUSUARIO.NOMBRE = "Administrador"; oUSUARIO.GRUPO.Add(oGRUPO); oUSUARIO.CLAVE = funciones_compartidas.EncriparClave("123"); oUSUARIO.EMAIL = "definir mail"; oUSUARIO.TELEFONO = "definir telefono"; oUSUARIO.ACTIVO = true; oUSUARIO.RESETEAR_CLAVE = false; oUSUARIO.IMAGEN = "272.png"; oCATALOGO.USUARIOS.Add(oUSUARIO); oCATALOGO.SaveChanges(); } }
public void AGREGAR_GRUPO(MODELO.GRUPO oGRUPO) { oMODELO_SEGURIDAD.GRUPOS.Add(oGRUPO); oMODELO_SEGURIDAD.SaveChanges(); }
public void CANCELAR_CAMBIOS(MODELO.GRUPO oGRUPO) { oCATALOGO.Entry(oGRUPO).State = System.Data.Entity.EntityState.Detached; }
public void INICIA_USUARIOS() { if (oCATALOGO.GRUPOS.Count() == 0) { MODELO.GRUPO oGRUPO = new MODELO.GRUPO(); oGRUPO.DESCRIPCION = "SUPERUSUARIOS"; oGRUPO.ACTIVO = true; oCATALOGO.GRUPOS.Add(oGRUPO); MODELO.USUARIO oUSUARIO = new MODELO.USUARIO(); oUSUARIO.NOMBRE_USUARIO = "admin"; oUSUARIO.NOMBRE = "Administrador"; oUSUARIO.GRUPO.Add(oGRUPO); oUSUARIO.CLAVE = funciones_compartidas.EncriptarClave("123123"); oUSUARIO.EMAIL = "definir mail"; oUSUARIO.TELEFONO = "definir telefono"; oUSUARIO.ACTIVO = true; oUSUARIO.RESETEAR_CLAVE = false; oUSUARIO.IMAGEN = "272.png"; oCATALOGO.USUARIOS.Add(oUSUARIO); oCATALOGO.SaveChanges(); } }
public void MODIFICAR_GRUPO(MODELO.GRUPO oGRUPO) { oMODELO_SEGURIDAD.Entry(oGRUPO).State = System.Data.Entity.EntityState.Modified; oMODELO_SEGURIDAD.SaveChanges(); }
public void MODIFICAR_GRUPO(MODELO.GRUPO oGRUPO) { oCATALOGO.Entry(oGRUPO).State = System.Data.Entity.EntityState.Modified; oCATALOGO.SaveChanges(); }
public void ELIMINAR_GRUPO(MODELO.GRUPO oGRUPO) { oMODELO_SEGURIDAD.GRUPOS.Remove(oGRUPO); oMODELO_SEGURIDAD.SaveChanges(); }
public void AGREGAR_GRUPO(MODELO.GRUPO oGRUPO) { oCATALOGO.GRUPOS.Add(oGRUPO); oCATALOGO.SaveChanges(); }