Esempio n. 1
0
        private void InitializeMenues()
        {
            var clientInfo = new ClientInformation();

            if (!clientInfo.AnyData())
            {
                this.dataSeeder.Value.Seed();

                this.excelLoader.Value.Load();
            }

            this.allItemNames     = clientInfo.GetAllProductNames();
            this.allLocationNames = clientInfo.GetAllLocationNames();
            this.maxPurchaseDate  = clientInfo.GetLastPurchaseDate();

            PdfDate.SelectedDate = new DateTime(2014, 1, 1);

            PdfDate.DisplayDateEnd = this.maxPurchaseDate;

            PdfDate.SelectedDateChanged += PdfDate_SelectedDateChanged;

            PdfDate.Visibility       = System.Windows.Visibility.Hidden;
            PdfItemNameP.Visibility  = System.Windows.Visibility.Hidden;
            PdfRealmNameP.Visibility = System.Windows.Visibility.Hidden;

            foreach (PdfReportType reportType in (PdfReportType[])Enum.GetValues(typeof(PdfReportType)))
            {
                var choice = new MenuItem()
                {
                    Header = reportType.ToString()
                };

                choice.Click += choice_Click;

                PdfChoice.Items.Add(choice);
            }

            foreach (var product in allItemNames)
            {
                var item = new MenuItem()
                {
                    Header = product
                };

                item.Click += PdfItemName_Click;

                PdfItemName.Items.Add(item);
            }

            foreach (var product in allLocationNames)
            {
                var item = new MenuItem()
                {
                    Header = product
                };

                item.Click += PdfRealmName_Click;

                PdfRealmName.Items.Add(item);
            }

            var excelOptionAll = new MenuItem();

            excelOptionAll.Header = "All reports";
            excelOptionAll.Click += (e, r) => { this.excelOption = "all"; ExcelChoice.Header = "All reports"; };
            ExcelChoice.Items.Add(excelOptionAll);

            var excelOptionVendors = new MenuItem();

            excelOptionVendors.Header = "Vendors report";
            excelOptionVendors.Click += (e, r) => { this.excelOption = "vendors"; ExcelChoice.Header = "Vendors report"; };
            ExcelChoice.Items.Add(excelOptionVendors);

            var excelOptionSales = new MenuItem();

            excelOptionSales.Header = "Sales report";
            excelOptionSales.Click += (e, r) => { this.excelOption = "sales"; ExcelChoice.Header = "Sales report"; };
            ExcelChoice.Items.Add(excelOptionSales);
        }