public OrderDetailViewModel(RequestDetail requestDetail, ICollection <StockInformation> stockInformations, ICollection <ApprovedDetail> approvedDetails, Forcasting forcasting, ConsumptionSetting consumptionSetting) { _requestDetail = requestDetail; _stockInformations = stockInformations; _approvedDetails = approvedDetails; _forcasting = forcasting; _consumptionSetting = consumptionSetting; _hasManyActivity = getActivityViewModels().Count > 2; _hasManyManufacturer = getManufacturerViewModels().Count > 2; _hasExpiryDatePreference = getExpiryDateViewModels().Count > 2; _hasPhysicalStorePreference = getPhysicalStoreViewModels().Count > 2; _allowAdd = _hasManyActivity || _hasManyManufacturer || _hasExpiryDatePreference || _hasPhysicalStorePreference; _allowRemove = RequestedQuantity == 0; if (_requestDetail.ActivityGroup == null) { var stockInformation = _stockInformations.OrderBy(s => s.ExpiryDate).FirstOrDefault(); if (stockInformation != null) { _requestDetail.ActivityGroup = stockInformation.Activity; } } if (_requestDetail.IsFirstLoad) { if (_requestDetail.RequestedQuantity >= AvailableQuantity) { _requestDetail.ApprovedQuantity = AvailableQuantity; } } }
public void Initialize() { LoadActivity(); LoadManufacturer(); LoadPhysicalStore(); consumptionSetting = _consumptionRepository.FindCurrentSetting(); requestBindingSource.DataSource = new OrderViewModel(); }
public OrderViewModel(Request request, ICollection <StockInformation> stockInformations, ICollection <ApprovedDetail> approvedDetails, ICollection <Forcasting> otherStockInformations, ConsumptionSetting consumptionSetting) { _request = request; _stockInformations = stockInformations; _approvedDetails = approvedDetails; _otherStockInformations = otherStockInformations; _consumptionSetting = consumptionSetting; _consumptionSettingViewModel = new ConsumptionSettingViewModel(consumptionSetting); LoadOrderDetails(); if (BLL.Settings.AllowPreferedPhysicalStoreForAllItemsOnApproval) { LoadDistinctPhysicalStores(); } }
public ConsumptionSettingViewModel(ConsumptionSetting consumptionSetting) { _consumptionSetting = consumptionSetting; }