public Agregar_Modificar_Rol(ABMRol abm) //constructor alta rol { bd = new BaseDeDatos(); conexion = bd.getCon(); InitializeComponent(); cargarFuncionalidades(); comboBox1.Visible = false; //combobox estado button1.Visible = false; //boton modificar label2.Visible = false; this.abm = abm; }
public Agregar_Modificar_Rol(DataGridViewRow row, ABMRol abm) //constructor modificacion rol { this.abm = abm; idAnterior = Decimal.Parse(row.Cells[0].Value.ToString()); bd = new BaseDeDatos(); conexion = bd.getCon(); InitializeComponent(); cargarFuncionalidades(); button2.Visible = false; //boton alta textBox1.Text = row.Cells[1].Value.ToString(); // nombre if (row.Cells[2].Value.ToString().Equals("I")) { comboBox1.Text = "Inhabilitado"; } else { comboBox1.Text = "Habilitado"; } conexion.Open(); string query = "SELECT Funcionalidad_Descripcion FROM OVERFANTASY.Funcionalidad_Por_rol WHERE ROL_Id = '" + row.Cells[0].Value.ToString() + "'"; using (SqlCommand cmd = new SqlCommand(query, conexion)) { using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { switch (reader.GetString(0)) //tildes en las checkbox para los roles predefinidos { case "ABM Automovil": checkedListBox1.SetItemCheckState(0, CheckState.Checked); indicesAnteriores.Add(0); break; case "ABM Chofer": checkedListBox1.SetItemCheckState(1, CheckState.Checked); indicesAnteriores.Add(1); break; case "ABM Clientes": checkedListBox1.SetItemCheckState(2, CheckState.Checked); indicesAnteriores.Add(2); break; case "ABM Rol": checkedListBox1.SetItemCheckState(3, CheckState.Checked); indicesAnteriores.Add(3); break; case "ABM Turno": checkedListBox1.SetItemCheckState(4, CheckState.Checked); indicesAnteriores.Add(4); break; case "Facturacion a Cliente": checkedListBox1.SetItemCheckState(5, CheckState.Checked); indicesAnteriores.Add(5); break; case "Listado Estadistico": checkedListBox1.SetItemCheckState(6, CheckState.Checked); indicesAnteriores.Add(6); break; case "Registro de Viaje": checkedListBox1.SetItemCheckState(7, CheckState.Checked); indicesAnteriores.Add(7); break; case "Rendicion de Cuentas": checkedListBox1.SetItemCheckState(8, CheckState.Checked); indicesAnteriores.Add(8); break; } } } } }
private void button2_Click(object sender, EventArgs e) { Abm_Rol.ABMRol abmRol = new Abm_Rol.ABMRol(); abmRol.Show(); }