Example #1
0
 public void CloseCaja(int cajaID)
 {
     using (EPracticoDBEntities entities = new EPracticoDBEntities())
     {
         CajaClienteService cajaClienteService = new CajaClienteService();
         var caja = entities.Caja.FirstOrDefault(x => x.CajaID == cajaID);
         UpdateCaja(caja);
         entities.SaveChanges();
         var cajaClientes = entities.CajaCliente.Where(x => x.CajaID == caja.CajaID && x.EstadoCajaClienteID == 2);
         foreach (var item in cajaClientes)
         {
             cajaClienteService.AddCajaCliente(item.Cliente, entities);
         }
         entities.SaveChanges();
     }
 }
Example #2
0
 public void CreateCaja(Caja caja)
 {
     using (EPracticoDBEntities entities = new EPracticoDBEntities())
     {
         entities.Caja.Add(caja);
         entities.SaveChanges();
     }
 }
Example #3
0
        public void AttendCliente(int cajaID)
        {
            using (EPracticoDBEntities entities = new EPracticoDBEntities())
            {
                var cajaCliente = entities.CajaCliente.FirstOrDefault(x => x.CajaID == cajaID && x.EstadoCajaClienteID == 2);

                UpdateCajaCliente(cajaCliente);

                entities.SaveChanges();
            }
        }
Example #4
0
        public void CreateCliente(Cliente cliente)
        {
            if (cliente.ValidaCliente())
            {
                using (EPracticoDBEntities entities = new EPracticoDBEntities())
                {
                    entities.Cliente.Add(cliente);

                    entities.SaveChanges();
                }
            }
        }
Example #5
0
 public void CreateCajaCliente(Cliente cliente)
 {
     using (EPracticoDBEntities entities = new EPracticoDBEntities())
     {
         if (ExistCajaInCajaCliente(entities) || entities.CajaCliente.Any())
         {
             if (this.CajaID > 0)
             {
                 entities.CajaCliente.Add(new CajaCliente(this.CajaID, cliente.ClienteID));
             }
             else
             {
                 AddCajaCliente(cliente, entities);
             }
         }
         else
         {
             entities.CajaCliente.Add(new CajaCliente(entities.Caja.FirstOrDefault().CajaID, cliente.ClienteID));
         }
         entities.SaveChanges();
     }
 }