protected void btnBuscarRazon_Click(object sender, EventArgs e) { try { Cliente cliente = new Cliente(); cliente.RazonSocial = txtRazonSocial.Text; if (cliente.ReadRazon()) { txtRutEmpresa.Text = cliente.RutEmpresa; txtGiro.Text = cliente.Giro; txtDireccionEmpresa.Text = cliente.Direccion; txtTelefonoEmpresa.Text = cliente.TelefonoContacto; ddlComunaEmpresa.SelectedValue = cliente.IdComuna.ToString(); ddlCiudadEmpresa.SelectedValue = cliente.IdCiudad.ToString(); ddlTipoPago.SelectedValue = cliente.IdTipoPago.ToString(); txtIDContacto.Text = cliente.IdContactoComercial.ToString(); ddlTipoPago.SelectedValue = cliente.IdTipoPago.ToString(); txtCondicionPago.Text = cliente.Condicion.ToString(); txtLineaCredito.Text = cliente.LineaCredito; txtAreaObservacion.Text = cliente.Observacion; txtFichaCliente.Text = cliente.FichaCliente; txtLineaCredito.Text = cliente.LineaCredito; txtDicom.Text = cliente.Dicom; txtAreaObservacion.Text = cliente.Observacion; txtFechaActualizacion.Text = cliente.FechaActualizacion.ToLongDateString(); txtFechaIngreso.Text = cliente.FechaIngreso.ToLongDateString(); lblMensaje.Text = string.Empty; } else { lblMensaje.Text = "No se encuentra razón social"; } ContactoComercial contactoComercial = new ContactoComercial(); contactoComercial.IdContacto = int.Parse(txtIDContacto.Text); if (contactoComercial.Read()) { txtNombreContacto.Text = contactoComercial.NombreConta; txtTelefonoComercial.Text = contactoComercial.Telefono; txtEmailContacto.Text = contactoComercial.Email; ddlTipoCargo.SelectedValue = contactoComercial.IdCargo.ToString(); lblMensaje.Text = string.Empty; } else { lblMensaje.Text = "No se encuentra contacto comercial"; } } catch (ArgumentException ex) { lblMensaje.Text = ex.Message; } catch (Exception) { lblMensaje.Text = "Error al buscar"; } }
protected void btnBuscarRut_Click(object sender, EventArgs e) { try { Cliente cliente = new Cliente(); cliente.RutEmpresa = txtRutEmpresa.Text; if (cliente.Read()) { txtRazonSocial.Text = cliente.RazonSocial; txtGiro.Text = cliente.Giro; txtDireccionEmpresa.Text = cliente.Direccion; txtTelefonoEmpresa.Text = cliente.TelefonoContacto; ddlComunaEmpresa.SelectedValue = cliente.IdComuna.ToString(); ddlCiudadEmpresa.SelectedValue = cliente.IdCiudad.ToString(); txtIDContacto.Text = cliente.IdContactoComercial.ToString(); } else { lblMensaje.Text = "No se encuentra rut"; } ContactoComercial contactoComercial = new ContactoComercial(); contactoComercial.IdContacto = int.Parse(txtIDContacto.Text); if (contactoComercial.Read()) { txtNombreContacto.Text = contactoComercial.NombreConta; txtTelefonoComercial.Text = contactoComercial.Telefono; txtEmailContacto.Text = contactoComercial.Email; ddlTipoCargo.SelectedValue = contactoComercial.IdCargo.ToString(); } } catch (ArgumentException ex) { lblMensaje.Text = ex.Message; } catch (Exception) { lblMensaje.Text = "Error al buscar"; } }
protected void btnAgregar_Click(object sender, EventArgs e) { // Se traen los datos del cliente try { ContactoComercial contactoComercial = new ContactoComercial(); if (true) { } } catch (ArgumentException ex) { lblMensaje.Text = ex.Message; } catch (Exception) { lblMensaje.Text = "Error al agregar cliente"; } }