public ShoppingInputParameterViewModel Build()
        {
            DateTime startDate;
            DateTime endDate;
            var totalDistributionCount = 0;
            var period = Convert.ToInt32(EnvironmentSettings.GetConfigSectionValues("Shopping")["Period"]);
            GetShoppingStartAndEndDates(
                ref period, out startDate, out endDate, ref totalDistributionCount);

            var numberOfActiveMachines = this.GetShoppingNoOfActiveMachines(startDate, endDate);
            var advertCount = numberOfActiveMachines * 0.0005;
            var threshold = advertCount < 1 ? 1 : Math.Round(advertCount, 0);
            var exclusionFilter = ExclusionFilters();
            var excludedPackages = new List<string>();
            var includedPackages = new List<string>();
            GetInclusionsAndExclusions(exclusionFilter, includedPackages, excludedPackages);

            Exclusions.ExclusionFilter = (string)EnvironmentSettings.GetConfigSectionValues("Shopping")["ShoppingDefaultExclusions"];

            var shoppingInputParameterViewModel = new ShoppingInputParameterViewModel
                {

                    ExcludedPackages = excludedPackages,
                    ExclusionFilter = exclusionFilter,
                    IncludedPackages = includedPackages,
                    NumberOfActiveMachines = numberOfActiveMachines,
                    Period = period,
                    ShopEndDate = endDate,
                    ShopStartDate = startDate,
                    Threshold = (int)threshold,
                    TotalDistributionCount = totalDistributionCount
                };

            return shoppingInputParameterViewModel;
        }
 public ShoppingAnalysisModel(ShoppingInputParameterViewModel shoppingInputModel, CommonInputParameterViewModel common)
 {
     this.shoppingInputModel = shoppingInputModel;
     this.connectionString =
         Repository.BuildConnectionString(
             EnvironmentSettings.GetInstance().DatabaseConnectionString,
             common.FileName.Replace(".zip", string.Empty));
 }
 public ShoppingAnalysisModel(ShoppingInputParameterViewModel shoppingInputModel, CommonInputParameterViewModel common)
 {
     this.shoppingInputModel = shoppingInputModel;
     this.connectionString   =
         Repository.BuildConnectionString(
             EnvironmentSettings.GetInstance().DatabaseConnectionString,
             common.FileName.Replace(".zip", string.Empty));
 }
        public ShoppingInputParameterViewModel Build()
        {
            DateTime startDate;
            DateTime endDate;
            var      totalDistributionCount = 0;
            var      period = Convert.ToInt32(EnvironmentSettings.GetConfigSectionValues("Shopping")["Period"]);

            GetShoppingStartAndEndDates(
                ref period, out startDate, out endDate, ref totalDistributionCount);

            var numberOfActiveMachines = this.GetShoppingNoOfActiveMachines(startDate, endDate);
            var advertCount            = numberOfActiveMachines * 0.0005;
            var threshold        = advertCount < 1 ? 1 : Math.Round(advertCount, 0);
            var exclusionFilter  = ExclusionFilters();
            var excludedPackages = new List <string>();
            var includedPackages = new List <string>();

            GetInclusionsAndExclusions(exclusionFilter, includedPackages, excludedPackages);

            Exclusions.ExclusionFilter = (string)EnvironmentSettings.GetConfigSectionValues("Shopping")["ShoppingDefaultExclusions"];

            var shoppingInputParameterViewModel = new ShoppingInputParameterViewModel
            {
                ExcludedPackages       = excludedPackages,
                ExclusionFilter        = exclusionFilter,
                IncludedPackages       = includedPackages,
                NumberOfActiveMachines = numberOfActiveMachines,
                Period                 = period,
                ShopEndDate            = endDate,
                ShopStartDate          = startDate,
                Threshold              = (int)threshold,
                TotalDistributionCount = totalDistributionCount
            };

            return(shoppingInputParameterViewModel);
        }