private void btnSave_Click(object sender, EventArgs e) { try { ValidateForm(); var baja = rdNo.Checked ? false : true; var funciones = lbFunciones.Items.Cast <Model.Funcion>().ToList(); if (_editObject == null) { _editObject = new Model.Rol(txtDescripcion.Text, baja, funciones); } else { _editObject.Descripcion = txtDescripcion.Text; _editObject.Baja = baja; _editObject.Funciones = funciones; } DAO.DAOFactory.RolDAO.CreateOrUpdate(_editObject); CerrarAbm(); } catch (Exception ex) { string message = ex.Message; string caption = "Error de Validación"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } }
public List <Model.Rol> getRoles() { DataTable tablaRoles; List <Model.Rol> listaDeRoles = new List <Model.Rol>(); DBhelper.crearConexion(); SqlCommand cmd = DBhelper.crearCommand("QEPD.getRoles"); DBhelper.abrirConexion(); tablaRoles = DBhelper.obtenerTabla(cmd); foreach (DataRow row in tablaRoles.Rows) { Model.Rol rol = new Model.Rol(); rol.setNombre((String)row["Nombre_Rol"]); rol.setId((Int32)row["IdRol"]); rol.setEstado(Convert.ToInt16(row["Estado_Rol"])); listaDeRoles.Add(rol); } return(listaDeRoles); }
public Rol(Session session, Model.Rol editRol, ListadoRol listado) { InitializeComponent(); _session = session; _editObject = editRol; _listado = listado; InitValues(); BindRol(); }
private bool NoExisteRolEnUsuario(Model.Rol rol) { return(_editObject == null || !_editObject.Roles.Exists(r => r.Id == rol.Id)); }
private void comboBox_roles_SelectedIndexChanged(object sender, EventArgs e) { ComboBox selectorDeRol = (ComboBox)sender; rolSeleccionado = (Model.Rol)selectorDeRol.SelectedValue; }
public void setRolSeleccionado(Model.Rol rol) { this.rolSeleccionado = rol; }