Esempio n. 1
0
        }         //ReloadedParametersList()  Returns reloaded parameters list.

        public void CreateDistibution(object x)
        {
            DistributionCalculator.CalculateDistribution(SelectedProduct.PLU);

            DistributedPcs = SelectedProductList.Sum(o => o.DistributedPacks);
            OnPropertyChange("DistributedPcs");
            CollectionViewSource.GetDefaultView(SelectedProductList).Refresh();
        }         // CreateDistibution() calculate distribution based on store parameters, method of distribution and available stock
        }         // ProductDistribution()

        public void TodayDistribution(object x)
        {
            DateTime today = DateTime.Now;

            foreach (var line in ProductsFilteredList)
            {
                if (line.MondayDistribution == true && today.DayOfWeek == DayOfWeek.Monday)
                {
                    DistributionCalculator.CalculateDistribution(line.PLU);
                }
                else if (line.TuesdayDistribution == true && today.DayOfWeek == DayOfWeek.Tuesday)
                {
                    DistributionCalculator.CalculateDistribution(line.PLU);
                }
                else if (line.WednesdayDistribution == true && today.DayOfWeek == DayOfWeek.Wednesday)
                {
                    DistributionCalculator.CalculateDistribution(line.PLU);
                }
                else if (line.ThursdayDistribution == true && today.DayOfWeek == DayOfWeek.Thursday)
                {
                    DistributionCalculator.CalculateDistribution(line.PLU);
                }
                else if (line.FridayDistribution == true && today.DayOfWeek == DayOfWeek.Friday)
                {
                    DistributionCalculator.CalculateDistribution(line.PLU);
                }
                else if ((today.DayOfWeek == DayOfWeek.Saturday || today.DayOfWeek == DayOfWeek.Sunday) && line.FridayDistribution == true)
                {
                    DistributionCalculator.CalculateDistribution(line.PLU);
                }
            }

            Refresh(null);

            MainWindowViewModel.NotifyUser("Today distribution finished.");
        }         // TodayDistribution() creates distribution foreach product with selected current day of the week (if weekend then for friday)
        }         // Refresh()

        public void ProductDistribution(object x)
        {
            DistributionCalculator.CalculateDistribution(SelectedProduct.PLU);
            Refresh(null);
        }         // ProductDistribution()