/// <summary> /// Handle the click event for the Load Button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Load_Click(object sender, RoutedEventArgs e) { // When quarterly data is load, we show the Quit and Save buttons ExitButton.Visibility = Visibility.Hidden; LoadButton.Visibility = Visibility.Hidden; QuitButton.Visibility = Visibility.Visible; SaveButton.Visibility = Visibility.Visible; // disable the save button till something changes. SaveButton.IsEnabled = false; // update the YearControl and the QuarterControl with the users selection m_loadedQuarter = new QuarterInfo { Year = Year.Value, Quarter = Quarter.Value }; // set the datacontext of the control to the latest information DataContext = m_loadedQuarter; m_loadedQuarter.Load(); Quarter.IsEnabled = false; Year.IsEnabled = false; // fill the local working copy from the database if (LoadQuarter != null) { LoadQuarter(this, new ReportEventArgs(m_loadedQuarter)); } // hook the propertyChanged event so that we can enable the Save button. m_loadedQuarter.PropertyChanged += LoadedQuarterPropertyChanged; // enable the border around the sales buttons then // individually enable/disable each depending on the actual values. SalesBorder.IsEnabled = true; chkBingo1.IsEnabled = m_loadedQuarter.Month1.SysBingoSales != 0m; chkBingo2.IsEnabled = m_loadedQuarter.Month2.SysBingoSales != 0m; chkBingo3.IsEnabled = m_loadedQuarter.Month3.SysBingoSales != 0m; chkOther1.IsEnabled = m_loadedQuarter.Month1.SysOtherSales != 0m; chkOther2.IsEnabled = m_loadedQuarter.Month2.SysOtherSales != 0m; chkOther3.IsEnabled = m_loadedQuarter.Month3.SysOtherSales != 0m; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // Set the YearControl and QuarterControl to today. DateTime dt = DateTime.Now; DataContext = new QuarterInfo { Year = dt.Year, Quarter = ((dt.Month - 1) / 3 + 1) }; // Disable the actual sales buttons until valid data has been loaded. SalesBorder.IsEnabled = false; }
public ReportEventArgs(QuarterInfo infomation) { Info = infomation; }