Пример #1
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();
            }
        }
Пример #2
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();
            }
        }
        /*
         * 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();
            }
        }
        /*
         * 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();
            }
        }
Пример #5
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();
            }
        }
        /*
         * 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();
            }
        }
Пример #7
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();
            }
        }
Пример #8
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();
            }
        }
        /*
         * 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();
            }
        }
Пример #10
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();
            }
        }