private void EditarCliente() { try { string rpta = ""; if (this.txtNombres.Text == string.Empty || this.txtApellidos.Text == string.Empty) { MensajeError("Nombre y Apellido son campos obligatoros"); errorIcono.SetError(txtNombres, "Ingrese el al menos un Nombre"); errorIcono.SetError(txtApellidos, "Ingrese el al menos un Apellido"); } else { rpta = NCliente.Editar(Convert.ToInt32(txtIdCliente.Text), txtNombres.Text, txtApellidos.Text, txtTDocumento.Text, txtNDocumento.Text, dtpFechaNacimiento.Value, Convert.ToString(comboxGenero.SelectedItem), txtTelefono.Text, txtPais.Text, txtEmail.Text); enviardatos(); } if (rpta.Equals("OK")) { this.MensajeOk("Se Editaron los datos del Cliente correctamente"); } else { this.MensajeError("Vuelva a intentarlo"); } Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//Buscar pelo Num Doc private void BuscarDocumento() { this.dataLista.DataSource = NCliente.BuscarDocumento(this.txtBuscar.Text); this.ocultarColunas(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataLista.Rows.Count); }
private void txtDni_KeyPress(object sender, KeyPressEventArgs e) { if (Char.IsLetter(e.KeyChar) || char.IsSymbol(e.KeyChar) || char.IsSeparator(e.KeyChar) || char.IsPunctuation(e.KeyChar)) { e.Handled = true; } if (Char.IsNumber(e.KeyChar)) { e.Handled = false; var tabla = NCliente.BuscarCliente(txtDni.Text); if (tabla.Rows.Count > 0) { if (txtDni.Text == tabla.Rows[0]["dni"].ToString()) { txtDni.Focus(); epCliente.Clear(); epCliente.SetError(txtDni, "ya cuenta con un registro "); } else { epCliente.Clear(); } } } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult opcion; opcion = MessageBox.Show("Desea eliminar el registro", "Sistema de Reserva", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { string codigo; string rpta = ""; foreach (DataGridViewRow row in dataListado.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { codigo = Convert.ToString(row.Cells[1].Value); rpta = NCliente.Eliminar(Convert.ToInt32(codigo)); if (rpta.Equals("OK")) { this.MensajeOK("Se Elimino Correctamente"); } else { this.MensajeError(rpta); } } } this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtApellidos.Text == string.Empty || this.txtNum_Documento.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Falta ingresar algunos datos, serán remarcados"); errorIcono.SetError(txtNombre, "Ingrese un Valor"); errorIcono.SetError(txtApellidos, "Ingrese un Valor"); errorIcono.SetError(txtNum_Documento, "Ingrese un Valor"); errorIcono.SetError(txtDireccion, "Ingrese un Valor"); } else { if (this.IsNuevo) { rpta = NCliente.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtApellidos.Text.Trim().ToUpper(), this.cbSexo.Text, dtFechaNac.Value, cbTipo_Documento.Text, txtNum_Documento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } else { rpta = NCliente.Editar(Convert.ToInt32(this.txtIdcliente.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtApellidos.Text.Trim().ToUpper(), this.cbSexo.Text, dtFechaNac.Value, cbTipo_Documento.Text, txtNum_Documento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se Insertó de forma correcta el registro"); } else { this.MensajeOk("Se Actualizó de forma correcta el registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
public void cargarCliente() { DataTable dtCliente = NCliente.consultaClienteCredito(lblClase.Text, Convert.ToInt32(lblIdVenta.Text)); if (dtCliente.Rows.Count > 0) { txtIdCliente.Text = dtCliente.Rows[0][0].ToString(); txtNombre.Text = dtCliente.Rows[0][1].ToString(); txtDocumento.Text = dtCliente.Rows[0][3].ToString(); txtDireccion.Text = dtCliente.Rows[0][2].ToString(); if (lblClase.Text == "C") { string idTipoCliente; idTipoCliente = dtCliente.Rows[0][4].ToString(); if (idTipoCliente == null || idTipoCliente == "") { cbTipoCliente.SelectedIndex = -1; } else { cbTipoCliente.SelectedValue = idTipoCliente; } } btnEditar.Enabled = true; cbTipoCliente.Enabled = false; } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtApellidos.Text == string.Empty || this.txtNDoc.Text == string.Empty || this.txtDireccion.Text == string.Empty ) { MensajeError("Falta ingresar datos, seran remarcados"); errorProviderIcono.SetError(txtNombre, "Ingrese un valor"); errorProviderIcono.SetError(txtNDoc, "Ingrese un valor"); errorProviderIcono.SetError(txtApellidos, "Ingrese un valor"); errorProviderIcono.SetError(txtDireccion, "Ingrese un valor"); } else { if (this.IsNuevo) { rpta = NCliente.Insertar(this.txtNombre.Text.Trim().ToUpper(), txtApellidos.Text, this.cbnSexo.Text, dateTimePickerFN.Value, cbnTDoc.Text, txtNDoc.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } else { rpta = NCliente.Editar(Convert.ToInt32(this.txtIdcliente.Text), this.txtNombre.Text.Trim().ToUpper(), txtApellidos.Text, this.cbnSexo.Text, dateTimePickerFN.Value, cbnTDoc.Text, txtNDoc.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se inserto correctamente"); } else { this.MensajeOk("se actualizo correctamente"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtnombre.Text == string.Empty || this.txtNumDocument.Text == string.Empty || this.txtApellido.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Incorrectos datos, ingresar bien"); errorIcono.SetError(txtnombre, "Ingrese un Valor"); errorIcono.SetError(txtApellido, "Ingrese un Valor"); errorIcono.SetError(txtNumDocument, "Ingrese un Valor"); errorIcono.SetError(txtDireccion, "Ingrese un Valor"); } else { if (this.IsNuevo) { rpta = NCliente.Insertar(this.txtnombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), this.cbsexo.Text, dtFechaNac.Value, cbTipo_Documento.Text, txtNumDocument.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text) ; } else { rpta = NCliente.Editar(Convert.ToInt32(this.txtidclient.Text), this.txtnombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), this.cbsexo.Text, dtFechaNac.Value, cbTipo_Documento.Text, txtNumDocument.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se ingreso correctamente."); } else { this.MensajeOk("Se actualizo."); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void cargarCliente() { cbProducto.DataSource = NCliente.Mostrar(); cbProducto.ValueMember = "Codigo"; cbProducto.DisplayMember = "Cliente"; cbProducto.SelectedIndex = -1; //lblPrueba.Text = cbCategoria.SelectedValue.ToString(); }
private void Mostrar() { this.DataListado.DataSource = NCliente.Mostrar(); this.OcultarColumnas(); this.DiseñoColumnas(); this.Eliminar(); lblRegistros.Text = "Total de Registros : " + Convert.ToString(DataListado.Rows.Count); }
private void ListarRazon() { NCliente obj = new NCliente(); cbRazonSocial.DataSource = obj.Mostrar(); cbRazonSocial.DisplayMember = "NRAZON"; cbRazonSocial.ValueMember = "RUT"; }
private void btnEliminar_Click(object sender, EventArgs e) { if (existeC) { if (act == true) { NCliente oCneg = new NCliente(); int numero = Convert.ToInt32(this.txtCodigo.Text); string nombre = this.txtNombres.Text; string apellido = this.txtApellidos.Text; string direccion = this.txtDireccion.Text; string dni = this.txtDNI.Text; string ruc = this.txtRUC.Text; DateTime ingreso = this.dtpFechaIngreso.Value; double saldo = Convert.ToDouble(this.txtSaldoCuenta.Text); bool activo = false; string rpta = oCneg.actualizarCliente(numero, nombre, apellido, direccion, dni, ruc, ingreso, saldo, activo); if (rpta.Equals("OK")) { MessageBox.Show("Baja Cliente", "Baja/Alta Cliente", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(rpta, "ERROR al dar de Baja al Cliente", MessageBoxButtons.OK, MessageBoxIcon.Error); } limpiar(); inicial(); } else { NCliente oCneg = new NCliente(); int numero = Convert.ToInt32(this.txtCodigo.Text); string nombre = this.txtNombres.Text; string apellido = this.txtApellidos.Text; string direccion = this.txtDireccion.Text; string dni = this.txtDNI.Text; string ruc = this.txtRUC.Text; DateTime ingreso = this.dtpFechaIngreso.Value; double saldo = Convert.ToDouble(this.txtSaldoCuenta.Text); bool activo = true; string rpta = oCneg.actualizarCliente(numero, nombre, apellido, direccion, dni, ruc, ingreso, saldo, activo); if (rpta.Equals("OK")) { MessageBox.Show("Alta Cliente", "Baja/Alta Cliente", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(rpta, "ERROR al dar de Alta al Cliente", MessageBoxButtons.OK, MessageBoxIcon.Error); } limpiar(); inicial(); } } }
private void btnSalvar_Click(object sender, EventArgs e) { try { string resp = ""; if (this.txtNome.Text == string.Empty) { MensagemErro("Preencha todos os campos"); errorIcone.SetError(txtNome, "Insira o nome da Empresa"); } else { if (this.eNovo) { resp = NCliente.Inserir(this.txtNome.Text.Trim(), this.txtSobrenome.Text, this.cbSexo.Text, this.dtData.Value, this.cbTipoDoc.Text, this.txtNumeroDoc.Text, this.txtEndereco.Text, this.txtTelefone.Text, this.txtEmail.Text); } else { resp = NCliente.Editar(Convert.ToInt32(this.txtId.Text), this.txtNome.Text.Trim().ToUpper(), this.txtSobrenome.Text, this.cbSexo.Text, this.dtData.Value, this.cbTipoDoc.Text, this.txtNumeroDoc.Text, this.txtEndereco.Text, this.txtTelefone.Text, this.txtEmail.Text); } if (resp.Equals("OK")) { if (this.eNovo) { this.MensagemOk("Registro salvo com sucesso"); } else { this.MensagemOk("Registro editado com sucesso"); } } else { this.MensagemErro(resp); } this.eNovo = false; this.eEditar = false; this.botoes(); this.Limpar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtNum_Documento.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Faltan ingresar datos"); errorIcono.SetError(txtNombre, "Ingrese la Razon Social"); errorIcono.SetError(txtNum_Documento, "Ingrese un Numero de Documento"); errorIcono.SetError(txtDireccion, "Ingrese la Direccion"); } else { if (this.IsNuevo) { rpta = NCliente.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtApellidos.Text, this.cmbSexo.Text, this.dtpFechaNacimiento.Value, cmbTipo_Documento.Text, txtNum_Documento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } else { rpta = NCliente.Editar(Convert.ToInt32(this.txtIdCliente.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtApellidos.Text, this.cmbSexo.Text, this.dtpFechaNacimiento.Value, cmbTipo_Documento.Text, txtNum_Documento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text); } } if (rpta.Equals("ok")) { if (this.IsNuevo) { this.MensajeOk("Se inserto correctamente el registro"); } else { this.MensajeOk("Se actualizo correctamente el registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtApellido.Text == string.Empty || txtDocumento.Text == string.Empty || txtDireccion.Text == string.Empty || txtDocumento.Text == string.Empty) { MensajeError("Falta ingresar algunos datos, serán remarcados"); errorIcono.SetError(txtNombre, "Ingrese el nombe"); errorIcono.SetError(txtApellido, "Ingrese el apellido"); errorIcono.SetError(txtDocumento, "Ingrese el documento"); errorIcono.SetError(txtDireccion, "Ingrese el usuario"); errorIcono.SetError(txtDocumento, "Ingrese la contraseña"); } else { if (this.IsNuevo) { Rpta = NCliente.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), cboSexo.Text, dtpFechaNacimiento.Value, cboTipoDocumento.Text, txtDocumento.Text, txtDireccion.Text, Convert.ToInt32(txtIdBarrio.Text), txtCodigoPostal.Text, txtTelefono.Text, txtCelular.Text, txtCorreo.Text); } else { Rpta = NCliente.Editar(Convert.ToInt32(this.txtIdCliente.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), cboSexo.Text, dtpFechaNacimiento.Value, cboTipoDocumento.Text, txtDocumento.Text, txtDireccion.Text, Convert.ToInt32(txtIdBarrio.Text), txtCodigoPostal.Text, txtTelefono.Text, txtCelular.Text, txtCorreo.Text); } if (Rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOK("Se insertó de forma correcta el registro"); } else { this.MensajeOK("Se actualizó de forma correcta el registro"); } } else { this.MensajeError(Rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); this.txtIdCliente.Text = ""; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//boton guardar private void btnGuardar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (this.txtnombre.Text == string.Empty || this.txtapellidos.Text == string.Empty || cbsexo.Text == string.Empty) { MensajeError("Falta ingresar algunos datos"); errorIcono.SetError(txtnombre, "Ingrese un Valor"); errorIcono.SetError(txtapellidos, "Ingrese un Valor"); errorIcono.SetError(cbsexo, "Ingrese un Valor"); } else { if (this.IsNuevo) { Rpta = NCliente.Insertar(this.txtnombre.Text.Trim().ToUpper(), this.txtapellidos.Text.Trim().ToUpper(), cbsexo.Text, dtFechaNacimiento.Value, txtDireccion.Text, txtnumeroTelefono.Text, txtEmail.Text); } else { Rpta = NCliente.Editar(Convert.ToInt32(this.txtIdcliente.Text), this.txtnombre.Text.Trim().ToUpper(), this.txtapellidos.Text.Trim().ToUpper(), cbsexo.Text, dtFechaNacimiento.Value, txtDireccion.Text, txtnumeroTelefono.Text, txtEmail.Text); } if (Rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOK("Insercion Correcta"); } else { this.MensajeOK("Actualizacion correcta"); } } else { //Mostramos el mensaje de error this.MensajeError(Rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); this.txtIdcliente.Text = ""; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BuscarDocumento() { //Hace lo mismo que el procedimiento Mostrar pero la diferencia es que aquí si le estamos enviado //un valor : BuscarNombre(this.txtBuscar.Text) obviamente el nombre que queremos buscar. this.dataListado.DataSource = NCliente.BuscarNum_Documento(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }
//Ocultar as Colunas do Grid //private void ocultarColunas() //{ // this.dataLista.Columns[0].Visible = false; // this.dataLista.Columns[1].Visible = false; //} //Mostrar no Data Grid private void Mostrar() { this.dataLista.DataSource = NCliente.Mostrar(); //this.ocultarColunas(); lbTotal.Text = "Total de Registros: " + Convert.ToString(dataLista.Rows.Count); dataLista.Columns[0].HeaderText = "Codigo"; dataLista.Columns[1].HeaderText = "Nome"; dataLista.Columns[2].HeaderText = "Nascimento"; }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtApellido.Text == string.Empty || this.txtNumDocumento.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Falta Ingresar Ingresar"); errorIcono.SetError(txtNombre, "Ingrese un Valor"); errorIcono.SetError(txtApellido, "Ingrese un Valor"); errorIcono.SetError(txtDireccion, "Ingrese un Valor"); errorIcono.SetError(txtNumDocumento, "Ingrese un Valor"); } else { if (this.isNuevo) { rpta = NCliente.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), this.cbSexo.Text, this.dtFechaNac.Value, this.cbTipoDocumento.Text, txtNumDocumento.Text.Trim().ToUpper(), txtDireccion.Text.Trim().ToUpper(), txtTelefono.Text.Trim().ToUpper(), txtEmail.Text.Trim().ToUpper()); } else { rpta = NCliente.Editar(Convert.ToInt32(this.txtIdCliente.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), this.cbSexo.Text, this.dtFechaNac.Value, this.cbTipoDocumento.Text, txtNumDocumento.Text.Trim().ToUpper(), txtDireccion.Text.Trim().ToUpper(), txtTelefono.Text.Trim().ToUpper(), txtEmail.Text.Trim().ToUpper()); } if (rpta.Equals("OK")) { if (this.isNuevo) { this.MensajeOk("Se Inserto el Registro"); } else { this.MensajeOk("Se Actualizo el Registro"); } } else { this.MensajeError(rpta); } this.isNuevo = false; this.isEditar = false; this.HabilitarBotones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void cliente() { DataTable datos = new DataTable(); datos = NCliente.ListaDatosCliente(); comboBox3.DataSource = datos; comboBox3.DisplayMember = "Cliente"; comboBox3.ValueMember = "Id_Cliente"; }
private void listar() { DataTable datos = new DataTable(); datos = NCliente.ListaDatosCliente(); dataGridView1.DataSource = datos; dataGridView1.Refresh(); dataGridView1.Columns["Id_Categoria"].Visible = false; }
protected void Page_Load(object sender, EventArgs e) { NCliente negocioCliente = new NCliente(); // cliente = new Cliente() cliente = negocioCliente.buscarCliente((int)Session["DNI_Ingresado" + Session.SessionID]); if (!IsPostBack) { try { if (cliente.id != 0) { isClient = true; TxtNombreCl.Text = (String)cliente.nombre; TxtApellidoCl.Text = (String)cliente.apellido; TxtDniCl.Text = (String)cliente.dni.ToString(); TxtDirCl.Text = (String)cliente.direccion; TxtCiudadCl.Text = (String)cliente.ciudad; TxtMailCl.Text = (String)cliente.email; TxtCPCl.Text = (String)cliente.cp; TxtDniCl.Enabled = false; //DESHABILITO LA EDICION DEL COMBOTEXT DNI } else { cliente.dni = (int)Session["DNI_Ingresado" + Session.SessionID]; TxtDniCl.Text = cliente.dni.ToString(); TxtDniCl.Enabled = false; } } catch (Exception ex) { Session["Error" + Session.SessionID] = ex; // Response.Redirect("Error.aspx"); } } if (cliente.id != 0) { isClient = true; cliente.apellido = TxtApellidoCl.Text; cliente.nombre = TxtNombreCl.Text; cliente.direccion = TxtDirCl.Text; cliente.ciudad = TxtCiudadCl.Text; cliente.cp = TxtCPCl.Text; cliente.email = TxtMailCl.Text; cliente.fechaRegistro = DateTime.Now; TxtDniCl.Enabled = false; //DESHABILITO LA EDICION DEL COMBOTEXT DNI } else { cliente.dni = (int)Session["DNI_Ingresado" + Session.SessionID]; TxtDniCl.Text = cliente.dni.ToString(); TxtDniCl.Enabled = false; } }
private void textBox2_KeyUp(object sender, KeyEventArgs e) { var bus = new DCliente(); bus.nombre = Convert.ToString(textBox2.Text); dataGridView1.DataSource = NCliente.BuscarCliente(bus); dataGridView1.Refresh(); }
private void btnGuardar_Click(object sender, EventArgs e) { if (Editar == true) { if (Comprobar_Campos() == string.Empty) { if (Obtener_Id(AuxiliarDni) == 0) { MessageBox.Show("Error: id no encontrado!"); } else { if (AuxiliarDni == tbDni.Text) { MessageBox.Show(NCliente.Editar(Obtener_Id(tbDni.Text), tbDni.Text, tbNombre.Text, tbDireccion.Text, tbTelefono.Text)); Limpiar_Campos(); Editar = false; } else if (DniExistente(tbDni.Text)) { MessageBox.Show(string.Format("Error: el nombre '{0}' ya se encuentra en uso!", tbNombre.Text)); } else { MessageBox.Show(NCliente.Editar(Obtener_Id(tbDni.Text), tbDni.Text, tbNombre.Text, tbDireccion.Text, tbTelefono.Text)); Limpiar_Campos(); Editar = false; } } } else { MessageBox.Show(Comprobar_Campos()); } } else { if (Comprobar_Campos() == string.Empty) { if (DniExistente(tbDni.Text)) { MessageBox.Show(string.Format("Error: el dni '{0}' ya se encuentra en uso!", tbDni.Text)); } else { MessageBox.Show(NCliente.Insertar(tbDni.Text, tbNombre.Text, tbDireccion.Text, tbTelefono.Text)); Limpiar_Campos(); } } else { MessageBox.Show(Comprobar_Campos()); } } Mostrar(); }
public ComsultaC() { InitializeComponent(); Cliente C = new Cliente(); NCliente n = new NCliente(); n.Update(C); grid.ItemsSource = null; grid.ItemsSource = n.Select(); }
//metodo guardar datos private void btnGuardar_Click(object sender, EventArgs e) { //insertar datos try { string rpta = ""; if (this.txtNombre.Text == string.Empty) { MensajeError("Falta ingresar algunos datos, serán remarcados."); errorIcono.SetError(this.txtNombre, "Ingrese un nombre"); } else { if (this.EsNuevo) { //nombre,descripcion,imagen,activa rpta = NCliente.Insertar(this.txtNombre.Text.Trim().ToUpper()); } else { //id,nombre,descripcion,imagen,activa rpta = NCliente.Editar(Convert.ToInt32(this.txtCodigo.Text), this.txtNombre.Text.Trim().ToUpper()); } if (rpta.Equals("OK")) { if (this.EsNuevo) { this.MensajeOK("Se inserto de forma correcta el registro."); } else { this.MensajeOK("Se modificó de forma correcta el registro."); } } else { this.MensajeError(rpta); } //preparamos para nuevos datos this.EsNuevo = false; this.EsEditar = false; this.Botones(); this.LimpiarControles(); this.MostrarDatos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void tbBuscarClientesFacturacion_TextChanged(object sender, EventArgs e) { if (rbNombre.Checked) { NCliente.BuscarPorNombre(dgvVistaClienteFact, tbBuscarClientesFacturacion.Text); } else if (rbDNI.Checked) { NCliente.BuscarPorDni(dgvVistaClienteFact, tbBuscarClientesFacturacion.Text); } }
private void tbBuscarCliente_TextChanged(object sender, EventArgs e) { if (rbNombre.Checked) { NCliente.BuscarPorNombre(dgvVistaCliente, tbBuscarCliente.Text); } else if (rbDni.Checked) { NCliente.BuscarPorDni(dgvVistaCliente, tbBuscarCliente.Text); } }
private void btnBuscar_Click(object sender, EventArgs e) { if (this.txtCodigo.Text == "") { MessageBox.Show("Ingrese un Código", "Buscar Cliente", MessageBoxButtons.OK, MessageBoxIcon.Error); inicial(); } else { int codigo = Convert.ToInt32(this.txtCodigo.Text); DataTable dt = new NCliente().buscarCliente_Codigo(codigo); this.existeC = false; foreach (DataRow row in dt.Rows) { this.txtCodigo.Text = row["CodigoCliente"].ToString(); this.txtNombres.Text = row["Nombres"].ToString(); this.txtApellidos.Text = row["Apellidos"].ToString(); this.txtDireccion.Text = row["Direccion"].ToString(); this.txtDNI.Text = row["DNI"].ToString(); this.txtRUC.Text = row["RUC"].ToString(); this.dtpFechaIngreso.Value = Convert.ToDateTime(row["FechaIngreso"].ToString()); this.txtSaldoCuenta.Text = row["SaldoCuenta"].ToString(); this.act = Convert.ToBoolean(row["Activo"].ToString()); existeC = true; break; } if (existeC) { this.txtCodigo.Enabled = false; this.txtNombres.Enabled = true; this.txtApellidos.Enabled = true; this.txtDireccion.Enabled = true; this.txtDNI.Enabled = true; this.txtRUC.Enabled = true; this.dtpFechaIngreso.Enabled = true; this.txtSaldoCuenta.Enabled = true; this.btnBuscar.Enabled = false; this.btnGuardar.Enabled = false; this.btnEliminar.Enabled = true; this.btnModificar.Enabled = true; this.btnInsertar.Enabled = false; } else { MessageBox.Show("No existe un Cliente con ese Códgio", "Buscar Clientes", MessageBoxButtons.OK, MessageBoxIcon.Error); limpiar(); inicial(); } } }
//Método Mostrar todos los registros de la tabla clientes: private void Mostrar() { //LLamo a mi clase NCliente, donde está mi procedimiento: Mostrar, para que me envíe... //... ciertos valores. this.dataListado.DataSource = NCliente.Mostrar(); this.OcultarColumnas(); //lo concatenamos con el total de registros, llamando a su métodos Rows (de filas)... //... y llamamos a su método count, para contar todas las filas. //Como: ataListado.Rows.Count, me devuelve un int y lo que queremos es un string... //... para eso usamos: Convert.ToString, para convertir todo a un string: lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }