public CountAndAdjustStockForm GetDataIntoModel() { OptionsEntity oData = new OptionsEntity(); ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository(); oData = purchaseRepository.GetOptionSettings(); CountAndAdjustStockForm CSForm = new CountAndAdjustStockForm(); CSForm.CountAndAdjustStockDetails = new List <CountAndAdjustStockDetailsEntity>(); CountAndAdjustStockEntity model = new CountAndAdjustStockEntity(); model.StockCountNo = this.StockCountNo; model.StockDate = DateTime.ParseExact(this.StockDateStr, oData.DateFormat, null); if (IsIncreaseDecreaseStock == true) { model.StockType = Convert.ToByte(Stock_Type.IncreaseDecreaseStock); } if (IsStockDamaged == true) { model.StockType = Convert.ToByte(Stock_Type.StockDamaged); } if (IsStockTake == true) { model.StockType = Convert.ToByte(Stock_Type.StockTake); } CSForm.CountAndAdjustStock = model; foreach (var item in PSDetailsEntity.Where(e => e.CountQty != 0)) { if (item.SelectedPSID != 0) { CountAndAdjustStockDetailsEntity pqEntity = new CountAndAdjustStockDetailsEntity(); pqEntity.PSID = item.SelectedPSID; pqEntity.PandSCode = item.PandSCode; pqEntity.PandSName = item.PandSName; pqEntity.SystemQty = item.SystemQty; pqEntity.CountQty = item.CountQty; pqEntity.Difference = item.Difference; pqEntity.AvgCost = item.AvgCost; pqEntity.Amount = item.Amount; pqEntity.AdjustedAmount = Convert.ToDecimal(AdjustedAmountStr); pqEntity.AdjustedAmountStr = AdjustedAmountStr; if (item.SelectedPSID != 0 && Convert.ToInt32(item.SelectedPSID) > 0) { CSForm.CountAndAdjustStockDetails.Add(pqEntity); } } } return(CSForm); }
public CountAndAdjustStockForm GetDataIntoModel() { CountAndAdjustStockForm CSForm = new CountAndAdjustStockForm(); CSForm.CountAndAdjustStockDetails = new List <CountAndAdjustStockDetailsEntity>(); CountAndAdjustStockEntity model = new CountAndAdjustStockEntity(); model.StockCountNo = this.StockCountNo; model.StockDate = this.StockDate; if (IsIncreaseDecreaseStock == true) { model.StockType = Convert.ToByte(Stock_Type.IncreaseDecreaseStock); } if (IsStockDamaged == true) { model.StockType = Convert.ToByte(Stock_Type.StockDamaged); } if (IsStockTake == true) { model.StockType = Convert.ToByte(Stock_Type.StockTake); } CSForm.CountAndAdjustStock = model; foreach (var item in PSDetailsEntity) { if (item.SelectedPSID != 0) { CountAndAdjustStockDetailsEntity pqEntity = new CountAndAdjustStockDetailsEntity(); pqEntity.PSID = item.SelectedPSID; pqEntity.PandSCode = item.PandSCode; pqEntity.PandSName = item.PandSName; pqEntity.SystemQty = item.SystemQty; pqEntity.CountQty = item.CountQty; pqEntity.Difference = item.Difference; pqEntity.AvgCost = item.AvgCost; pqEntity.Amount = item.Amount; pqEntity.AdjustedAmount = Convert.ToDecimal(AdjustedAmountStr); pqEntity.AdjustedAmountStr = AdjustedAmountStr; if (item.SelectedPSID != 0 && Convert.ToInt32(item.SelectedPSID) > 0) { CSForm.CountAndAdjustStockDetails.Add(pqEntity); } } } return(CSForm); }