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)); } }
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 }); }
public void AddProducts([FromForm] IFormFile objcsv) { BStarTree <ProductRequest> .StartTree("Product", new StringToObject(ProductRequest.StringToObject), new ObjectToString(ProductRequest.ObjectToString)); SDES.GetKey(); ProductRequest.InsertCSV(objcsv.OpenReadStream()); }
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 }); }
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 }); }
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)); }
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)); }
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)); }
public List <BranchProductRequest> AllBranchProductRequest() { BStarTree <BranchProductRequest> .StartTree("BranchProduct", new StringToObject(BranchProductRequest.StringToObject), new ObjectToString(BranchProductRequest.ObjectToString)); SDES.GetKey(); return(BStarTree <BranchProductRequest> .Road(null)); }
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)); }
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)); }
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)); }