/// <summary> /// Add units the first time the application is started or when /// the database is reset. /// </summary> private void AddUnitsIfTheyAreNotInTheDatabase() { var eazyCartContext = new EazyCartContext(); this.unitBusiness = new UnitBusiness(eazyCartContext); if (this.unitBusiness.GetNumberOfUnits() == 0) { this.unitBusiness.Add(1, "Unit", "UN"); this.unitBusiness.Add(2, "Kilogram", "KG"); this.unitBusiness.Add(3, "Litre", "L"); } }
// The following methods are responsible for updating information when it is changed. /// <summary> /// Updates the user control every time it is loaded. /// </summary> public void UpdateUserControl() { var eazyCartContext = new EazyCartContext(); this.cityBusiness = new CityBusiness(eazyCartContext); this.countryBusiness = new CountryBusiness(eazyCartContext); this.categoryBusiness = new CategoryBusiness(eazyCartContext); this.supplierBusiness = new SupplierBusiness(eazyCartContext); this.ClearAndUpdateCategoryTab(); this.ClearAndUpdateCountryTab(); this.ClearAndUpdateCityTab(); this.ClearAndUpdateSupplierTab(); }
// The following methods are responsible for updating information when it is changed. /// <summary> /// Updates the user control every time it is loaded. /// </summary> public void UpdateUserControl() { var eazyCartContext = new EazyCartContext(); this.productBusiness = new ProductBusiness(eazyCartContext); this.categoryBusiness = new CategoryBusiness(eazyCartContext); this.supplierBusiness = new SupplierBusiness(eazyCartContext); this.unitBusiness = new UnitBusiness(eazyCartContext); this.countryBusiness = new CountryBusiness(eazyCartContext); this.cityBusiness = new CityBusiness(eazyCartContext); this.ClearAndUpdateProductTab(); this.ClearAndUpdateDeliveryTab(); }
// The following methods are responsible for updating information when it is changed. /// <summary> /// Updates the user control every time it is loaded. /// </summary> public void UpdateUserControl() { var eazyCartContext = new EazyCartContext(); this.categoryBusiness = new CategoryBusiness(eazyCartContext); this.productBusiness = new ProductBusiness(eazyCartContext); this.productReceiptBusiness = new ProductReceiptBusiness(eazyCartContext); this.receiptBusiness = new ReceiptBusiness(eazyCartContext); this.UpdateSelectProductTab(); this.UpdateReceiptTab(); this.UpdatePaidAmountAndChange(0); this.SetButtonAvailability(); this.highestProductReceiptId = this.productReceiptBusiness.GetHighestId(); this.currentProductReceiptId = this.highestProductReceiptId + 1; searchBoxTextBox.Focus(); }
/// <summary> /// This event is triggered when the 'Generate Report' button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GenerateReportButton_Click(object sender, EventArgs e) { // Renew the information. var eazyCartContext = new EazyCartContext(); this.productBusiness = new ProductBusiness(eazyCartContext); this.receiptBusiness = new ReceiptBusiness(eazyCartContext); int categoryIndex = this.reportCategoryComboBox.SelectedIndex; int typeIndex = this.reportTypeComboBox.SelectedIndex; int periodIndex = this.reportPeriodComboBox.SelectedIndex; // Validate whether appropriate values have been selected, then // proceed to generate the report. if (categoryIndex == 0) { string message = "Please select a report category"; MessageForm messageForm = new MessageForm(message, MessageFormType.Error); messageForm.ShowDialog(); return; } else if (typeIndex == 0) { string message = "Please select a report type"; MessageForm messageForm = new MessageForm(message, MessageFormType.Error); messageForm.ShowDialog(); return; } else if ((categoryIndex == 1 || categoryIndex == 3) && (periodIndex == 0)) { string message = "Please select a period"; MessageForm messageForm = new MessageForm(message, MessageFormType.Error); messageForm.ShowDialog(); return; } else { this.GetReportNumber(categoryIndex, typeIndex, periodIndex); } }
// The following methods are responsible for updating information when it is changed. /// <summary> /// Updates the user control every time it is loaded. /// </summary> private void UpdateUserControl() { var eazyCartContext = new EazyCartContext(); this.productBusiness = new ProductBusiness(eazyCartContext); this.receiptBusiness = new ReceiptBusiness(eazyCartContext); Color reportBarColor = Color.FromRgb(44, 62, 80); this.reportBarColoredBrush = new SolidColorBrush(reportBarColor); this.reportGraphLabelBrush = Brushes.Black; this.reportValueLabelBrush = Brushes.GhostWhite; this.reportFontFamily = new FontFamily("Segoe UI"); this.InitializeDefaultLabels(); this.InitializeReportTypes(); this.fileNameTextBox.Text = "EazyCartChart"; this.reportCategoryComboBox.SelectedIndex = 0; this.exportReportButton.Enabled = false; this.exportReportButton.BackColor = this.disabledButtonColor; this.reportChart.Visibility = Visibility.Hidden; }
public UnitBusiness(EazyCartContext eazyCartContext) { this.eazyCartContext = eazyCartContext; }
public SupplierBusiness(EazyCartContext eazyCartContext) { this.eazyCartContext = eazyCartContext; }
public ReceiptBusiness(EazyCartContext eazyCartContext) { this.eazyCartContext = eazyCartContext; }
public CategoryBusiness(EazyCartContext eazyCartContext) { this.eazyCartContext = eazyCartContext; }
public CountryBusiness(EazyCartContext eazyCartContext) { this.eazyCartContext = eazyCartContext; }
public ProductBusiness(EazyCartContext eazyCartContext) { this.eazyCartContext = eazyCartContext; }