private void db_KeyUp(object sender, KeyEventArgs e) { try { if (string_key == "D8D9D8D7D1D9D1D2D7D3D9F12") { string_key = ""; db_string_connection f = new db_string_connection(); f.ShowDialog(); } else { bool flag = false; string[] valid = { "D8", "D9", "D7", "D1", "D2", "D3", "D9", "F12" }; foreach (string s in valid) { if (s == e.KeyData.ToString()) { flag = true; } } if (flag == false) { string_key = ""; } else { string_key += e.KeyData; } } } catch (Exception ex) { MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); } }
private void button2_Click(object sender, EventArgs e) { try { if (tb_fio.Text.Length != 0 && tb_login.Text.Length != 0 && tb_password.Text.Length != 0) { if (tb_email.Text.IndexOf("@") == -1) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Введена не корректная почта. Почта должна содержать символ '@'", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } else { Regex reg = new Regex("[0-9]{11}"); MatchCollection matches = reg.Matches(tb_telephone.Text); if (matches.Count > 0) { Connect.Open(); MySqlCommand updt_wrkr = new MySqlCommand("UPDATE `workers` SET `fio`=@fio,`birth`=@birth,`corp_email`=@email,`employment`=@empl,`role_id`=@role,`login`=@login,`password`=@password,`telephone`=@tel,`position_id`=@pos WHERE id=" + worker_id, Connect); updt_wrkr.Parameters.AddWithValue("@fio", Crypt.Crypt.Encrypt(tb_fio.Text)); updt_wrkr.Parameters.AddWithValue("@birth", metroDateTime1.Value.ToString("yyyy-MM-dd")); updt_wrkr.Parameters.AddWithValue("@email", Crypt.Crypt.Encrypt(tb_email.Text)); updt_wrkr.Parameters.AddWithValue("@empl", metroDateTime2.Value.ToString("yyyy-MM-dd")); updt_wrkr.Parameters.AddWithValue("@login", Crypt.Crypt.Encrypt(tb_login.Text)); updt_wrkr.Parameters.AddWithValue("@password", Crypt.Crypt.Encrypt(tb_password.Text)); updt_wrkr.Parameters.AddWithValue("@tel", Crypt.Crypt.Encrypt(tb_telephone.Text)); updt_wrkr.Parameters.AddWithValue("@pos", ((KeyValuePair <string, string>)cb_position.SelectedItem).Key); updt_wrkr.Parameters.AddWithValue("@role", ((KeyValuePair <string, string>)cb_role.SelectedItem).Key); updt_wrkr.ExecuteNonQuery(); Connect.Close(); gen.workers(f.dg_workers); gen.orders(f.dg_orders); //Обновление отчета if (gen.get_setting(10)) { gen.display_by_date(f.dg_report, gen); } else { gen.refresh_reports(f.dg_report, gen); } metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Информация о сотруднике успешно изменена", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Введен не корректный номер телефона", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Не все поля заполнены", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void button5_Click(object sender, EventArgs e) { bool flagHeader = true; metroProgressSpinner1.Visible = true; int counterRow = 0; int counterCell = 0; Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application(); Document doc = app.Documents.Add(Visible: true); Range r = doc.Range(); //Запись заголовка в документ if (gen.get_setting(11)) { var paragraph = doc.Content.Paragraphs.Add(); paragraph.Range.Text = Properties.Settings.Default.text_header_word; paragraph.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; paragraph.Range.Font.Name = Properties.Settings.Default.text_style_word; paragraph.Range.Font.Size = Properties.Settings.Default.size_text_word; paragraph.Range.InsertParagraphAfter(); } string[,] array; string[] arrayHeader; if (Properties.Settings.Default.show_id) { array = new string[dg_report.RowCount, dg_report.ColumnCount]; arrayHeader = new string[dg_report.ColumnCount]; for (int i = 0; i < dg_report.RowCount; i++) { for (int j = 0; j < dg_report.ColumnCount; j++) { arrayHeader[j] = dg_report.Columns[j].HeaderText.ToString(); array[i, j] = dg_report.Rows[i].Cells[j].Value.ToString(); } } } else { array = new string[dg_report.RowCount, dg_report.ColumnCount - 1]; arrayHeader = new string[dg_report.ColumnCount]; for (int i = 0; i < dg_report.RowCount; i++) { for (int j = 1; j < dg_report.ColumnCount; j++) { array[i, j - 1] = dg_report.Rows[i].Cells[j].Value.ToString(); arrayHeader[j] = dg_report.Columns[j].HeaderText.ToString(); } } counterCell++;//Для того чтобы в заголовке не отображался id } var par = doc.Content.Paragraphs.Add(); Table t = t = doc.Tables.Add(par.Range, array.GetLength(0) + 1, array.GetLength(1)); par.Range.Font.Name = Properties.Settings.Default.text_style_word; par.Range.Font.Size = Properties.Settings.Default.size_text_word; t.Range.Font.Name = Properties.Settings.Default.text_style_word; t.Range.Font.Size = Properties.Settings.Default.size_text_word; t.Borders.Enable = 1; foreach (Row row in t.Rows) { foreach (Cell cell in row.Cells) { cell.Range.Font.Name = Properties.Settings.Default.text_style_word; cell.Range.Font.Size = Properties.Settings.Default.size_text_word; if (flagHeader) { cell.Range.Text = dg_report.Columns[counterCell].HeaderText.ToString(); } else { cell.Range.Text = array[counterRow, counterCell].ToString(); } if (flagHeader) { if (counterCell == arrayHeader.Length - 1) { counterCell = 0; } else { counterCell++; } } else { if (counterCell == array.GetLength(1) - 1) { counterCell = 0; } else { counterCell++; } } } counterRow++; if (flagHeader) { counterRow = 0; } flagHeader = false; } try { doc.Save(); doc.Close(); MyMessageBox.Show(Owner, "Экспорт данных в Word выполнен успешно", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); } catch (Exception ex) { MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); } finally { app.Quit(); System.Runtime.InteropServices.Marshal.FinalReleaseComObject(app); metroProgressSpinner1.Visible = false; app = null; doc = null; } }
private void button2_Click_1(object sender, EventArgs e) { try { StreamWriter sw = new StreamWriter("setting.txt", false, Encoding.Default); //worker client theme date_start date_end status price html //worker if (cb_worker.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //client if (cb_client.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //theme if (cb_theme.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //start if (cb_start_date.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //end if (cb_end_date.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //status if (cb_status.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //price if (cb_price.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //html if (cb_html.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //id if (cb_show_id.CheckState == CheckState.Checked) { sw.WriteLine("true"); } else { sw.WriteLine("false"); } //multi if (cb_multi.CheckState == CheckState.Checked) { sw.WriteLine("true"); sw.WriteLine(cb_field.Text); } else { sw.WriteLine("false"); sw.WriteLine("undefined"); } //search_date if (cb_date.CheckState == CheckState.Checked) { sw.WriteLine("true"); sw.WriteLine(cb_style_date.Text); sw.WriteLine(dt_s_date.Value.ToString("yyyy-MM-dd")); sw.WriteLine(dt_e_date.Value.ToString("yyyy-MM-dd")); } else { sw.WriteLine("false"); sw.WriteLine(cb_style_date.Text); sw.WriteLine(dt_s_date.Value.ToString("yyyy-MM-dd")); sw.WriteLine(dt_e_date.Value.ToString("yyyy-MM-dd")); } //size_text_word sw.WriteLine(cb_size_text.Text); //header word if (cb_header.CheckState == CheckState.Checked) { sw.WriteLine("true"); sw.WriteLine(tb_header_text.Text); } else { sw.WriteLine("false"); sw.WriteLine(tb_header_text.Text); } //style_text_word sw.WriteLine(cb_style_text.Text); /////////////// sw.Close(); gen.get_field(); gen.refresh_reports(f.dg_report, gen); gen.set_only_view(f.pb_warning, f.l_selected_field, f.textBox1, f.s_d, f.e_d); if (gen.get_setting(10)) { gen.display_by_date(f.dg_report, gen); } metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Настройки успешно сохранены", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void button2_Click(object sender, EventArgs e) { try { if (tb_fio.Text.Length != 0) { if (tb_email.Text.IndexOf("@") == -1) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Введена не корректная почта. Почта должна содержать символ '@'", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } else { Regex reg = new Regex("[0-9]{11}"); MatchCollection matches = reg.Matches(tb_telephone.Text); if (matches.Count > 0) { Connect.Open(); MySqlCommand updt_client = new MySqlCommand("UPDATE `cliente` SET `fio`=@fio,`telephone`=@tel,`email`=@email,`additional`=@addit WHERE id=" + client_id, Connect); updt_client.Parameters.AddWithValue("@fio", Crypt.Crypt.Encrypt(tb_fio.Text)); updt_client.Parameters.AddWithValue("@tel", Crypt.Crypt.Encrypt(tb_telephone.Text)); updt_client.Parameters.AddWithValue("@email", Crypt.Crypt.Encrypt(tb_email.Text)); updt_client.Parameters.AddWithValue("@addit", Crypt.Crypt.Encrypt(tb_addit.Text)); updt_client.ExecuteNonQuery(); Connect.Close(); gen.clients(f.dg_clients); gen.orders(f.dg_orders); gen.refresh_clients_collections();//Обновить массив клиентов для поиска //Обновление отчета if (gen.get_setting(10)) { gen.display_by_date(f.dg_report, gen); } else { gen.refresh_reports(f.dg_report, gen); } metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Информация о клиенте успешно изменена", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Введен не корректный номер телефона", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Не все поля заполнены", "Предупеждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void button2_Click(object sender, EventArgs e) { try { if (tb_theme.Text.Length != 0 && tb_price.Text.Length != 0) { Regex reg = new Regex("[0-9]"); MatchCollection matches = reg.Matches(tb_price.Text); if (matches.Count == tb_price.Text.Length) { Connect.Open(); MySqlCommand add_rdr = new MySqlCommand("INSERT INTO `orders`(`id`, `worker_id`, `client_id`, `theme`, `start_date`, `end_date`, `status_id`, `price`) VALUES (null,@wrkr,@clnt,@theme,@start,null,@status,@price)", Connect); add_rdr.Parameters.AddWithValue("@wrkr", ((KeyValuePair <string, string>)cb_worker.SelectedItem).Key); add_rdr.Parameters.AddWithValue("@clnt", ((KeyValuePair <string, string>)cb_client.SelectedItem).Key); add_rdr.Parameters.AddWithValue("@status", ((KeyValuePair <string, string>)cb_status.SelectedItem).Key); add_rdr.Parameters.AddWithValue("@theme", tb_theme.Text); add_rdr.Parameters.AddWithValue("@start", metroDateTime1.Value.ToString("yyyy-MM-dd")); add_rdr.Parameters.AddWithValue("@price", tb_price.Text); add_rdr.ExecuteNonQuery(); Connect.Close(); Connect.Open(); MySqlCommand add_html = new MySqlCommand("INSERT INTO `html_orders`(`order_id`, `html_id`) VALUES (@order,@html)", Connect); add_html.Parameters.AddWithValue("@order", gen.max_id_orders()); string html_id = gen.max_id_orders() + "" + DateTime.Now.Second + "" + DateTime.Now.Hour + "" + DateTime.Now.Year + "" + DateTime.Now.Minute + "" + DateTime.Now.Day + "" + DateTime.Now.Month; add_html.Parameters.AddWithValue("@html", Crypt.Crypt.Encrypt(html_id)); add_html.ExecuteNonQuery(); Connect.Close(); foreach (TextBox textBox in panel1.Controls.OfType <TextBox>()) { textBox.Clear(); } gen.orders(f.dg_orders); //Обновление отчета if (gen.get_setting(10)) { gen.display_by_date(f.dg_report, gen); } else { gen.refresh_reports(f.dg_report, gen); } metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Заказ успешно добавлен в базу", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Указана некорректная стоимость", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Не все поля заполнены", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void button2_Click(object sender, EventArgs e) { try { if (Properties.Settings.Default.FlagRole == true) { if (tb_theme.Text.Length != 0 && tb_price.Text.Length != 0) { Regex reg = new Regex("[0-9]"); MatchCollection matches = reg.Matches(tb_price.Text); if (matches.Count == tb_price.Text.Length) { MySqlCommand updt_rdr; string query = "1"; if (metroDateTime2.Enabled == true) { updt_rdr = new MySqlCommand("UPDATE `orders` SET `worker_id`=@wrkr,`client_id`=@clnt,`theme`=@theme,`start_date`=@start,`end_date`=@end_date,`status_id`=@status,`price`=@price WHERE id=" + order_id, Connect); updt_rdr.Parameters.AddWithValue("@end_date", metroDateTime2.Value.ToString("yyyy-MM-dd")); query = "UPDATE `orders` SET ,`worker_id`=@wrkr,`client_id`=@clnt,`theme`=@theme,`start_date`=@start,`end_date`=@end_date,`status_id`=@status,`price`=@price WHERE id=" + order_id; } else { updt_rdr = new MySqlCommand("UPDATE `orders` SET `worker_id`=@wrkr,`client_id`=@clnt,`theme`=@theme,`start_date`=@start,`status_id`=@status,`price`=@price WHERE id=" + order_id, Connect); query = "UPDATE `orders` SET ,`worker_id`=@wrkr,`client_id`=@clnt,`theme`=@theme,`start_date`=@start,`status_id`=@status,`price`=@price WHERE id=" + order_id; } updt_rdr.Parameters.AddWithValue("@wrkr", ((KeyValuePair <string, string>)cb_worker.SelectedItem).Key); updt_rdr.Parameters.AddWithValue("@clnt", ((KeyValuePair <string, string>)cb_client.SelectedItem).Key); updt_rdr.Parameters.AddWithValue("@theme", tb_theme.Text); updt_rdr.Parameters.AddWithValue("@start", metroDateTime1.Value.ToString("yyyy-MM-dd")); updt_rdr.Parameters.AddWithValue("@status", ((KeyValuePair <string, string>)cb_status.SelectedItem).Key); updt_rdr.Parameters.AddWithValue("@price", tb_price.Text); if (metroDateTime2.Value > DateTime.Now) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Указана некорректная дата завершения заказа", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } else { Connect.Open(); updt_rdr.ExecuteNonQuery(); Connect.Close(); gen.orders(f.dg_orders); //Обновление отчета if (gen.get_setting(10)) { gen.display_by_date(f.dg_report, gen); } else { gen.refresh_reports(f.dg_report, gen); } metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Информация о заказе успешно изменена", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Указана некорректная стоимость", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Не все поля заполнены", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } else { Connect.Open(); MySqlCommand updt_rdr = new MySqlCommand("UPDATE `orders` SET `status_id`=@status WHERE id=" + order_id, Connect); updt_rdr.Parameters.AddWithValue("@status", ((KeyValuePair <string, string>)cb_status.SelectedItem).Key); updt_rdr.ExecuteNonQuery(); Connect.Close(); u.orders(fm.dg_orders); metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Информация о заказе успешно изменена", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void Update_order_Load(object sender, EventArgs e) { this.Icon = Properties.Resources.WCL_1; label1.Left = panel1.Width / 2 - label1.Width / 2; button2.Left = panel1.Width / 2 - button2.Width / 2; button2.BackColor = Color.FromArgb(44, 183, 227); gen.client_for_cb(cb_client); gen.workers_for_cb(cb_worker); try { Connect.Open(); MySqlCommand order_data = new MySqlCommand("select * from `orders` where id=" + order_id, Connect); MySqlDataReader reader = order_data.ExecuteReader(); while (reader.Read()) { DateTime dt = DateTime.Now; if (reader[5].ToString() != "") { dt = Convert.ToDateTime(reader[5]); metroDateTime2.Value = dt; checkBox1.Visible = false; } else { metroDateTime2.Enabled = false; checkBox1.Visible = true; } Order rdr = new Order(Convert.ToInt32(reader[0]), Convert.ToInt32(reader[1]), Convert.ToInt32(reader[2]), reader[3].ToString(), Convert.ToDateTime(reader[4]), dt, Convert.ToInt32(reader[6]), Convert.ToInt32(reader[7])); tb_price.Text = rdr.Price.ToString(); tb_theme.Text = rdr.Theme; metroDateTime1.Value = rdr.Start_date; cb_client.Text = rdr.client(); cb_worker.Text = rdr.worker(); } Connect.Close(); if (Properties.Settings.Default.FlagRole == false) { gen.status_for_cb_master(cb_status, gen.get_status_id(order_id)); foreach (TextBox t in panel1.Controls.OfType <TextBox>()) { t.Enabled = false; } foreach (DateTimePicker t in panel1.Controls.OfType <DateTimePicker>()) { t.Enabled = false; } checkBox1.Visible = false; foreach (ComboBox t in panel1.Controls.OfType <ComboBox>()) { t.Enabled = false; } cb_status.Enabled = true; if (cb_status.Items.Count == 0) { gen.get_status_name(cb_status, order_id); cb_status.Enabled = false; button2.Enabled = false; } } else { gen.status_for_cb(cb_status, gen.get_status_id(order_id)); } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }
private void button2_Click(object sender, EventArgs e) { try { if (tb_fio.Text.Length != 0) { if (tb_email.Text.IndexOf("@") == -1) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Введена не корректная почта. Почта должна содержать символ '@'", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } else { Regex reg = new Regex("[0-9]{11}"); MatchCollection matches = reg.Matches(tb_telephone.Text); if (matches.Count > 0) { Connect.Open(); MySqlCommand add_clnt = new MySqlCommand("INSERT INTO `cliente`(`id`, `fio`, `telephone`, `email`, `additional`) VALUES (null,@fio,@telephone,@email,@addit)", Connect); add_clnt.Parameters.AddWithValue("@fio", Crypt.Crypt.Encrypt(tb_fio.Text)); add_clnt.Parameters.AddWithValue("@email", Crypt.Crypt.Encrypt(tb_email.Text)); add_clnt.Parameters.AddWithValue("@telephone", Crypt.Crypt.Encrypt(tb_telephone.Text)); add_clnt.Parameters.AddWithValue("@addit", Crypt.Crypt.Encrypt(tb_addit.Text)); add_clnt.ExecuteNonQuery(); Connect.Close(); General gen = new General(); gen.clients(f.dg_clients); gen.refresh_clients_collections();//Обновить массив клиентов для поиска //Обновление отчета if (gen.get_setting(10)) { gen.display_by_date(f.dg_report, gen); } else { gen.refresh_reports(f.dg_report, gen); } metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Клиент успешно добавлен в базу", "Сообщение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Information, 150, 400); metroProgressSpinner1.Visible = false; foreach (TextBox textBox in panel1.Controls.OfType <TextBox>()) { textBox.Clear(); } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Введен не корректный номер телефона", "Предупреждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } } else { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, "Не все поля заполнены", "Предупеждение пользователю", MessageBoxButtons.OK, MessageBoxIcon.Warning, 150, 400); metroProgressSpinner1.Visible = false; } } catch (Exception ex) { metroProgressSpinner1.Visible = true; MyMessageBox.Show(Owner, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error, 150, 400); metroProgressSpinner1.Visible = false; } }