Exemplo n.º 1
0
        public static bool Eliminar(FacturaDetalles detalle)
        {
            using (var conexion = new DigitalServicesDB())
            {
                try
                {
                    var item = BLL.ItemsBLL.Buscar(detalle.IdItem);
                    int cant = detalle.Cantidad;

                    conexion.Entry(detalle).State = EntityState.Deleted;
                    if (conexion.SaveChanges() > 0)
                    {
                        if (item.EsArticulo == 1)
                        {
                            item.Existencia = item.Existencia + cant;
                            return(BLL.ItemsBLL.Modificar(item));
                        }
                        return(true);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 public static bool Guardar(FacturaDetalles detalle)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.FaturaDetalle.Add(detalle);
             if (conexion.SaveChanges() > 0)
             {
                 var item = BLL.ItemsBLL.Buscar(detalle.IdItem);
                 if (item.EsArticulo == 1)
                 {
                     item.Existencia = item.Existencia - detalle.Cantidad;
                     return(BLL.ItemsBLL.Modificar(item));
                 }
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 3
0
 public static bool Modificar(FacturaDetalles detalle)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             if (Buscar(detalle.Id) != null)
             {
                 conexion.Entry(detalle).State = EntityState.Modified;
                 if (conexion.SaveChanges() > 0)
                 {
                     return(true);
                 }
             }
             else
             {
                 return(Guardar(detalle));
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 public static bool Eliminar(Clientes cliente)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.Entry(cliente).State = EntityState.Deleted;
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 public static bool Guardar(Clientes cliente)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.Cliente.Add(cliente);
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 6
0
 public static bool Guardar(Items item)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.Items.Add(item);
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 7
0
 public static bool Modificar(Items item)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.Entry(item).State = System.Data.Entity.EntityState.Modified;
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 8
0
 public static bool Modificar(Usuarios usuario)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.Entry(usuario).State = EntityState.Modified;
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 9
0
 public static bool ModificarEncabezado(int?facturaId)
 {
     using (var conexion = new DigitalServicesDB())
     {
         try
         {
             conexion.Entry(BuscarEncabezado(facturaId)).State = EntityState.Modified;
             if (conexion.SaveChanges() > 0)
             {
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Exemplo n.º 10
0
        public static bool Eliminar(EncabezadoDetalle factura)
        {
            bool resultado = false;

            using (var conexion = new DigitalServicesDB())
            {
                try
                {
                    if (BLL.FacturaDetalleBLL.Eliminar(factura.Detalle))
                    {
                        conexion.Entry(factura.Encabezado).State = EntityState.Deleted;
                        resultado = conexion.SaveChanges() > 0;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Exemplo n.º 11
0
        public static bool Modificar(EncabezadoDetalle factura)
        {
            bool resultado = false;

            using (var conexion = new DigitalServicesDB())
            {
                try
                {
                    conexion.Entry(factura.Encabezado).State = EntityState.Modified;
                    if (conexion.SaveChanges() > 0)
                    {
                        resultado = FacturaDetalleBLL.Modificar(factura.Detalle);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
Exemplo n.º 12
0
        public static bool Guardar(EncabezadoDetalle factura)
        {
            bool resultado = false;

            using (var conexion = new DigitalServicesDB())
            {
                try
                {
                    conexion.Factura.Add(factura.Encabezado);
                    if (conexion.SaveChanges() > 0)
                    {
                        resultado = BLL.FacturaDetalleBLL.Guardar(factura.Detalle);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }