Ejemplo n.º 1
0
        public static bool EliminarProducto(Producto producto)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    var productoConsulta = dbContextScope.Producto.Where(x => x.Id == producto.Id).FirstOrDefault();
                    if (productoConsulta != null)
                    {
                        dbContextScope.Producto.Remove(productoConsulta);
                        dbContextScope.SaveChanges();
                        response = true;
                    }
                }
            }
            catch (Exception ex)
            {
                response = false;
                throw ex;
            }

            return(response);
        }
Ejemplo n.º 2
0
        public static bool EditarFacturaProducto(FacturaProducto facturaProducto)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    var facturaProductoConsulta = dbContextScope.FacturaProducto.Where(x => x.Id == facturaProducto.Id).FirstOrDefault();
                    if (facturaProductoConsulta != null)
                    {
                        FrammeworkTypeUtility.SetProperties(facturaProducto, facturaProductoConsulta);
                        dbContextScope.SaveChanges();
                        response = true;
                    }
                }
            }
            catch (Exception ex)
            {
                response = false;
                throw ex;
            }

            return(response);
        }
Ejemplo n.º 3
0
        public static bool EliminarFactura(Factura factura)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    var facturaConsulta = dbContextScope.Factura.Where(x => x.Id == factura.Id).FirstOrDefault();
                    if (facturaConsulta != null)
                    {
                        dbContextScope.Factura.Remove(facturaConsulta);
                        dbContextScope.SaveChanges();
                        response = true;
                    }
                }
            }
            catch (Exception ex)
            {
                response = false;
                throw ex;
            }

            return(response);
        }
Ejemplo n.º 4
0
        public static bool EliminarCliente(Cliente cliente)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    var clienteConsulta = dbContextScope.Cliente.Where(x => x.Id == cliente.Id).FirstOrDefault();
                    if (clienteConsulta != null)
                    {
                        dbContextScope.Cliente.Remove(clienteConsulta);
                        dbContextScope.SaveChanges();
                        response = true;
                    }
                }
            }
            catch (Exception ex)
            {
                response = false;
                throw ex;
            }

            return(response);
        }
Ejemplo n.º 5
0
 public static List <Producto> ObtenerProductos()
 {
     try
     {
         using (var dbContextScope = new DigitalWareEntities())
         {
             return(dbContextScope.Producto.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 6
0
 public static List <FacturaProductos> ObtenerFacturaProductos(int clienteId)
 {
     try
     {
         using (var dbContextScope = new DigitalWareEntities())
         {
             return(dbContextScope.ObtenerFacturaProductos(clienteId).ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 7
0
 public static List <Cliente> ObtenerClientes()
 {
     try
     {
         using (var dbContextScope = new DigitalWareEntities())
         {
             return(dbContextScope.Cliente.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 8
0
        public static bool CrearProducto(Producto producto)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    dbContextScope.Producto.Add(producto);
                    dbContextScope.SaveChanges();
                    response = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Ejemplo n.º 9
0
        public static bool CrearFactura(Factura factura)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    dbContextScope.Factura.Add(factura);
                    dbContextScope.SaveChanges();
                    response = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Ejemplo n.º 10
0
        public static bool CrearCliente(Cliente cliente)
        {
            bool response = false;

            try
            {
                using (var dbContextScope = new DigitalWareEntities())
                {
                    dbContextScope.Cliente.Add(cliente);
                    dbContextScope.SaveChanges();
                    response = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }