示例#1
0
        public void Transfer([FromForm] TransferRequest objTra)
        {
            SDES.GetKey();
            BStarTree <BranchProductRequest> .StartTree("BranchProduct",
                                                        new StringToObject(BranchProductRequest.StringToObject),
                                                        new ObjectToString(BranchProductRequest.ObjectToString));

            var ArrayA = BStarTree <BranchProductRequest> .Road(new BranchProductRequest { IdBranch = objTra.id1, IdProduct = objTra.idProduct }, 1);

            var ArrayB = BStarTree <BranchProductRequest> .Road(new BranchProductRequest { IdBranch = objTra.id2, IdProduct = objTra.idProduct }, 1);

            if (ArrayA.Count != 0 && ArrayA[0].Inventory - objTra.Quantity >= 0)
            {
                if (ArrayB.Count == 0)
                {
                    BStarTree <BranchProductRequest> .InsertTree(new BranchProductRequest { IdBranch = objTra.id2, IdProduct = objTra.idProduct, Inventory = objTra.Quantity });
                }
                else
                {
                    ArrayB[0].Inventory = ArrayB[0].Inventory + objTra.Quantity;
                    BStarTree <BranchProductRequest> .Modify(ArrayB[0], new string[2] {
                        ArrayB[0].Inventory.ToString(), ""
                    }, new Modify(BranchProductRequest.Update));
                }

                ArrayA[0].Inventory = ArrayA[0].Inventory - objTra.Quantity;
                BStarTree <BranchProductRequest> .Modify(ArrayA[0], new string[2] {
                    ArrayA[0].Inventory.ToString(), ""
                }, new Modify(BranchProductRequest.Update));
            }
        }
示例#2
0
        public void AddBranchOfficeProduct([FromForm] BranchProductRequest objBraPro)
        {
            BStarTree <BranchProductRequest> .StartTree("BranchProduct",
                                                        new StringToObject(BranchProductRequest.StringToObject),
                                                        new ObjectToString(BranchProductRequest.ObjectToString));

            SDES.GetKey();
            BStarTree <BranchProductRequest> .InsertTree(new BranchProductRequest { IdBranch = objBraPro.IdBranch, IdProduct = objBraPro.IdProduct, Inventory = objBraPro.Inventory });
        }
示例#3
0
        public void AddProducts([FromForm] IFormFile objcsv)
        {
            BStarTree <ProductRequest> .StartTree("Product",
                                                  new StringToObject(ProductRequest.StringToObject),
                                                  new ObjectToString(ProductRequest.ObjectToString));

            SDES.GetKey();
            ProductRequest.InsertCSV(objcsv.OpenReadStream());
        }
示例#4
0
        public void AddProduct([FromForm] ProductRequest objPro)
        {
            BStarTree <ProductRequest> .StartTree("Product",
                                                  new StringToObject(ProductRequest.StringToObject),
                                                  new ObjectToString(ProductRequest.ObjectToString));

            SDES.GetKey();
            BStarTree <ProductRequest> .InsertTree(new ProductRequest { ID = BStarTree <ProductRequest> .CreateId(), Name = objPro.Name, Price = objPro.Price });
        }
示例#5
0
        public void AddBranchOffice([FromForm] BranchOfficeRequest objBra)
        {
            BStarTree <BranchOfficeRequest> .StartTree("BranchOffice",
                                                       new StringToObject(BranchOfficeRequest.StringToObject),
                                                       new ObjectToString(BranchOfficeRequest.ObjectToString));

            SDES.GetKey();
            BStarTree <BranchOfficeRequest> .InsertTree(new BranchOfficeRequest { ID = BStarTree <BranchOfficeRequest> .CreateId(), Name = objBra.Name, Address = objBra.Address });
        }
示例#6
0
        public List <BranchProductRequest> BranchProductRequestShow(int idBra, int idPro)
        {
            BStarTree <BranchProductRequest> .StartTree("BranchProduct",
                                                        new StringToObject(BranchProductRequest.StringToObject),
                                                        new ObjectToString(BranchProductRequest.ObjectToString));

            SDES.GetKey();
            return(BStarTree <BranchProductRequest> .Road(new BranchProductRequest { IdBranch = idBra, IdProduct = idPro }, 1));
        }
示例#7
0
        public List <BranchOfficeRequest> OfficeShow(int id)
        {
            BStarTree <BranchOfficeRequest> .StartTree("BranchOffice",
                                                       new StringToObject(BranchOfficeRequest.StringToObject),
                                                       new ObjectToString(BranchOfficeRequest.ObjectToString));

            SDES.GetKey();
            return(BStarTree <BranchOfficeRequest> .Road(new BranchOfficeRequest { ID = id }, 1));
        }
示例#8
0
        public List <ProductRequest> ProductShow(int id)
        {
            BStarTree <ProductRequest> .StartTree("Product",
                                                  new StringToObject(ProductRequest.StringToObject),
                                                  new ObjectToString(ProductRequest.ObjectToString));

            SDES.GetKey();
            return(BStarTree <ProductRequest> .Road(new ProductRequest { ID = id }, 1));
        }
示例#9
0
        public List <BranchProductRequest> AllBranchProductRequest()
        {
            BStarTree <BranchProductRequest> .StartTree("BranchProduct",
                                                        new StringToObject(BranchProductRequest.StringToObject),
                                                        new ObjectToString(BranchProductRequest.ObjectToString));

            SDES.GetKey();
            return(BStarTree <BranchProductRequest> .Road(null));
        }
示例#10
0
        public void UpdateBranchOfficeProduct([FromForm] BranchProductRequest info)
        {
            SDES.GetKey();
            BStarTree <BranchProductRequest> .StartTree("BranchProduct", new StringToObject(BranchProductRequest.StringToObject), new ObjectToString(BranchProductRequest.ObjectToString));

            BStarTree <BranchProductRequest> .Modify(info, new string[2] {
                info.Inventory.ToString(), null
            }, new Modify(BranchProductRequest.Update));
        }
示例#11
0
        public void UpdateBranchOffice([FromForm] BranchOfficeRequest objBraOff)
        {
            SDES.GetKey();
            BStarTree <BranchOfficeRequest> .StartTree("BranchOffice",
                                                       new StringToObject(BranchOfficeRequest.StringToObject),
                                                       new ObjectToString(BranchOfficeRequest.ObjectToString));

            BStarTree <BranchOfficeRequest> .Modify(objBraOff, new string[2] {
                objBraOff.Name, objBraOff.Address
            }, new Modify(BranchOfficeRequest.Update));
        }
示例#12
0
        public void UpdateProduct([FromForm] ProductRequest objPro)
        {
            SDES.GetKey();
            BStarTree <ProductRequest> .StartTree("Product",
                                                  new StringToObject(ProductRequest.StringToObject),
                                                  new ObjectToString(ProductRequest.ObjectToString));

            BStarTree <ProductRequest> .Modify(objPro, new string[2] {
                objPro.Name, objPro.Price.ToString()
            }, new Modify(ProductRequest.Update));
        }