private bool GuardarDatos() { bool bResult = false; try { if (string.IsNullOrEmpty(txtvcGrupo.Text)) { MessageBox.Show("Ingresar el nombre del riesgo", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtvcGrupo.Focus(); return(false); } SocioGrupoBE oEntity = new SocioGrupoBE(); oEntity.OPCION = 2; oEntity.USUARIO = General.General.GetCodigoUsuario; oEntity.IdGrupo = Codigo; oEntity.vcGrupo = txtvcGrupo.Text; DataSet ds = new DataSet(); ds = new SocioGrupoBL().ProcesarSocioGrupo(oEntity); if (ds.Tables[0].Rows.Count > 0) { Codigo = ds.Tables[0].Rows[0]["IdGrupo"].ToString(); bResult = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(bResult); }
private void LlenarCombo() { try { DataGridViewComboBoxColumn cboColumn = dgvDatos.Columns["IdGrupo"] as DataGridViewComboBoxColumn; DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(_IdGrupo)) { dt.Columns.Add("IdGrupo"); dt.Columns.Add("vcGrupo"); DataRow dr; dr = dt.NewRow(); dr["IdGrupo"] = ""; dr["vcGrupo"] = "--Sin Asignar--"; dt.Rows.InsertAt(dr, 0); DataRow dr1; dr1 = dt.NewRow(); dr1["IdGrupo"] = _IdGrupo; dr1["vcGrupo"] = _vcGrupo; dt.Rows.InsertAt(dr1, 1); } else { SocioGrupoBE oEntity = new SocioGrupoBE(); oEntity.OPCION = 1; oEntity.USUARIO = General.General.GetCodigoUsuario; dt = new SocioGrupoBL().ProcesarSocioGrupo(oEntity).Tables[0]; DataRow dr; dr = dt.NewRow(); dr["IdGrupo"] = ""; dr["vcGrupo"] = "--Sin Asignar--"; dt.Rows.InsertAt(dr, 0); //dgvDatos.Columns["IdGrupo"].Visible = false; //dgvDatos.Columns["btnActualizar"].Visible = false; } cboColumn.DataSource = dt; cboColumn.DisplayMember = "vcGrupo"; cboColumn.ValueMember = "IdGrupo"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnBuscar_Click(object sender, EventArgs e) { try { SocioGrupoBE oEntity = new SocioGrupoBE() { OPCION = 1, USUARIO = General.General.GetCodigoUsuario, vcGrupo = TextBoxX1.Text.Trim() }; DataSet ds = new SocioGrupoBL().ProcesarSocioGrupo(oEntity); dgvGrupo.DataSource = ds.Tables[0]; lblRegistros.Text = ds.Tables[0].Rows.Count + " registro(s)"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarDatos() { try { SocioGrupoBE oEntity = new SocioGrupoBE(); oEntity.OPCION = 1; oEntity.USUARIO = General.General.GetCodigoUsuario; oEntity.IdGrupo = Codigo; DataSet ds = new DataSet(); ds = new SocioGrupoBL().ProcesarSocioGrupo(oEntity); if (ds.Tables[0].Rows.Count > 0) { txtIdGrupo.Text = ds.Tables[0].Rows[0]["IdGrupo"].ToString(); txtvcGrupo.Text = ds.Tables[0].Rows[0]["vcGrupo"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }