/// <summary> /// Delete selected Client /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonDeleteClient_Click(object sender, RoutedEventArgs e) { ClientPersonal client = MainWindow.DB.Clients[index]; MainWindow.DB.Clients.RemoveAt(index); ClearForm(); MessageBox.Show(String.Format("Client {0} deleted!", client.ToString())); }
/// <summary> /// Update current Client /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonUpdateClient_Click(object sender, RoutedEventArgs e) { ClientPersonal client = MainWindow.DB.Clients[index]; CreateClient(client); loadDataToComboBox(); ClearForm(); MessageBox.Show("Clients update"); }
/// <summary> /// Create new Client and add to List /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonCreate_Click(object sender, RoutedEventArgs e) { ClientPersonal client = new ClientPersonal(); MainWindow.DB.Clients.Add(CreateClient(client)); loadDataToComboBox(); ClearForm(); MessageBox.Show("Clients add"); }
public Request(ClientPersonal client, Manager manager, string item, double price, int discount, int amount, double total) { this.IDRequest = IDRequest; this.DateRequest = DateRequest; Client = client; Manager = manager; Item = item; Price = price; Discount = discount; Amount = amount; Total = total; }
/// <summary> /// Load information about selected Client into fields form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonLoadClient_Click(object sender, RoutedEventArgs e) { ClientPersonal client = (ClientPersonal)comboBoxClients.SelectedItem; index = MainWindow.DB.Clients.IndexOf(client); textBoxLastName.Text = client.lastName; textBoxFirstName.Text = client.firstName; textBoxPhone.Text = client.phone; textBoxEmail.Text = client.email; textBoxCity.Text = client.AddressClient.city; textBoxStreet.Text = client.AddressClient.street; textBoxBuilding.Text = client.AddressClient.building; textBoxApart.Text = client.AddressClient.apart; }
/// <summary> /// Create new Client from fields form /// </summary> /// <param name="client"></param> /// <returns></returns> private ClientPersonal CreateClient(ClientPersonal client) { client.lastName = textBoxLastName.Text.ToString(); client.firstName = textBoxFirstName.Text.ToString(); client.phone = textBoxPhone.Text.ToString(); client.email = textBoxEmail.Text.ToString(); string city = textBoxCity.Text.ToString(); string street = textBoxStreet.Text.ToString(); string building = textBoxBuilding.Text; string apart = textBoxApart.Text; Address addressClient = new Address(city, street, building, apart); client.AddressClient = addressClient; return(client); }