private void ConsultaDeClientesToolStripMenuItem_Click(object sender, EventArgs e) { cCliente cCliente = new cCliente(); cCliente.MdiParent = this; cCliente.Show(); }
private void ClienteToolStripMenuItem1_Click(object sender, EventArgs e) { cCliente cliente = new cCliente(); cliente.MdiParent = this; cliente.Show(); }
private void txtNroDocumento_TextChanged(object sender, EventArgs e) { int b = 0; string NroDoc = txtNroDocumento.Text; if (NroDoc.Length < 3) { return; } cCliente cli = new cCliente(); DataTable trdo = cli.GetClientesxNroDocumento(NroDoc); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodCliente"].ToString() != "") { Int32 CodCliente = Convert.ToInt32(trdo.Rows[0]["CodCliente"].ToString()); GetClientexCodigo(CodCliente); b = 1; } } if (b == 0) { txtCodCliente.Text = ""; txtApellido.Text = ""; txtNombre.Text = ""; } }
private Int32 GrabarCliente(SqlConnection con, SqlTransaction tran) { Int32 CodCliente = 0; string Nombre = txtNombre.Text; string Apellido = txtApellido.Text; string Telefono = txtTelefono.Text; Int32? CodTipoDoc = null; string Direccion = ""; if (cmbTipoDoc.SelectedIndex > 0) { CodTipoDoc = Convert.ToInt32(cmbTipoDoc.SelectedValue); } string NroDocumento = txtNroDocumento.Text; Direccion = txtDireccion.Text; cCliente cli = new cCliente(); if (txtCodCliente.Text == "") { CodCliente = cli.InsertarClienteTran(con, tran, Apellido, Nombre, "", Telefono, CodTipoDoc, NroDocumento, Direccion); } else { CodCliente = Convert.ToInt32(txtCodCliente.Text); cli.ModificarClienteTran(con, tran, CodCliente.ToString(), Apellido, Nombre, "", Telefono, CodTipoDoc, NroDocumento, Direccion); } txtCodCliente.Text = CodCliente.ToString(); return(CodCliente); }
public static void Eliminar(Int32 ID) { //Cambia el estatus del cliente en la base de datos. try { //Creamos un objeto cliente cCliente Cliente = new cCliente(); //Buscamos los datos del cliente por su ID Cliente = BuscarPorID(ID); //Intercambiamos los estatus del cliente if ((Boolean)Cliente.EstatusID == true) { Cliente.EstatusID = false; } //Actualizamos la informacion del cliente Actualizar(Cliente); } catch (MySqlException Ex) { throw Ex; } }
private void cClienteMenuItem_Click(object sender, RoutedEventArgs e) { cCliente cc = new cCliente(); cc.Show(); }
public string listar() { var query = (from p in db.Cliente select p).OrderBy(p => p.Id).ToList <Cliente>(); List <cCliente> listaCliente = new List <cCliente>(); foreach (Cliente cliente in query) { cCliente ObjCliente = new cCliente(); ObjCliente.Id = cliente.Id; ObjCliente.Cliente1 = cliente.Cliente1; ObjCliente.RegFiscal = cliente.RegFiscal; ObjCliente.Direccion = cliente.Direccion; ObjCliente.Email = cliente.Email; ObjCliente.Telefono = cliente.Telefono; ObjCliente.Agregado = cliente.Agregado; listaCliente.Add(ObjCliente); } return(JsonConvert.SerializeObject(new { status = true, mensaje = "Datos cargados", data = listaCliente })); }
private void CargarInformacion() { try { if (CodigoCliente.HasValue && CodigoCliente > 0) { Int32 Codigo = Convert.ToInt32(CodigoCliente); //Informacion de cuentas CuentasCobrarBL ObjetoCuenta = new CuentasCobrarBL(); dgvCargosGenerales.AutoGenerateColumns = false; dgvCargosGenerales.DataSource = ObjetoCuenta.ListarCargosGenerales(Codigo); //Informacion de Clientes ClienteBL ObjetoCliente = new ClienteBL(); cCliente Cliente = ObjetoCliente.BuscarPorID(Codigo); txtNombreCliente.Text = Cliente.NombreComercial.ToString(); txtCodigoCliente.Text = Cliente.Codigo.ToString(); txtBalance.Text = Cliente.Balance.ToString("C2"); } else { //Enviamos un mensaje indicando que debe seleccionar un cliente MessageBox.Show("Debe seleccionar un cliente para verificar su estado de cuenta", "Seleccione un cliente", MessageBoxButtons.OK, MessageBoxIcon.Error); //Cerramos el formulario this.Close(); } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
//Obtenemos los datos de los controles private cCliente ObtenerDatos() { cCliente Cliente = new cCliente(); Cliente.Codigo = Convert.ToInt32(txtCodigoCliente.Text); Cliente.NombreComercial = txtNombreCliente.Text; Cliente.EstatusID = cbEstatus.Checked; Cliente.Direccion = txtDireccion.Text; Cliente.Ciudad = txtCiudad.Text; Cliente.Provincia = txtProvincia.Text; Cliente.Correo = txtEmail.Text; Cliente.RNC = txtRNC_Cedula.Text; Cliente.Telefono = txtTelefono.Text; //Cliente.Telefono2 = txtTelefono2.Text; Cliente.Fax = txtFax.Text; Cliente.Observaciones = txtObservacion.Text; Cliente.Correo = txtEmail.Text; Cliente.LimiteCredito = ObtenerLimite(txtLimiteCredito.Text); Cliente.DiasCredito = ObtenerDiasCredito(nudDiasCredito.Value.ToString()); Cliente.VendedorID = ObtenerVendedor(); Cliente.Descuento = nudDescuento.Value; Cliente.TipoComprobanteID = ObtenerTipoComprobante(); Cliente.PaginaWeb = txtWeb.Text; Cliente.Balance = ObtenerSaldo(); return(Cliente); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); DataTable tblCliente = oCliente.Get(); if (tblCliente != null) { if (tblCliente.Rows.Count > 0) { oCmbCliente.Items.Add(new ListItem("Seleccione Cliente", "")); foreach (DataRow oRow in tblCliente.Rows) { oCmbCliente.Items.Add(new ListItem(oRow["snombre"].ToString(), oRow["nkey_cliente"].ToString())); } } tblCliente.Dispose(); } oCliente = null; } oConn.Close(); sTipo.Value = oWeb.GetData("sTipo"); oCmbTipoConsulta.Items.Add(new ListItem("Seleccione Tipo Consulta", "")); switch (sTipo.Value) { case "calidadproductiva": oCmbTipoConsulta.Items.Add(new ListItem("Analista", "A")); oCmbTipoConsulta.Items.Add(new ListItem("Cliente", "C")); oCmbTipoConsulta.Items.Add(new ListItem("Supervisor", "S")); break; case "impecabilidad": oCmbTipoConsulta.Items.Add(new ListItem("Analista", "A")); oCmbTipoConsulta.Items.Add(new ListItem("Cliente", "C")); break; case "managersp1": case "managersp2": oCmbTipoConsulta.Items.Add(new ListItem("Supervisor", "S")); break; case "analistap1": case "analistap2": oCmbTipoConsulta.Items.Add(new ListItem("Analista", "A")); break; case "riegooperacional": oCmbTipoConsulta.Items.Add(new ListItem("Manual", "M")); break; case "tesoreriaproceso": oCmbTipoConsulta.Items.Add(new ListItem("Analista", "A")); break; } } }
protected void lnkButton_Click(object sender, EventArgs e) { string sPath = string.Empty; DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); oCliente.NkeyCliente = "79"; DataTable dt = oCliente.Get(); if (dt != null) { sPath = dt.Rows[0]["pathsdocscaneados"].ToString(); } dt = null; } oConn.Close(); sPath = sPath + "Mattel Europa\\ContratosWeb\\" + hddpdfcontrato.Value; Response.AppendHeader("Content-Disposition", "attachment; filename=" + hddpdfcontrato.Value); // Write the file to the Response const int bufferLength = 10000; byte[] buffer = new Byte[bufferLength]; int length = 0; Stream download = null; try { download = new FileStream(sPath, FileMode.Open, FileAccess.Read); do { if (Response.IsClientConnected) { length = download.Read(buffer, 0, bufferLength); Response.OutputStream.Write(buffer, 0, length); buffer = new Byte[bufferLength]; } else { length = -1; } }while (length > 0); Response.Flush(); Response.End(); } finally { if (download != null) { download.Close(); } } }
private void AsignarDatosCliente(cCliente Cliente) { lblDireccion.Text = Cliente.Direccion.ToString(); lblRNC.Text = Cliente.RNC.ToString(); cbbCliente.SelectedValue = Cliente.Codigo; AsignarFechaVencimiento(Cliente); }
private void MostrarDatos(cCliente Cliente) { //Mostramos los datos del cliente //txtAtencionCobros.Text = Cliente.ContactoCobros; txtTelefono.Text = Cliente.Telefono; txtEmail.Text = Cliente.Correo; txtDiasCredito.Text = Cliente.DiasCredito.ToString(); txtLimiteCredito.Text = Cliente.LimiteCredito.ToString("C2"); txtBalance.Text = Cliente.Balance.ToString("C2"); }
public static List <cCliente> Catalogo(Int64 CodigoDesde, Int64 CodigoHasta, Int32?VendedorID, Boolean?Estatus) { try { //Declaramos la conexion hacia la base de datos using (MySqlConnection Conn = new MySqlConnection(cConexion.CadenaConexion())) { Conn.Open(); //Nombre del procedimiento string StoreProc = "uspCatalogoClientes"; //Creamos el command para la insercion MySqlCommand Cmd = new MySqlCommand(StoreProc, Conn); Cmd.CommandType = CommandType.StoredProcedure; //Parametro Cmd.Parameters.AddWithValue("ClienteDesde", CodigoDesde); Cmd.Parameters.AddWithValue("ClienteHasta", CodigoHasta); Cmd.Parameters.AddWithValue("Estatus", Estatus); Cmd.Parameters.AddWithValue("VendedorID", VendedorID); //Ejecutamos el lector MySqlDataReader Reader = Cmd.ExecuteReader(); List <cCliente> Lista = new List <cCliente>(); while (Reader.Read()) { cCliente Cliente = new cCliente(); Cliente.Codigo = Reader.GetInt32(Reader.GetOrdinal("Codigo")); Cliente.NombreComercial = Reader.GetString(Reader.GetOrdinal("NombreComercial")); Cliente.RNC = Reader.IsDBNull(Reader.GetOrdinal("RNC")) ? null : Reader.GetString(Reader.GetOrdinal("RNC")); Cliente.Telefono = Reader.IsDBNull(Reader.GetOrdinal("Telefono")) ? null : Reader.GetString(Reader.GetOrdinal("Telefono")); Cliente.Ciudad = Reader.IsDBNull(Reader.GetOrdinal("Ciudad")) ? null : Reader.GetString(Reader.GetOrdinal("Ciudad")); Cliente.Provincia = Reader.IsDBNull(Reader.GetOrdinal("Provincia")) ? null : Reader.GetString(Reader.GetOrdinal("Provincia")); Cliente.Fax = Reader.IsDBNull(Reader.GetOrdinal("Fax")) ? null : Reader.GetString(Reader.GetOrdinal("Fax")); Cliente.Correo = Reader.IsDBNull(Reader.GetOrdinal("Correo")) ? null : Reader.GetString(Reader.GetOrdinal("Correo")); Cliente.Descuento = Reader.IsDBNull(Reader.GetOrdinal("Descuento")) ? 0 : Reader.GetDecimal(Reader.GetOrdinal("Descuento")); Cliente.LimiteCredito = Reader.IsDBNull(Reader.GetOrdinal("LimiteCredito")) ? 0 : Reader.GetDecimal(Reader.GetOrdinal("LimiteCredito")); Cliente.DiasCredito = Reader.IsDBNull(Reader.GetOrdinal("DiasCredito")) ? 0 : Reader.GetInt32(Reader.GetOrdinal("DiasCredito")); Cliente.UltFechaVenta = Reader.IsDBNull(Reader.GetOrdinal("UltFechaVenta")) ? "" : Reader.GetValue(Reader.GetOrdinal("UltFechaVenta")); //Cliente.Balance = Reader.IsDBNull(Reader.GetOrdinal("Balance")) ? 0.00 : Reader.GetDouble(Reader.GetOrdinal("Balance")); //Agregamos el articulo a la lista Lista.Add(Cliente); } //Cerramos la conexion Conn.Close(); //Retornamos la lista de clientes return(Lista); } } catch (MySqlException Ex) { throw Ex; } }
private void gunaButton1_Click(object sender, EventArgs e) { cCliente cliente = new cCliente(); if (id != 0) { cliente.IdCliente = 1; } else { cliente.IdCliente = -1; } cliente.Nombre = txtNombre.Text; cliente.ApePaterno = txtApePaterno.Text; cliente.ApeMaterno = txtApeMaterno.Text; cliente.Email = txtEmail.Text; cliente.Telefono = txtTelefono.Text; cliente.Calle = txtCalle.Text; cliente.NoExt = txtNomExt.Text; cliente.NoInt = txtNomInt.Text; cliente.Colonia = txtColonia.Text; cliente.Ciudad = txtCiudad.Text; cliente.FechaAlta = DateTime.Now; cliente.Comentario = txtComentarios.Text; cliente.Conexion = 2; if (txtNombre.Text == "" || txtTelefono.Text == "") { MessageBox.Show("El nombre y Teléfono son obligatorios"); } else { var json = JsonConvert.SerializeObject(cliente); // Console.WriteLine(json); var data = new StringContent(json, Encoding.UTF8, "application/json"); var url = "http://www.facturadp.com/kenduAPI/"; using (var client = new HttpClient()) { client.BaseAddress = new Uri(url); var response = client.PutAsJsonAsync("api/cliente", cliente).Result; Console.WriteLine(response.StatusCode); //MessageBox.Show("Se ha Agregado el cliente correctamente"); if (response.IsSuccessStatusCode) { mensaje(id); ClearTextBoxes(); getsClientes(); } } } }
public void BusquedaCliente(Int32 Codigo) { try { ClienteBL ObjetoCliente = new ClienteBL(); //Buscamos la direccion del cliente y el RNC mediante su codigo unico cCliente Cliente = ObjetoCliente.BuscarPorID(Codigo); AsignarDatosCliente(Cliente); } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
public static void Actualizar(cCliente Cliente) { try { //Declaramos la conexion hacia la base de datos using (MySqlConnection Conn = new MySqlConnection(cConexion.CadenaConexion())) { Conn.Open(); //Nombre del procedimiento string StoreProc = "uspActualizarClte"; //Creamos el command para la insercion MySqlCommand Cmd = new MySqlCommand(StoreProc, Conn); Cmd.CommandType = CommandType.StoredProcedure; //Parametros Cmd.Parameters.AddWithValue("p_Codigo", Cliente.Codigo); Cmd.Parameters.AddWithValue("p_NombreComercial", Cliente.NombreComercial); Cmd.Parameters.AddWithValue("p_RNC", Cliente.RNC); Cmd.Parameters.AddWithValue("p_Estatus", Cliente.EstatusID); //Cliente Activo Cmd.Parameters.AddWithValue("p_Direccion", Cliente.Direccion); Cmd.Parameters.AddWithValue("p_Provincia", Cliente.Provincia); Cmd.Parameters.AddWithValue("p_Ciudad", Cliente.Ciudad); Cmd.Parameters.AddWithValue("p_Telefono", Cliente.Telefono); Cmd.Parameters.AddWithValue("p_Telefono2", Cliente.Telefono2); Cmd.Parameters.AddWithValue("p_Fax", Cliente.Fax); Cmd.Parameters.AddWithValue("p_Correo", Cliente.Correo); //Cmd.Parameters.AddWithValue("FechaCreacion", DateTime.Now.Date); //Cmd.Parameters.AddWithValue("FechaModificacion", DateTime.Now.Date); Cmd.Parameters.AddWithValue("p_Observacion", Cliente.Observaciones); Cmd.Parameters.AddWithValue("p_CodigoComprobante", Cliente.TipoComprobanteID); Cmd.Parameters.AddWithValue("p_DiasCredito", Cliente.DiasCredito); Cmd.Parameters.AddWithValue("p_LimiteCredito", Cliente.LimiteCredito); Cmd.Parameters.AddWithValue("p_Descuento", Cliente.Descuento); //Cmd.Parameters.AddWithValue("ClasificacionID", Cliente.ClasificacionID); //Cmd.Parameters.AddWithValue("Balance", Cliente.Balance); Cmd.Parameters.AddWithValue("p_CodigoVend", Cliente.VendedorID); //Cmd.Parameters.AddWithValue("p_ContactoVentas", Cliente.ContactoVentas); //Cmd.Parameters.AddWithValue("p_ContactoCobros", Cliente.ContactoCobros); Cmd.Parameters.AddWithValue("p_PaginaWeb", Cliente.PaginaWeb); Cmd.ExecuteNonQuery(); } } catch (MySqlException Ex) { throw Ex; } }
private void GetClientexCodigo(Int32 CodCliente) { cCliente cli = new cCliente(); DataTable trdo = cli.GetClientexCodigo(CodCliente); if (trdo.Rows.Count > 0) { txtCodCliente.Text = trdo.Rows[0]["CodCliente"].ToString(); txtNroDocumento.Text = trdo.Rows[0]["NroDocumento"].ToString(); txtNombre.Text = trdo.Rows[0]["Nombre"].ToString(); txtApellido.Text = trdo.Rows[0]["Apellido"].ToString(); txtTelefono.Text = trdo.Rows[0]["Telefono"].ToString(); txtCuit.Text = trdo.Rows[0]["Cuit"].ToString(); txtDireccion.Text = trdo.Rows[0]["Direccion"].ToString(); } }
private void AsignarDatosCliente(cCliente Cliente) { try { lblDireccion.Text = Cliente.Direccion.ToString(); lblRNC.Text = Cliente.RNC.ToString(); cbbCliente.SelectedValue = Cliente.Codigo; AsignarFechaVencimiento(Cliente); } catch (Exception Ex) { throw Ex; } }
protected void LoadGrid() { DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); if (!string.IsNullOrEmpty(txtlogo.Text)) { oCliente.SNombre = txtlogo.Text; } gridLogos.DataSource = oCliente.GetHolding(); gridLogos.DataBind(); oConn.Close(); } }
public static List <cCliente> Listar() { try { //Declaramos la conexion hacia la base de datos using (MySqlConnection Conn = new MySqlConnection(cConexion.CadenaConexion())) { Conn.Open(); //Nombre del procedimiento string StoreProc = "uspListarCltes"; //Creamos el command para la insercion MySqlCommand Cmd = new MySqlCommand(StoreProc, Conn); Cmd.CommandType = CommandType.StoredProcedure; //Ejecutamos el lector MySqlDataReader Reader = Cmd.ExecuteReader(); List <cCliente> Lista = new List <cCliente>(); while (Reader.Read()) { cCliente Cliente = new cCliente(); Cliente.Codigo = Reader.GetInt32(Reader.GetOrdinal("Codigo")); Cliente.NombreComercial = Reader.GetString(Reader.GetOrdinal("NombreComercial")); Cliente.RNC = Reader.IsDBNull(Reader.GetOrdinal("RNC")) ? null : Reader.GetString(Reader.GetOrdinal("RNC")); Cliente.Telefono = Reader.IsDBNull(Reader.GetOrdinal("Telefono")) ? null : Reader.GetString(Reader.GetOrdinal("Telefono")); Cliente.Ciudad = Reader.IsDBNull(Reader.GetOrdinal("Ciudad")) ? null : Reader.GetString(Reader.GetOrdinal("Ciudad")); Cliente.Provincia = Reader.IsDBNull(Reader.GetOrdinal("Provincia")) ? null : Reader.GetString(Reader.GetOrdinal("Provincia")); Cliente.Balance = Reader.IsDBNull(Reader.GetOrdinal("Balance")) ? 0 : Reader.GetDecimal(Reader.GetOrdinal("Balance")); //Agregamos el articulo a la lista Lista.Add(Cliente); } //Cerramos la conexion Conn.Close(); //Retornamos la lista de clientes return(Lista); } } catch (MySqlException Ex) { throw Ex; } }
protected void Page_Load(object sender, EventArgs e) { oWeb.ValidaSessionAdm(); if (!IsPostBack) { string sFile = string.Empty; CodCliente.Value = oWeb.GetData("CodCliente"); hddTipo.Value = oWeb.GetData("tp"); DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); oCliente.NKey_cliente = CodCliente.Value; DataTable dtCliente = oCliente.Get(); if (dtCliente.Rows.Count > 0) { Label1.Text = dtCliente.Rows[0]["sNombre"].ToString(); } cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn); oAppLogoCliente.NKey_cliente = CodCliente.Value; DataTable dtLogo = oAppLogoCliente.Get(); if (dtLogo != null) { if (dtLogo.Rows.Count > 0) { hddAccion.Value = "EDITAR"; if (!string.IsNullOrEmpty(dtLogo.Rows[0]["logo_cliente"].ToString())) { sFile = dtLogo.Rows[0]["logo_cliente"].ToString(); getImage(sFile); } else { getImage("nada.jpg"); } } } } oConn.Close(); } }
public static List <cCliente> Filtrar(Int32 CodigoDesde, Int32 CodigoHasta) { try { //Declaramos la conexion hacia la base de datos using (MySqlConnection Conn = new MySqlConnection(cConexion.CadenaConexion())) { Conn.Open(); //Nombre del procedimiento string StoreProc = "uspFiltroClte"; //Creamos el command para la insercion MySqlCommand Cmd = new MySqlCommand(StoreProc, Conn); Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.AddWithValue("p_CodigoDesde", CodigoDesde); Cmd.Parameters.AddWithValue("p_CodigoHasta", CodigoHasta); //Ejecutamos el lector MySqlDataReader Reader = Cmd.ExecuteReader(); List <cCliente> Lista = new List <cCliente>(); while (Reader.Read()) { cCliente Cliente = new cCliente(); Cliente.Codigo = Reader.GetInt32(Reader.GetOrdinal("Codigo")); Cliente.NombreComercial = Reader.GetString(Reader.GetOrdinal("NombreComercial")); //Agregamos el articulo a la lista Lista.Add(Cliente); } //Cerramos la conexion Conn.Close(); //Retornamos la lista de clientes return(Lista); } } catch (MySqlException Ex) { throw Ex; } }
public void GuardarCambios(cCliente Cliente) { try { //Si el almacen existe entonces actualizamos if (ClienteDA.Existe(Cliente.Codigo)) { ClienteDA.Actualizar(Cliente); } else //Si el almacen es nuevo entonces creamos { ClienteDA.Crear(Cliente); } } catch (Exception Ex) { throw Ex; } }
protected void idBuscar_Click(object sender, EventArgs e) { idGrilla.Visible = true; DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); oCliente.CodNkey = oIsUsuario.CodNkey; DataTable dtCliente = oCliente.GeCliente(); if (dtCliente != null) { if (dtCliente.Rows.Count > 0) { sNombre.Text = dtCliente.Rows[0]["cliente"].ToString(); sDirec.Text = dtCliente.Rows[0]["direccion"].ToString(); sComuna.Text = dtCliente.Rows[0]["comuna"].ToString(); sRut.Text = dtCliente.Rows[0]["Rut"].ToString() + " - " + dtCliente.Rows[0]["dv"].ToString(); } } dtCliente = null; cEjecutivo oEjecutivo = new cEjecutivo(ref oConn); oEjecutivo.CodNkey = oIsUsuario.CodNkey; DataTable dtEjecutivo = oEjecutivo.Get(); if (dtEjecutivo != null) { if (dtEjecutivo.Rows.Count > 0) { sEjeNombre.Text = dtEjecutivo.Rows[0]["Ejecutivo"].ToString(); sEjeFax.Text = dtEjecutivo.Rows[0]["Fax"].ToString(); sTele.Text = dtEjecutivo.Rows[0]["Telefono"].ToString(); sEMail.Text = dtEjecutivo.Rows[0]["EMail"].ToString(); } } dtEjecutivo = null; } oConn.Close(); rdGridCartola.Rebind(); }
//Grilla.Rows[i].DefaultCellStyle.BackColor = Color.LightCyan; private string BuscarTelefonoCliente(Int32 CodVenta) { string telefono = ""; cVenta venta = new cVenta(); DataTable tbventa = venta.GetVentaxCodigo(CodVenta); if (tbventa.Rows.Count > 0) { if (tbventa.Rows[0]["CodCliente"].ToString() != "") { Int32 CodCli = Convert.ToInt32(tbventa.Rows[0]["CodCliente"].ToString()); cCliente cli = new cCliente(); DataTable tcli = cli.GetClientesxCodigo(CodCli); if (tcli.Rows.Count > 0) { telefono = tcli.Rows[0]["Telefono"].ToString(); } } } return(telefono); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rdCmbCliente.Items.Add(new ListItem("<< Seleccione Cliente", "0")); rdCmbLicencitarios.Items.Add(new ListItem("<< Seleccione Licenciatario", "0")); DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); DataTable dtCliente = oCliente.Get(); if (dtCliente != null) { foreach (DataRow oRow in dtCliente.Rows) { rdCmbCliente.Items.Add(new ListItem(oRow["sNombre"].ToString(), oRow["nKey_cliente"].ToString())); } } dtCliente = null; cDeudor oDeudor = new cDeudor(ref oConn); DataTable dtDeudor = oDeudor.Get(); if (dtDeudor != null) { foreach (DataRow oRow in dtDeudor.Rows) { rdCmbLicencitarios.Items.Add(new ListItem(oRow["sNombre"].ToString(), oRow["nKey_Deudor"].ToString())); } } dtDeudor = null; oConn.Close(); } hdd_codusuario.Value = oWeb.GetData("codusuario"); if (!string.IsNullOrEmpty(hdd_codusuario.Value)) { getUsuario(); } } }
//Muestra la informacion de cliente seleccionado private void MostrarDatos(cCliente Cliente) { try { //Mostramos la informacion del cliente buscado txtCodigoCliente.Text = Convert.ToString(Cliente.Codigo); txtNombreCliente.Text = Cliente.NombreComercial; txtDireccion.Text = Cliente.Direccion; txtCiudad.Text = Cliente.Ciudad; txtProvincia.Text = Cliente.Provincia; txtEmail.Text = Cliente.Correo; txtRNC_Cedula.Text = Cliente.RNC; txtTelefono.Text = Cliente.Telefono; txtFax.Text = Cliente.Fax; txtObservacion.Text = Cliente.Observaciones; //txtTelefono2.Text = Cliente.Telefono2; txtWeb.Text = Cliente.PaginaWeb; cbEstatus.Checked = (Boolean)Cliente.EstatusID; txtLimiteCredito.Text = Cliente.LimiteCredito.ToString(); nudDiasCredito.Value = Cliente.DiasCredito; cbbVendedor.SelectedValue = Cliente.VendedorID; cbbTipoComprobante.SelectedValue = Cliente.TipoComprobanteID; nudDescuento.Value = Cliente.Descuento; txtFechaCreacion.Text = Cliente.FechaCreacion.ToShortDateString(); txtFechaModificacion.Text = Cliente.FechaModificacion.ToShortDateString(); txtFechaUltVenta.Text = Cliente.UltFechaVenta.ToString(); txtUltDocVenta.Text = Cliente.UltDocVenta.ToString(); txtUltMontoVenta.Text = Cliente.UltMontoVenta.ToString("C2"); txtDocUltPago.Text = Cliente.UltDocPago.ToString(); txtMontoUltPago.Text = Cliente.UltMontoPago.ToString("C2"); txtFechaUltPago.Text = Cliente.UltFechaPago.ToString(); txtSaldo.Text = Cliente.Balance.ToString(); CargarContactos(Cliente.Codigo); } catch (Exception Ex) { throw Ex; } }
public JsonResult guardar(cCliente ccliente) { Cliente objCliente = new Cliente(); if (ccliente.Id != 0) { //editar objCliente = db.Cliente.Where(a => a.Id == ccliente.Id).FirstOrDefault(); if (objCliente == null) { return(Json(new { status = false, mensaje = "No existe el registro" })); } else { objCliente.RegFiscal = ccliente.RegFiscal; objCliente.Cliente1 = ccliente.Cliente1; objCliente.Direccion = ccliente.Direccion; objCliente.Email = ccliente.Email; objCliente.Telefono = ccliente.Telefono; objCliente.Agregado = DateTime.Now; db.Cliente.Attach(objCliente); db.Entry(objCliente).State = System.Data.Entity.EntityState.Modified; } } else { //nuevo objCliente.RegFiscal = ccliente.RegFiscal; objCliente.Cliente1 = ccliente.Cliente1; objCliente.Direccion = ccliente.Direccion; objCliente.Email = ccliente.Email; objCliente.Telefono = ccliente.Telefono; objCliente.Agregado = DateTime.Now; db.Cliente.Add(objCliente); } db.SaveChanges(); return(Json(new { status = true, mensaje = "Datos guardados", datos = objCliente })); }
protected void LoadGrid() { DBConn oConn = new DBConn(); if (oConn.Open()) { cCliente oCliente = new cCliente(ref oConn); oCliente.CodMonitor = CodMonitorView.Value; //oCliente.CodPage = hddCodPage.Value; oCliente.CodPage = oCmbPages.SelectedValue; if (string.IsNullOrEmpty(bVista.Value)) { GridClientes.DataSource = oCliente.GetClientByPageMonitor(); } else { GridClientes.DataSource = oCliente.GetHoldingByPageMonitor(); } GridClientes.DataBind(); } oConn.Close(); }