コード例 #1
0
 /// <summary>
 /// Loads the builders or carriers that made sells on a specific day from the database
 /// </summary>
 /// <param name="dia">
 /// DateTime, a specific day to search in the database
 /// </param>
 /// <returns>
 /// List of builders or carriers that made sells on a specific day
 /// </returns>
 public List <string> CargarPSEmpleadosDia(DateTime dia)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <string>("sp_sps_dia @p0", dia).ToList());
     }
 }
コード例 #2
0
        /// <summary>
        /// Loads the list of services bought by the clients from the database
        /// </summary>
        /// <returns>
        /// List of services bought by the clients
        /// </returns>
        public List <PedidoClienteServicioE> CargarPedidoClienteServicio()
        {
            try
            {
                List <PedidoClienteServicioE> pedidos = new List <PedidoClienteServicioE>();
                using (FerreteriaEntities db = new FerreteriaEntities())
                {
                    var lst = from pcs in db.v_spedido_cliente_servicio.ToList()
                              select new PedidoClienteServicioE
                    {
                        Id          = pcs.id,
                        IdPedido    = pcs.id_pedido_cliente,
                        IdVenta     = pcs.id_servicio,
                        Cantidad    = pcs.cantidad,
                        PrecioTotal = pcs.precio_total
                    };

                    foreach (PedidoClienteServicioE i in lst)
                    {
                        pedidos.Add(new PedidoClienteServicioE(i.Id, i.IdPedido, i.IdVenta,
                                                               i.Cantidad, i.PrecioTotal));
                    }
                }
                return(pedidos);
            }
            catch (Exception)
            {
                throw new Exception("Error al cargar la lista de servicios");
            }
        }
コード例 #3
0
 /// <summary>
 /// Loads the money obtained from the sells and the taxes that have to be paid from the database
 /// </summary>
 /// <returns>
 /// List of money obtained from the sells and the taxes that have to be paid
 /// </returns>
 public List <Reporte7E> CargarCantidadSPCLCostos()
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <Reporte7E>("SELECT * FROM v_spcl_costos").ToList());
     }
 }
コード例 #4
0
 /// <summary>
 /// Loads the number of services bought by the clients grouped by their category from the database
 /// </summary>
 /// <returns>
 /// List of services bought by the clients grouped by their category
 /// </returns>
 public List <Reporte2E> CargarCantidadPClSCategoria()
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <Reporte2E>("SELECT * FROM v_scantidad_pcls_categoria").ToList());
     }
 }
コード例 #5
0
 /// <summary>
 /// Loads the number of sells made by the sellers from the database
 /// </summary>
 /// <returns>
 /// List of sells made by the sellers
 /// </returns>
 public List <Reporte4E> CargarCantidadPCOVendedor()
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <Reporte4E>("SELECT * FROM v_scantidad_pco_vendedor").ToList());
     }
 }
コード例 #6
0
 public List <string> CargarCategoriaProducto()
 {
     using (var i = new FerreteriaEntities())
     {
         return(i.Database.SqlQuery <string>("SELECT * FROM v_categoria_producto").ToList());
     }
 }
コード例 #7
0
 /// <summary>
 /// Loads the number of sells made by the builders or carriers from the database
 /// </summary>
 /// <returns>
 /// List of sells made by the builders or carriers
 /// </returns>
 public List <Reporte4E> CargarCantidadPSSConstructorConductor()
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <Reporte4E>("SELECT * FROM v_scantidad_pss_constructor_conductor").ToList());
     }
 }
コード例 #8
0
 /// <summary>
 /// Loads the clientes that bought something from the database
 /// </summary>
 /// <returns>
 /// List of clientes that bought something
 /// </returns>
 public List <int> CargarCantidadPCLCliente()
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <int>("SELECT * FROM v_scantidad_pcl_cliente").ToList());
     }
 }
コード例 #9
0
 /// <summary>
 /// Loads the services bought by the clients on a specific day from the database
 /// </summary>
 /// <param name="dia">
 /// DateTime, a specific day to search in the database
 /// </param>
 /// <returns>
 /// List of services bought by the clients on a specific day
 /// </returns>
 public List <string> CargarPCLServiciosDia(DateTime dia)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.SqlQuery <string>("sp_spcl_servicio_dia @p0", dia).ToList());
     }
 }
コード例 #10
0
 /// <summary>
 /// Updates an order selected by the cashier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoCliente
 /// </param>
 /// <returns>
 /// True if the order is updated
 /// </returns>
 public bool GuardarPedidoClienteFactura(PedidoClienteE pc)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_upedido_cliente_factura @p0, @p1, @p2, @p3",
                                              pc.Id, pc.FechaFactura, pc.CodigoCajero, pc.PagaSoloProducto) > 0);
     }
 }
