private void Busqueda() { db = new DatosEntities(); Lista = FactoryClientes.getItems(db, this.txtBuscar.Text); this.bs.DataSource = Lista; this.bs.ResetBindings(true); }
void txtCedulaRif_Validating(object sender, CancelEventArgs e) { DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender; if (!Editor.IsModified) { return; } string texto = Editor.Text; this.facturaBindingSource.EndEdit(); List <Cliente> items = FactoryClientes.getItems(texto); switch (items.Count) { case 0: LeerCliente(null, texto); break; case 1: LeerCliente(items[0]); break; default: FrmBuscarEntidades f = new FrmBuscarEntidades(); f.BuscarClientes(texto); LeerCliente((Cliente)f.registro); break; } }
private void Busqueda() { dc = new RestaurantEntities(); Texto = this.txtBuscar.Text; switch (myLayout.ToUpper()) { case "CLIENTES": this.bindingSource.DataSource = FactoryClientes.getItems(dc, Texto); break; case "MESONEROS": this.bindingSource.DataSource = FactoryUsuarios.getItems(dc, Texto, "MESONERO"); break; case "ADMINISTRADORES": this.bindingSource.DataSource = FactoryUsuarios.getItems(dc, Texto, "ADMINISTRADOR"); break; case "CAJEROS": this.bindingSource.DataSource = FactoryUsuarios.getItems(dc, Texto, "CAJERO"); break; case "MESAS": this.bindingSource.DataSource = FactoryMesas.getItems(dc, Texto); break; case "PLATOS": this.bindingSource.DataSource = FactoryPlatos.getItems(dc, Texto); break; case "COMPRAS": this.bindingSource.DataSource = FactoryCompras.getComprasEspera(dc, Texto); break; case "FACTURAS": this.bindingSource.DataSource = FactoryFacturas.getFacturasPendientes(dc, Texto); break; case "INGREDIENTES": this.bindingSource.DataSource = FactoryIngredientes.getItems(dc, Texto); break; case "PROVEEDORES": this.bindingSource.DataSource = FactoryProveedores.getItems(dc, Texto); break; case "MESAS DISPONIBLES": this.bindingSource.DataSource = FactoryMesas.getMesasDisponibles(dc); break; } this.gridControl1.DataSource = this.bindingSource; gridControl1.ForceInitialize(); gridView1.OptionsLayout.Columns.Reset(); this.gridControl1.DefaultView.RestoreLayoutFromXml(Application.StartupPath + "\\Layouts\\" + myLayout + ".XML", DevExpress.Utils.OptionsLayoutGrid.FullLayout); }
private void GuadarFactura() { mesasAbiertaBindingSource.EndEdit(); ValidarFactura(); factura.Cajero = FactoryUsuarios.UsuarioActivo.Nombre; factura.IdCajero = FactoryUsuarios.UsuarioActivo.IdUsuario; if (esNuevo && factura.IdFactura == null) { factura.IdFactura = FactoryContadores.GetMax("IdFactura"); } factura.Anulado = false; factura.Saldo = (double)decimal.Round((decimal)factura.Saldo.GetValueOrDefault(0), 0); foreach (HK.FacturasPlato p in factura.FacturasPlatos) { if (p.IdFacturaPlato == null) { p.IdFacturaPlato = FactoryContadores.GetMax("IdFacturaPlato"); } } cliente = FactoryClientes.Item(db, factura.CedulaRif); if (cliente == null) { cliente = new Cliente(); cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; cliente.IdCliente = FactoryContadores.GetMax("IdCliente"); db.Clientes.AddObject(cliente); } else { cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; } if (esNuevo) { db.Facturas.AddObject(factura); } factura.Fecha = DateTime.Today; factura.Hora = DateTime.Now; factura.Totalizar(mesa.CobraServicio.GetValueOrDefault(false), mesa.Descuento.GetValueOrDefault(0)); if (!Basicas.ImpresoraActiva) { factura.Tipo = "POR IMPRIMIR"; } if (!FactoryLibroVentas.Existe(factura)) { FactoryLibroVentas.EscribirItemFactura(factura); factura.LibroVentas = true; } db.SaveChanges(); factura = new Factura(); }
private void Guadar() { { facturaBindingSource.EndEdit(); factura.Cajero = FactoryUsuarios.CajeroActivo.Nombre; factura.IdCajero = FactoryUsuarios.CajeroActivo.IdUsuario; if (esNuevo && factura.IdFactura == null) { factura.IdFactura = FactoryContadores.GetMax("IdFactura"); } factura.Anulado = false; factura.Saldo = (double)decimal.Round((decimal)factura.Saldo.GetValueOrDefault(0), 0); foreach (HK.FacturasPlato p in factura.FacturasPlatos) { if (p.IdFacturaPlato == null) { p.IdFacturaPlato = FactoryContadores.GetMax("IdFacturaPlato"); } } cliente = FactoryClientes.Item(db, factura.CedulaRif); if (cliente == null) { cliente = new Cliente(); cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; db.Clientes.AddObject(cliente); } else { cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; } if (esNuevo) { db.Facturas.AddObject(factura); } factura.Fecha = DateTime.Today; factura.Hora = DateTime.Now; db.SaveChanges(); if (factura.Tipo != "PENDIENTE") { FactoryFacturas.DescontarInventario(factura); } factura = new Factura(); } }
private void CedulaRifButtonEdit_Click(object sender, EventArgs e) { FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarClientes(""); if (F.registro != null) { cliente = (Cliente)F.registro; cliente = FactoryClientes.Item(cliente.CedulaRif); LeerCliente(); } else { cliente = new Cliente(); } }
void CedulaRifButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarClientes(""); if (F.registro != null) { proveedor = (Cliente)F.registro; proveedor = FactoryClientes.Item(proveedor.CedulaRif); LeerProveedor(); } else { proveedor = new Cliente(); } }
private void GuardarFactura() { using (var db = new FeriaEntities()) { cliente = FactoryClientes.Item(db, factura.CedulaRif); if (cliente == null) { cliente = new Cliente(); cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; db.Clientes.AddObject(cliente); } else { cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; } if (factura.IdFactura == null) { esNuevo = true; factura.IdFactura = FactoryContadores.GetMax("IdFactura"); } foreach (FacturasPlato p in factura.FacturasPlatos) { if (p.IdFacturaPlato == null) { p.IdFacturaPlato = FactoryContadores.GetMax("IdFacturaPlato"); } } if (esNuevo) { db.Facturas.AddObject(factura); } try { db.SaveChanges(); } catch (Exception x) { MessageBox.Show(x.InnerException.Message); } } }
void txtCedulaRif_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarClientes(""); if (F.registro != null) { cliente = (Cliente)F.registro; cliente = FactoryClientes.Item(cliente.CedulaRif); factura.CedulaRif = cliente.CedulaRif; LeerCliente(); } else { cliente = FactoryClientes.Item(Basicas.CedulaRif("0")); LeerCliente(); } }
void txtCedulaRif_Validating(object sender, CancelEventArgs e) { DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender; if (!Editor.IsModified) { return; } if (string.IsNullOrEmpty(Editor.Text)) { Editor.Text = Basicas.CedulaRif("0"); } string Texto = Editor.Text; this.facturaBindingSource.EndEdit(); List <Cliente> T = FactoryClientes.getItems(Texto); switch (T.Count) { case 0: cliente = new Cliente(); cliente.CedulaRif = Basicas.CedulaRif(Texto); break; case 1: cliente = T[0]; break; default: FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarClientes(Texto); if (F.registro != null) { cliente = (Cliente)F.registro; cliente = FactoryClientes.Item(cliente.CedulaRif); } else { cliente = FactoryClientes.Item(Basicas.CedulaRif("0")); } break; } LeerCliente(); }
void CedulaRifButtonEdit_Validating(object sender, CancelEventArgs e) { DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender; if (!Editor.IsModified) { return; } string Texto = Editor.Text; this.libroVentaBindingSource.EndEdit(); List <Cliente> T = FactoryClientes.getItems(Texto); switch (T.Count) { case 0: proveedor = new Cliente(); proveedor.CedulaRif = Basicas.CedulaRif(Texto); break; case 1: proveedor = T[0]; break; default: FrmBuscarEntidades F = new FrmBuscarEntidades(); F.BuscarClientes(Texto); if (F.registro != null) { proveedor = (Cliente)F.registro; proveedor = FactoryClientes.Item(proveedor.CedulaRif); } else { proveedor = null; } break; } LeerProveedor(); }
private void GuardarFactura() { using (var db = new DatosEntities()) { cliente = FactoryClientes.Item(db, factura.CedulaRif); if (cliente == null) { cliente = new Cliente(); cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; cliente.IdCliente = FactoryContadores.GetMax("IdCliente"); db.Clientes.AddObject(cliente); } else { cliente.CedulaRif = factura.CedulaRif; cliente.RazonSocial = factura.RazonSocial; cliente.Direccion = factura.Direccion; } if (factura.IdFactura == null) { esNuevo = true; factura.IdFactura = FactoryContadores.GetMax("IdFactura"); } foreach (FacturasPlato p in factura.FacturasPlatos) { if (p.IdFacturaPlato == null) { p.IdFacturaPlato = FactoryContadores.GetMax("IdFacturaPlato"); } } if (esNuevo) { factura.Anulado = false; factura.Inventarios = false; // factura.LibroVentas = false; factura.LibroInventarios = false; db.Facturas.AddObject(factura); } try { db.SaveChanges(); FactoryFacturas.DescontarInventario(factura); if (factura.Credito.GetValueOrDefault(0) > 0) { FactoryCxC.CrearCxC(factura); } } catch (Exception x) { if (x.InnerException != null) { MessageBox.Show(x.InnerException.Message); } else { MessageBox.Show(x.Message); } } } }