コード例 #1
0
        private void SelectUserClick(object sender, SelectionChangedEventArgs e)
        {
            ReportViewModel   report = new ReportViewModel();
            List <UserReport> res    = report.GetUserReport(viewModel.SelectedUser,
                                                            DateTime.Parse($"1.{DateTime.Now.Month}.{DateTime.Now.Year}"),
                                                            DateTime.Parse(
                                                                $"{(DateTime.Now.Month == 12 ? "31." : "1.")}.{(DateTime.Now.Month == 12 ? "12" : (DateTime.Now.Month + 1).ToString())}.{DateTime.Now.Year}")
                                                            .AddDays((DateTime.Now.Month == 12 ? 0 : -1)));

            treeView1.ItemsSource = res;
        }
コード例 #2
0
 public ReportWindow(User user)
 {
     InitializeComponent();
     ReportGrid.Children.Clear();
     viewModel              = new ReportViewModel();
     this.Title             = user.Name.Equals("Storage") ? "Отчет по складу" : $"Отчет по {user.Name}";
     StartDate.SelectedDate = DateTime.Parse("1.01." + DateTime.Now.Year);
     EndDate.SelectedDate   = DateTime.Parse("31.12." + DateTime.Now.Year);
     if (user.Name.Equals("Storage"))
     {
         List <List <string> > report = viewModel.GetStorageReport(StartDate.DisplayDate, EndDate.DisplayDate);
         CreateGrid(report);
     }
     else
     {
         var res = viewModel.GetUserReport(user, StartDate.DisplayDate, EndDate.DisplayDate);
     }
     //button1.Background = (Brush)this.Resources["buttonGradientBrush"];
     //TextBlock tb=new TextBlock(){Style = (Style)this.Resources["IngredientHeaderStyle"] };
 }