Ejemplo n.º 1
0
        public void Add([FromForm] ProductData info)
        {
            ArbolB <ProductData> .IniciarArbol("Product", new StringToObject(ProductData.StringToObject), new ObjectToString(ProductData.ObjectToString));

            SDES.obtainKey();
            ArbolB <ProductData> .InsertarArbol(new ProductData { ID = ArbolB <ProductData> .newID(), Name = info.Name, Price = info.Price });
        }
Ejemplo n.º 2
0
        public List <OfficeProduct> OfficeProductShow([FromForm] int idOffice, [FromForm] int idProduct)
        {
            ArbolB <OfficeProduct> .IniciarArbol("OfficeProduct", new StringToObject(OfficeProduct.StringToObject), new ObjectToString(OfficeProduct.ObjectToString));

            SDES.obtainKey();
            return(ArbolB <OfficeProduct> .Recorrido(new OfficeProduct { IdOffice = idOffice, IdProduct = idProduct }, 1));
        }
Ejemplo n.º 3
0
        public void Add([FromForm] OfficeData info)
        {
            ArbolB <OfficeData> .IniciarArbol("Office", new StringToObject(OfficeData.StringToObject), new ObjectToString(OfficeData.ObjectToString));

            SDES.obtainKey();
            ArbolB <OfficeData> .InsertarArbol(new OfficeData { ID = ArbolB <OfficeData> .newID(), Name = info.Name, Address = info.Address });
        }
Ejemplo n.º 4
0
        public List <ProductData> ProductShow([FromForm] int id)
        {
            ArbolB <ProductData> .IniciarArbol("Product", new StringToObject(ProductData.StringToObject), new ObjectToString(ProductData.ObjectToString));

            SDES.obtainKey();
            return(ArbolB <ProductData> .Recorrido(new ProductData { ID = id }, 1));
        }
Ejemplo n.º 5
0
        public List <OfficeData> OfficeShow([FromForm] int id)
        {
            ArbolB <OfficeData> .IniciarArbol("Office", new StringToObject(OfficeData.StringToObject), new ObjectToString(OfficeData.ObjectToString));

            SDES.obtainKey();
            return(ArbolB <OfficeData> .Recorrido(new OfficeData { ID = id }, 1));
        }
Ejemplo n.º 6
0
        public List <ProductData> AllProduct()
        {
            ArbolB <ProductData> .IniciarArbol("Product", new StringToObject(ProductData.StringToObject), new ObjectToString(ProductData.ObjectToString));

            SDES.obtainKey();
            return(ArbolB <ProductData> .Recorrido(null));
        }
Ejemplo n.º 7
0
        public List <OfficeProduct> AllOfficeProduct()
        {
            ArbolB <OfficeProduct> .IniciarArbol("OfficeProduct", new StringToObject(OfficeProduct.StringToObject), new ObjectToString(OfficeProduct.ObjectToString));

            SDES.obtainKey();
            return(ArbolB <OfficeProduct> .Recorrido(null));
        }
Ejemplo n.º 8
0
        public void Add([FromForm] OfficeProduct info)
        {
            ArbolB <OfficeProduct> .IniciarArbol("OfficeProduct", new StringToObject(OfficeProduct.StringToObject), new ObjectToString(OfficeProduct.ObjectToString));

            SDES.obtainKey();
            ArbolB <OfficeProduct> .InsertarArbol(new OfficeProduct { IdOffice = info.IdOffice, IdProduct = info.IdProduct, Inventory = info.Inventory });
        }
Ejemplo n.º 9
0
        public void transfer([FromForm] int idProduct, [FromForm] int idO1, [FromForm] int idO2, [FromForm] int cant)
        {
            SDES.obtainKey();
            ArbolB <OfficeProduct> .IniciarArbol("OfficeProduct", new StringToObject(OfficeProduct.StringToObject), new ObjectToString(OfficeProduct.ObjectToString));

            var data1 = ArbolB <OfficeProduct> .Recorrido(new OfficeProduct { IdOffice = idO1, IdProduct = idProduct }, 1);

            var data2 = ArbolB <OfficeProduct> .Recorrido(new OfficeProduct { IdOffice = idO2, IdProduct = idProduct }, 1);

            if (data1.Count != 0 && data1[0].Inventory - cant >= 0)
            {
                if (data2.Count == 0)
                {
                    ArbolB <OfficeProduct> .InsertarArbol(new OfficeProduct { IdOffice = idO2, IdProduct = idProduct, Inventory = cant });
                }
                else
                {
                    data2[0].Inventory = data2[0].Inventory + cant;
                    ArbolB <OfficeProduct> .Modificar(data2[0], new string[2] {
                        data2[0].Inventory.ToString(), string.Empty
                    }, new Modify(OfficeProduct.Alter));
                }
                data1[0].Inventory = data1[0].Inventory - cant;
                ArbolB <OfficeProduct> .Modificar(data1[0], new string[2] {
                    data1[0].Inventory.ToString(), string.Empty
                }, new Modify(OfficeProduct.Alter));
            }
        }
Ejemplo n.º 10
0
        public void Add([FromForm] IFormFile info)
        {
            ArbolB <ProductData> .IniciarArbol("Product", new StringToObject(ProductData.StringToObject), new ObjectToString(ProductData.ObjectToString));

            SDES.obtainKey();
            ProductData.InsertCSV(info.OpenReadStream());
        }
Ejemplo n.º 11
0
        public void Alter([FromForm] OfficeProduct info)
        {
            SDES.obtainKey();
            ArbolB <OfficeProduct> .IniciarArbol("OfficeProduct", new StringToObject(OfficeProduct.StringToObject), new ObjectToString(OfficeProduct.ObjectToString));

            ArbolB <OfficeProduct> .Modificar(info, new string[2] {
                info.Inventory.ToString(), null
            }, new Modify(OfficeProduct.Alter));
        }
Ejemplo n.º 12
0
        public void Alter([FromForm] string Name, [FromForm] int id)
        {
            SDES.obtainKey();
            ArbolB <ProductData> .IniciarArbol("Product", new StringToObject(ProductData.StringToObject), new ObjectToString(ProductData.ObjectToString));

            ArbolB <ProductData> .Modificar(new ProductData { ID = id }, new string[2] {
                Name, null
            }, new Modify(ProductData.Alter));
        }
Ejemplo n.º 13
0
        public void Alter([FromForm] ProductData info)
        {
            SDES.obtainKey();
            ArbolB <ProductData> .IniciarArbol("Product", new StringToObject(ProductData.StringToObject), new ObjectToString(ProductData.ObjectToString));

            ArbolB <ProductData> .Modificar(info, new string[2] {
                info.Name, info.Price.ToString()
            }, new Modify(ProductData.Alter));
        }
Ejemplo n.º 14
0
        public void Alter([FromForm] OfficeData info)
        {
            SDES.obtainKey();
            ArbolB <OfficeData> .IniciarArbol("Office", new StringToObject(OfficeData.StringToObject), new ObjectToString(OfficeData.ObjectToString));

            ArbolB <OfficeData> .Modificar(info,
                                           new string[2] {
                info.Name, info.Address
            },
                                           new Modify(OfficeData.Alter));
        }