private void dgvDatosUsuario_CellClick(object sender, DataGridViewCellEventArgs e) { Usuario ObjUsuario = new Usuario(); if (rbtActivos.Checked) { if (this.dgvDatosUsuario.Columns[e.ColumnIndex].Name == "Deshabilitar") { ObjUsuario.EstadoUsuario(dgvDatosUsuario.CurrentRow.Cells[2].Value.ToString(), 2); cargarDatos("1"); } } else if (rbtInactivos.Checked) { if (this.dgvDatosUsuario.Columns[e.ColumnIndex].Name == "Deshabilitar") { ObjUsuario.EstadoUsuario(dgvDatosUsuario.CurrentRow.Cells[2].Value.ToString(), 1); cargarDatos("0"); } } if (this.dgvDatosUsuario.Columns[e.ColumnIndex].Name == "Modificar") { GlovalIDUsuario = dgvDatosUsuario.CurrentRow.Cells[2].Value.ToString(); tcUsuario.SelectedIndex = 0; bandera_Estado = true; //Llenar el DataTable DataTable dt = objConsul.BoolDataTable("Select * from TbUsuario where IDUSUARIO = " + GlovalIDUsuario + ""); //Verificar si tiene Datos if (dt.Rows.Count > 0) { DataRow myRow = dt.Rows[0]; cbPersonaUsuario.SelectedValue = Convert.ToInt32(myRow["IDEMPLEADO"]); int indexUSUARIO = cbPersonaUsuario.SelectedIndex; cbPersonaUsuario.SelectedIndex = indexUSUARIO; cbTipoUsuario.SelectedValue = Convert.ToInt32(myRow["IDTIPOUSUARIO"]); int indexTIPOUSUARIO = cbTipoUsuario.SelectedIndex; cbTipoUsuario.SelectedIndex = indexTIPOUSUARIO; CheckListBEmpresas.SelectedValue = Convert.ToInt32(myRow["IDEMPRESA"]); int indexIDEMPRESA = CheckListBEmpresas.SelectedIndex; CheckListBEmpresas.SetItemChecked(indexIDEMPRESA, true); txtUsuario.Text = myRow["USUARIO"].ToString(); txtContraseñaUsuario.Text = myRow["CONTRASEÑA"].ToString(); ckbFacturaUsuario.Checked = Convert.ToBoolean(myRow["FACTURA"]); } btnLimpiarProveedor.Text = "&Cancelar"; btnGuardarUsuario.Text = "&Modificar"; } }
public void inicializarDatos() { for (int i = 0; i < CheckListBEmpresas.Items.Count; i++) { CheckListBEmpresas.SetItemChecked(i, false); } txtConsultarUsuario.Text = ""; TxtConfirmarContraUsuario.Text = ""; txtContraseñaUsuario.Text = ""; txtUsuario.Text = ""; if (cbPersonaUsuario.Items.Count > 0) { cbPersonaUsuario.SelectedIndex = 0; } objConsul.BoolLlenarCheckListBox(CheckListBEmpresas, "Select IDEMPRESA as ID, NOMBRE as 'Texto' from TbEmpresa;"); objConsul.BoolLlenarComboBox(cbPersonaUsuario, "Select IDEMPLEADO as ID,(E.APELLIDOS +' '+ E.NOMBRES) as Texto from TbEmpleado E WHERE (E.NOMBRES != 'ADMINISTRADOR');"); objConsul.BoolLlenarComboBox(cbTipoUsuario, "Select IDTIPOUSUARIO as ID,TIPO as Texto from TbTipousuario;"); ckbFacturaUsuario.Checked = false; ckMostrarContra.Checked = false; cbPersonaUsuario.DropDownHeight = cbPersonaUsuario.ItemHeight = 150; cbTipoUsuario.DropDownHeight = cbTipoUsuario.ItemHeight = 150; cargarDatos("1"); }