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 ICollection<Forcasting> GetForcastingByOrderID(int orderId)
        {
            var orderDetail = new BLL.OrderDetail();
            var ForcastingTable = orderDetail.LoadForcastingByOrderID(orderId).DefaultView;
            ICollection<Forcasting> Forcastings = new Collection<Forcasting>();

            foreach (DataRowView ForcastingRow in ForcastingTable)
            {
                var itemID = Convert.ToInt32(ForcastingRow["ItemID"]);
                var unitID = Convert.ToInt32(ForcastingRow["UnitID"]);

                var Forcasting = new Forcasting
                                               {
                                                   Item = _itemRepository.FindSingle(Convert.ToInt32(itemID)),
                                                   Unit = _unitOfIssueRepository.FindSingle(Convert.ToInt32(unitID)),
                                                   TotalIssued = Convert.ToDecimal(ForcastingRow["TotalIssued"]),
                                                   Dos = Convert.ToDecimal(ForcastingRow["DOS"]),
                                                   FiscalYearDays = Convert.ToInt32(ForcastingRow["FiscalYearDays"])
                                               };
                Forcastings.Add(Forcasting);

            }
            return Forcastings;
        }