private void AddIntoBulk(ProductModel bulkProduct, CurrentRepackStockVm pack) { // txt_BulkCode.Text = Convert.ToString(bulkProduct.Id.Value); txt_Packed.Text = Convert.ToString(0); txt_AvailPack.Text = pack != null?Convert.ToString(pack.AvailStock) : Convert.ToString(currentStockofBulk); }
private void AddItemSource(ProductModel openingModel) { CurrentRepackStockVm pack = null; currentStockofBulk = OpeningStockController.GetCurrentStockByProductCode(openingModel.BulkCode.Value); selectedBulkProduct = controller.GetProductsById(UserModelVm.CompanyId, UserModelVm.BranchId, openingModel.BulkCode.Value); var SavedBulkData = controller.GetRepackByBulkId(0, null, openingModel.BulkCode.Value); if (SavedBulkData.Any()) { pack = GetCurrentStock(_products, SavedBulkData); } if (currentStockofBulk > 0) { RepackStockModel _openingStock = new RepackStockModel(); _openingStock.ProductName = openingModel.ItemName; _openingStock.productCode = Convert.ToInt64(openingModel.Id); //_openingStock.CurrentStock = OpeningStockController.GetCurrentStockByProductCode(Convert.ToInt64(openingModel.Id)); _openingStock.RetailPrice = openingModel.RetailPrice; _openingStock.Weight = openingModel.Weight; OpeningStocks[rowIndex] = _openingStock; lvProductDetails.ItemsSource = OpeningStocks; if (pack == null) { CalculateStock(null); } else { AddIntoBulk(selectedBulkProduct, pack); } txt_BulkName.Text = selectedBulkProduct.ItemName; txt_Weight.Text = Convert.ToString(selectedBulkProduct.Weight); txt_Cost.Text = Convert.ToString(selectedBulkProduct.TradePrice); txt_LatestSale.Text = Convert.ToString(selectedBulkProduct.RetailPrice); txt_CurrentStock.Text = pack != null?Convert.ToString(pack.CurrentStock) : Convert.ToString(currentStockofBulk); } else { // AddIntoBulk(selectedBulkProduct, pack); ErroMessage((string)Application.Current.Resources["repack_NoStockRemain_Error"], header); selectedBulkProduct = null; ClearFields(); // ConfirmationPopup form = new ConfirmationPopup("There is no stock for this", "Repack", false); // form.ShowDialog(); } }