/// <summary> /// Handles the Click event of the addCustomerButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void addCustomerButton_Click(object sender, RoutedEventArgs e) { CustomerWindow window = new CustomerWindow(); if (window.OpenWindowInMode(OpenWindowMode.Add) == true) { DataManager.Instance.AddCustomer( new Customer( window.CustomerName, window.Phone, window.Address, window.Furnace, window.Date ) ); this.RefreshCustomers(); } }
/// <summary> /// Handles the Click event of the editCustomerButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void editCustomerButton_Click(object sender, RoutedEventArgs e) { CustomerWindow window = new CustomerWindow(); window.CustomerName = this.selectedCustomer.Name; window.Phone = this.selectedCustomer.Phone; window.Address = this.selectedCustomer.Address; window.Furnace = this.selectedCustomer.Furnace; window.Date = this.selectedCustomer.Date; if (window.OpenWindowInMode(OpenWindowMode.Edit) == true) { this.selectedCustomer.Name = window.CustomerName; this.selectedCustomer.Phone = window.Phone; this.selectedCustomer.Address = window.Address; this.selectedCustomer.Furnace = window.Furnace; this.selectedCustomer.Date = window.Date; this.RefreshCustomers(); this.RefreshSelectedCustomer(); } }