private void buttonGo_Click(object sender, EventArgs e) { try { ClientsSet clientsSet = new ClientsSet(); if (textBoxLastName.Text == "" || textBoxFirstName.Text == "" || textBoxTelephone.Text == "") { throw new Exception("Обязательные данные не заполнены"); } else { clientsSet.LastName = textBoxLastName.Text; clientsSet.FirstName = textBoxFirstName.Text; clientsSet.Phone = textBoxTelephone.Text; } Program.varr.ClientsSet.Add(clientsSet); Program.varr.SaveChanges(); MessageBox.Show("Клиент успешно добавлен!", "Клиент добавлен", MessageBoxButtons.OK, MessageBoxIcon.Information); FormOrderBy formOrderBy = new FormOrderBy(); formOrderBy.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show("" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonThen_Click(object sender, EventArgs e) { FormOrderBy formOrderBy = new FormOrderBy(); formOrderBy.Show(); this.Hide(); }