/// <summary> /// Adds the searched product(by id) to the closest empty row in the purchase order content list /// </summary> public void AddProductToPurchaseOrderContent_BySearchedId(int closestEmptyRowIndex, List <PurchaseOrderDetails_Join> PurchaseOrderContentList, int taxId, ProductModel productToAdd) { PurchaseOrderContentList[closestEmptyRowIndex] = new PurchaseOrderDetails_Join { ProductId = productToAdd.Id, ProductName = productToAdd.Name, Quantity = 1, TaxId = taxId }; }
/// <summary> /// Creates a purchase OrderProductModel and adds it to the database /// </summary> public void CreatePurchaseOrderProuct(int orderId, PurchaseOrderDetails_Join row) { OrderProductModel op = new OrderProductModel { OrderId = orderId, ProductId = row.ProductId, ProductName = row.ProductName, OrderedQuantity = row.Quantity, TaxId = row.TaxId }; GlobalConfig.Connection.Create_PO_Product(op); }
/// <summary> /// Creates a purchase price for the product on the "row" recieved as a parameter /// </summary> public void CreatePurchaseOrderPrice(int orderId, int rowIndex, PurchaseOrderDetails_Join row, DateTime documentPostingDate) { PurchasePriceModel purchasePrice = new PurchasePriceModel() { ProductId = row.ProductId, PurchasePrice = row.PurchasePrice, PurchaseDate = documentPostingDate.Date, PurchaseOrderId = orderId, RowIndex = rowIndex, TaxId = row.TaxId }; GlobalConfig.Connection.CreatePurchasePrice(purchasePrice); }
/// <summary> /// Adds the searched(by name) product to the closest empty row in the purchase order content list /// </summary> public void AddProductToPurchaseOrderContent_BySearchedName(string productName, int closestEmptyRowIndex, List <ProductModel> ProductsList, List <PurchaseOrderDetails_Join> PurchaseOrderContentList, int taxId) { if (RMS_Logic.PurchasingLogic.SearchProductByName(productName, ProductsList).Count() == 1) { ProductModel productToAdd = RMS_Logic.PurchasingLogic.SearchProductByName(productName, ProductsList).First(); PurchaseOrderContentList[closestEmptyRowIndex] = new PurchaseOrderDetails_Join { ProductId = productToAdd.Id, ProductName = productToAdd.Name, Quantity = 1, TaxId = taxId // ((TaxModel)ProductTaxComboBox.SelectedItem).Id }; } }