private void btn_Guardar_Click(object sender, EventArgs e) { try { if (txt_nombres.Text == string.Empty || txt_ap_paterno.Text == string.Empty || txt_ap_materno.Text == string.Empty || txt_nro_documento.Text == string.Empty || txt_telefono.Text == string.Empty || txt_rubro.Text == string.Empty) { MessageBox.Show("Porfavor llene los campos obligatorios"); } else { if (Program.isnuevo == true) { string estado = ""; if (cb_Estado.Text == "Valido") { estado = "V"; } else { estado = "A"; } rep = N_Clientes.Registrar(estado, dateTime_F_Registro.Value, txt_nombres.Text, txt_ap_paterno.Text, txt_ap_materno.Text, Convert.ToInt32(txt_nro_documento.Text), cb_tipo_documento.Text, txt_correo.Text, Convert.ToInt32(txt_telefono.Text), txt_Descripcion.Text, Convert.ToInt32(txt_cod_rubro.Text)); } if (Program.ismodificar == true) { rep = N_Clientes.Editar(Convert.ToInt32(txt_Codigo.Text), txt_nombres.Text, txt_ap_paterno.Text, txt_ap_materno.Text, Convert.ToInt32(txt_nro_documento.Text), cb_tipo_documento.Text, txt_correo.Text, Convert.ToInt32(txt_telefono.Text), txt_Descripcion.Text, Convert.ToInt32(txt_cod_rubro.Text)); } if (rep.Equals("ok")) { rep = Capa_Negocio.N_Usuarios.EditaR_Audi(Convert.ToString(Program.ID_USUARIO_GLOBAL), Program.IP(), Program.NOMBRECOMPLETO_USUARIO_GLOBAL); if (Program.ismodificar == true) { MessageBox.Show("Editado correctamente"); } if (Program.isnuevo == true) { MessageBox.Show("Registrado correctamente"); } } else { MessageBox.Show(rep); } Program.isnuevo = false; Program.ismodificar = false; Instancias = null; this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void txt_Busqueda_TextChanged(object sender, EventArgs e) { dgv_Clientes.DataSource = N_Clientes.Buscar(txt_Busqueda.Text, _estado_, _tipo_); if (txt_Busqueda.Text == string.Empty) { Mostrar_Clientes(); } }
private void Clientes_Load(object sender, EventArgs e) { dgv_Clientes.DataSource = N_Clientes.Buscar(txt_Busqueda.Text, _estado_, _tipo_); Mostrar_Clientes(); Program.isnuevo = false; Program.ismodificar = false; Program.Cambio_Estado = false; TamañoDGV(); }
private void Buscar() { try { dataGridView1.DataSource = N_Clientes.Buscar(txtBuscar.Text); this.formato(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
public void Datos() { DataTable Datos = N_Clientes.Consulta_Id(Convert.ToInt32(this.dgv_Clientes.CurrentRow.Cells["CODIGO"].Value.ToString())); if (Datos.Rows.Count < 1) { MessageBox.Show("ERROR", "SISTEMA MERCENARIOS", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Clientes_Datos frm = Clientes_Datos.Get_instancia(); frm.txt_Codigo.Text = Datos.Rows[0][0].ToString(); if (Datos.Rows[0][1].ToString() == "V") { frm.cb_Estado.Text = "Valido"; } else { frm.cb_Estado.Text = "Anulado"; } frm.dateTime_F_Registro.Value = Convert.ToDateTime(Datos.Rows[0][2].ToString()); frm.txt_nombres.Text = Datos.Rows[0][3].ToString(); frm.txt_ap_paterno.Text = Datos.Rows[0][4].ToString(); frm.txt_ap_materno.Text = Datos.Rows[0][5].ToString(); frm.txt_nro_documento.Text = Datos.Rows[0][6].ToString(); frm.cb_tipo_documento.Text = Datos.Rows[0][7].ToString(); frm.txt_correo.Text = Datos.Rows[0][8].ToString(); frm.txt_telefono.Text = Datos.Rows[0][9].ToString(); frm.txt_Descripcion.Text = Datos.Rows[0][10].ToString().Trim(); frm.txt_cod_rubro.Text = Datos.Rows[0][11].ToString(); frm.txt_rubro.Text = Datos.Rows[0][12].ToString(); if (Program.isnuevo == true || Program.ismodificar == true) { frm.btn_Guardar.Enabled = true; frm.btn_Cancelar.Enabled = true; } else { frm.btn_Guardar.Enabled = false; frm.btn_Cancelar.Enabled = false; } frm.ShowDialog(); } }
private void ms_CambiarEstado_Click(object sender, EventArgs e) { try { if (dgv_Clientes.Rows.Count > 0) { string _estado = ""; DialogResult Opcion; if (this.dgv_Clientes.CurrentRow.Cells["ESTADO"].Value.ToString() == "V") { Opcion = MessageBox.Show("¿Desea cambiar el estado a <Anulado>?", "Sistema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); _estado = "A"; } else { Opcion = MessageBox.Show("¿Desea cambiar el estado a <Valido>?", "Sistema", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); _estado = "V"; } if (Opcion == DialogResult.OK) { string Rpta = ""; Rpta = N_Clientes.CambiarEstado(Convert.ToInt32(dgv_Clientes.CurrentRow.Cells["CODIGO"].Value.ToString()), _estado); if (Rpta.Equals("ok")) { // MessageBox.Show("Se eliminó de forma correcta el Registro"); } else { MessageBox.Show(Rpta); } Mostrar_Clientes(); } } else { MessageBox.Show("Seleccione un registro"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void ms_Eliminar_Click(object sender, EventArgs e) { try { if (dgv_Clientes.Rows.Count > 0) { DialogResult Opcion; Opcion = MessageBox.Show("¿Desea eliminar el registro?", "Sistema_Mercenarios", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string Codigo; string Rpta = ""; foreach (DataGridViewRow row in dgv_Clientes.Rows) { if (row.Selected) { Codigo = Convert.ToString(row.Cells["CODIGO"].Value); Rpta = N_Clientes.Eliminar(Convert.ToInt32(Codigo)); } } if (Rpta.Equals("ok")) { // MessageBox.Show("Se eliminó de forma correcta el Registro"); } else { MessageBox.Show(Rpta); } Mostrar_Clientes(); } } else { MessageBox.Show("Seleccione un registro"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
public void BuscarRegistros() { dgvClient.DataSource = N_Clientes.BuscarRegistrosC(txtBuscarCliente.Text); }
public void MostrarRegistro() { dgvClient.DataSource = N_Clientes.MostrarRegistrosC(); AccionesTabla(); }
public void Mostrar_Clientes() { dgv_Clientes.DataSource = N_Clientes.Consultar_Todo(); lbl_NroRegistros.Text = Convert.ToString(dgv_Clientes.Rows.Count) + " registros encontrados"; }