コード例 #11
0
 /// <summary>
 /// Updates an order selected by the cashier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoSoloServicio
 /// </param>
 /// <returns>
 /// True if the order is updated
 /// </returns>
 public bool GuardarPedidoSoloServicioFactura(PedidoSoloServicioE pss)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_upedido_solo_servicio_factura @p0, @p1, @p2",
                                              pss.Id, pss.FechaFactura, pss.CodigoCajero) > 0);
     }
 }
コード例 #12
0
 /// <summary>
 /// Updates an order selected by the carrier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoSoloServicio
 /// </param>
 /// <returns>
 /// True if the order is updated
 /// </returns>
 public bool GuardarPedidoSoloServicioTransporte(PedidoSoloServicioE pss)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_upedido_solo_servicio_transporte @p0, @p1, @p2, @p3",
                                              pss.Id, pss.CodigoConductor, pss.HoraIniciaTransporte, pss.HoraFinalizaTransporte) > 0);
     }
 }
コード例 #13
0
 /// <summary>
 /// Updates an order selected by the builder or the carrier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoSoloServicio
 /// </param>
 /// <returns>
 /// True if the order is updated
 /// </returns>
 public bool GuardarPedidoSoloServicioBodega(PedidoSoloServicioE pss)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_upedido_solo_servicio_bodega @p0, @p1, @p2",
                                              pss.Id, pss.HoraRecibidoBodega, pss.HoraSalidaBodega) > 0);
     }
 }
コード例 #14
0
 /// <summary>
 /// Saves the products sold by the seller on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoCompletoProducto
 /// </param>
 /// <returns>
 /// True if the products sold are saved
 /// </returns>
 public bool GuardarPedidoCompletoProducto(PedidoCompletoProductoE pcp)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_completo_producto @p0, @p1, @p2, @p3",
                                              pcp.IdPedido, pcp.IdVenta, pcp.Cantidad, pcp.PrecioTotal) > 0);
     }
 }
コード例 #15
0
 /// <summary>
 /// Updates an order selected by the carrier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoCliente
 /// </param>
 /// <returns>
 /// True if the order is updated
 /// </returns>
 public bool GuardarPedidoClienteTransporte(PedidoClienteE pc)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_upedido_cliente_transporte @p0, @p1, @p2, @p3",
                                              pc.Id, pc.CodigoConductor, pc.HoraIniciaTransporte, pc.HoraFinalizaTransporte) > 0);
     }
 }
コード例 #16
0
 /// <summary>
 /// Updates an order selected by the builder or the carrier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoCompleto
 /// </param>
 /// <returns>
 /// True if the order is updated
 /// </returns>
 public bool GuardarPedidoCompletoBodega(PedidoCompletoE pc)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_upedido_completo_bodega @p0, @p1, @p2",
                                              pc.Id, pc.HoraRecibidoBodega, pc.HoraSalidaBodega) > 0);
     }
 }
コード例 #17
0
 /// <summary>
 /// Saves the services bought by the clients on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoClienteServicio
 /// </param>
 /// <returns>
 /// True if the services bought are saved
 /// </returns>
 public bool GuardarPedidoClienteServicio(PedidoClienteServicioE pcs)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_cliente_servicio @p0, @p1, @p2, @p3",
                                              pcs.IdPedido, pcs.IdVenta, pcs.Cantidad, pcs.PrecioTotal) > 0);
     }
 }
コード例 #18
0
 /// <summary>
 /// Saves a new order made by the builder or the carrier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoSoloServicio
 /// </param>
 /// <returns>
 /// True if the order is saved
 /// </returns>
 public bool GuardarPedidoSoloServicioConstructor(PedidoSoloServicioE pss)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_solo_servicio_constructor @p0, @p1, @p2, @p3, @p4, @p5",
                                              pss.CedulaCliente, pss.CodigoUsuario, pss.Observaciones,
                                              pss.SubTotal, pss.IVA, pss.Total) > 0);
     }
 }
コード例 #19
0
 /// <summary>
 /// Saves a new order made by the client on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoCliente
 /// </param>
 /// <returns>
 /// True if the order is saved
 /// </returns>
 public bool GuardarPedidoClienteCliente(PedidoClienteE pc)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_cliente_cliente @p0, @p1, @p2, @p3, @p4, @p5",
                                              pc.CedulaCliente, pc.NombreCliente, pc.Fecha,
                                              pc.SubTotal, pc.IVA, pc.Total) > 0);
     }
 }
コード例 #20
0
 /// <summary>
 /// Saves a new order made by the seller on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoCompleto
 /// </param>
 /// <returns>
 /// True if the order is saved
 /// </returns>
 public bool GuardarPedidoCompletoVendedor(PedidoCompletoE pc)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_completo_vendedor @p0, @p1, @p2, @p3, @p4, @p5, @p6",
                                              pc.CodigoVendedor, pc.CedulaCliente, pc.HoraAtencion, pc.HoraVenta,
                                              pc.SubTotal, pc.IVA, pc.Total) > 0);
     }
 }
