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 OrderViewModel()
        {
            _request = new Request
                           {
                               Client = new Client(),
                               Mode = new Modes(),
                               OrderStatus = new OrderStatus(),
                               PaymentTerm = new PaymentTerm(),
                               RequestedDate = DateTime.Now

                           };
            _stockInformations = new Collection<StockInformation>();
            _approvedDetails = new Collection<ApprovedDetail>();
            _otherStockInformations = new Collection<Forcasting>();
            LoadOrderDetails();
        }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                _request = _requestService.FindSingle(_requestID);
                var stockInformation = _stockInformationRepository.GetStockInformationByOrderID(_requestID);
                var otherStockInformation = _forcastingRepository.GetForcastingByOrderID(_requestID);
                var approvedDetail = _stockInformationRepository.GetApprovedDetail(_requestID);
                var order = new OrderViewModel(_request, stockInformation,approvedDetail,otherStockInformation,consumptionSetting);

                _order = order;
            }
            catch (Exception)
            {
                _backgroundWorker.CancelAsync();
               //CachingHelper.ClearCaching();
            }
        }
 public bool Validate(Request request)
 {
     return CheckApprovedQuantity(request.RequestDetails) && CheckActivitySelect(request.RequestDetails) && CheckSplit(request.RequestDetails)  ;
 }