コード例 #21
0
        /*
         * This method receives the id of a Service in the parameters. Data base find this service with the id and
         * delete the register
         */

        public void EliminarServicio(int id)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                servicio servi;
                servi                 = db.servicio.Find(id);
                servi.activo          = false;
                db.Entry(servi).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
コード例 #22
0
        /*
         * This method receives the id of a Transport in the parameters. Data base find this transport with the id and
         * delete the register
         */

        public void EliminarTransporte(int id)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                transporte trans;
                trans                 = db.transporte.Find(id);
                trans.activo          = false;
                db.Entry(trans).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
コード例 #23
0
        /*
         * This method receives the id of a Product in the parameters. Data base find this product with the id and
         * delete the register
         */

        public void EliminarProducto(int id)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                producto producto;
                producto                 = db.producto.Find(id);
                producto.activo          = false;
                db.Entry(producto).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
コード例 #24
0
        /*
         * This method receives all the information of a Transport in the parameters. This information is saved on an object of type
         * transporte. After that the object is saved in the data base
         */

        public void RegistrarTransporte(string numeroVehiculo, string idConductor, Boolean estado)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                transporte transporte = new transporte();
                transporte.numero_vehiculo  = numeroVehiculo;
                transporte.codigo_conductor = idConductor;
                transporte.disponible       = estado;
                transporte.activo           = true;
                db.transporte.Add(transporte);
                db.SaveChanges();
            }
        }
コード例 #25
0
        /*
         * This method receives all the information of a user in the parameters. This information is saved on an object of type
         * usuario. After that the object is saved in the data base
         */

        public void registrarUsuarios(string codigo, string nombre, string contra, string cedula, string tipo)
        {
            using (FerreteriaEntities db = new FerreteriaEntities()) {
                usuario usuario = new usuario();
                usuario.codigo     = codigo;
                usuario.nombre     = nombre;
                usuario.contrasena = contra;
                usuario.cedula     = cedula;
                usuario.tipo       = tipo;
                db.usuario.Add(usuario);
                db.SaveChanges();
            }
        }
コード例 #26
0
        /*
         * This method receives all the information of a Service in the parameters. This information is saved on an object of type
         * servicio. After that the object is saved in the data base
         */

        public void RegistrarServicio(string nombre, string categoria, string descripcion, decimal precio)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                servicio servicio = new servicio();
                servicio.nombre      = nombre;
                servicio.categoria   = categoria;
                servicio.descripcion = descripcion;
                servicio.precio      = precio;
                servicio.activo      = true;
                db.servicio.Add(servicio);
                db.SaveChanges();
            }
        }
コード例 #27
0
        /*
         * This method receives all the information of a Product in the parameters. This information is saved on an object of type
         * producto. After that the object is saved in the data base
         */

        public void RegistrarProducto(string nombre, string categoria, string descripcion, decimal precio, decimal cantidad)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                producto producto = new producto();
                producto.nombre      = nombre;
                producto.categoria   = categoria;
                producto.descripcion = descripcion;
                producto.precio      = precio;
                producto.cantidad    = cantidad;
                producto.activo      = true;
                db.producto.Add(producto);
                db.SaveChanges();
            }
        }
コード例 #28
0
        /*
         * This method receives all the information of a Transport in the parameters. Data base find this transport with the id and
         * edit the necessary information
         */

        public void EditarTransporte(string numeroVehiculo, string idConductor, Boolean estado, bool activo, int id)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                transporte trans = null;

                trans = db.transporte.Find(id);
                trans.numero_vehiculo  = numeroVehiculo;
                trans.codigo_conductor = idConductor;
                trans.disponible       = estado;
                trans.activo           = activo;
                db.Entry(trans).State  = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
コード例 #29
0
        /*
         * This method receives all the information of a Service in the parameters. Data base find this service with the id and
         * edit the necessary information
         */

        public void EditarServicio(string nombre, string categoria, string descripcion, decimal precio, bool activo, int id)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                servicio servi = null;

                servi                 = db.servicio.Find(id);
                servi.nombre          = nombre;
                servi.categoria       = categoria;
                servi.descripcion     = descripcion;
                servi.precio          = precio;
                servi.activo          = activo;
                db.Entry(servi).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
コード例 #30
0
        /*
         * This method receives all the information of a Product in the parameters. Data base find this product with the id and
         * edit the necessary information
         */

        public void EditarProducto(string nombre, string categoria, string descripcion, decimal precio, decimal cantidad, bool activo, int id)
        {
            using (FerreteriaEntities db = new FerreteriaEntities())
            {
                producto producto = null;

                producto                 = db.producto.Find(id);
                producto.nombre          = nombre;
                producto.categoria       = categoria;
                producto.descripcion     = descripcion;
                producto.precio          = precio;
                producto.cantidad        = cantidad;
                producto.activo          = activo;
                db.Entry(producto).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }