private void button18_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.search_sklad(textBox10.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (textBox10.Text == "") { MessageBox.Show("Поле не может быть пустым!"); textBox10.Text = ""; } else { if (result == "no") { MessageBox.Show("Склад не существует!"); textBox10.Text = ""; } else { label10.Visible = false; textBox10.Visible = false; button18.Visible = false; button17.Visible = true; button16.Visible = true; client.delete_sklad(textBox10.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); vivod_sklad(); MessageBox.Show("Склад удален!"); textBox10.Text = ""; } } }
public tablepeople() { InitializeComponent(); button7.Visible = false; button9.Visible = false; textBox2.Visible = false; textBox3.Visible = false; textBox4.Visible = false; textBox5.Visible = false; var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.vivod_people(1, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; if (Settings.Default["role_bd"].ToString() == "staff") { textBox3.Visible = true; button1.Visible = false; button7.Visible = false; button2.Visible = false; button3.Visible = false; button6.Visible = false; button8.Visible = false; string id = ""; DataTable dt1 = client.vivod_provider(id, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt1; textBox1.Visible = false; textBox2.Visible = false; textBox4.Visible = false; textBox5.Visible = false; } }
private void button12_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.search_tovar(textBox9.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); string res = client.search_ing_provider(textBox7.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); bool IsDigit8 = textBox8.Text.All(char.IsDigit); if (textBox9.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "") { MessageBox.Show("Все поля должны быть заполнены!"); } else { if (result == "yes") { if (res == "yes") { if (IsDigit8 == true) { label6.Visible = false; label7.Visible = false; label8.Visible = false; label9.Visible = false; textBox6.Visible = false; textBox7.Visible = false; textBox8.Visible = false; textBox9.Visible = false; button7.Visible = true; button8.Visible = true; button9.Visible = true; button12.Visible = false; button20.Visible = false; button21.Visible = true; client.add_ing(textBox9.Text, textBox6.Text, textBox7.Text, textBox8.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); MessageBox.Show("Ингредиент добавлен!"); vivod_ing(); textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; } else { MessageBox.Show("Введите цифры!"); textBox8.Text = ""; } } else { MessageBox.Show("Такого поставщика не существует!"); textBox7.Text = ""; } } else { MessageBox.Show("Такой товар не существует!"); textBox9.Text = ""; } } }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text == "") { MessageBox.Show("Пароль не может быть пустым!"); } else { if (textBox2.Text.Length > 16 && textBox1.Text.Length > 16) { MessageBox.Show("Длина пароля не может быть больше 16 символов!"); textBox1.Text = ""; textBox2.Text = ""; } else { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.change_pass(textBox2.Text, textBox1.Text, Settings.Default["user_id"].ToString(), Settings.Default["token"].ToString()); if (result == "no") { MessageBox.Show("Старый пароль введен неверно!"); textBox1.Text = ""; textBox2.Text = ""; } else { MessageBox.Show("Пароль изменен!"); textBox1.Text = ""; textBox2.Text = ""; } } } }
public void update_d() { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.change_data(Settings.Default["user_id"].ToString(), Settings.Default["token"].ToString()); string username = dt.Rows[0].Field <string>("username"); string email = dt.Rows[0].Field <string>("email"); string fio = dt.Rows[0].Field <string>("fio"); string address = dt.Rows[0].Field <string>("address"); try { DateTime date_b = dt.Rows[0].Field <DateTime>("birthday_date"); label5.Text = "День рождения: " + date_b.ToShortDateString(); } catch { string date_b = dt.Rows[0].Field <string>("birthday_date"); label5.Text = "День рождения: " + date_b; } string phone_n = dt.Rows[0].Field <string>("phone_number"); string card_n = dt.Rows[0].Field <string>("card_number"); label1.Text = "Логин: " + username; label2.Text = "Почта: " + email; label3.Text = "ФИО: " + fio; label4.Text = "Адрес: " + address; label6.Text = "Номер телефона: " + phone_n; label7.Text = "Номер карты: " + card_n; }
public void vivod() { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.vivod_tovar(Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; }
private void button14_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.search_tovar(textBox1.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (result == "yes") { client.drop_tovar_name(textBox1.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); label1.Visible = false; textBox1.Text = ""; textBox1.Visible = false; button14.Visible = false; button13.Visible = true; button3.Visible = true; button2.Visible = true; vivod(); vivod_ing(); MessageBox.Show("Товар успешно удален!"); } else { label1.Visible = false; textBox1.Text = ""; textBox1.Visible = false; button14.Visible = false; button13.Visible = true; button3.Visible = true; button2.Visible = true; MessageBox.Show("Товара не существует!"); } }
private void button1_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); var con = client.login(textBox1.Text, textBox2.Text); Settings.Default["role_bd"] = client.role_bd(con.Item5); string result_con = con.Item1; if (result_con == "yes") { Settings.Default["role"] = con.Item2; Settings.Default["token"] = con.Item4; Settings.Default["username"] = con.Item3; Settings.Default["user_id"] = con.Item5; Settings.Default.Save(); mainm u = new mainm(); this.Hide(); u.ShowDialog(); this.Show(); } else { MessageBox.Show("Пользователя не существует!"); textBox1.Text = ""; textBox2.Text = ""; } }
private void button1_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); client.drop_token(Settings.Default["username"].ToString(), Settings.Default["user_id"].ToString()); Settings.Default["role"] = ""; Settings.Default["token"] = ""; Settings.Default["username"] = ""; Settings.Default["user_id"] = ""; Settings.Default.Save(); this.Close(); }
private void button9_Click(object sender, EventArgs e) { str--; if (str == 1) { button9.Visible = false; } var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.vivod_people(str, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; }
private void button11_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.search_ing(textBox6.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); tabControl1.SelectedTab = tabPage2; dataGridView2.DataSource = dt; button11.Visible = false; button10.Visible = true; textBox6.Text = ""; label6.Visible = false; textBox6.Visible = false; }
private void button22_Click(object sender, EventArgs e) { if (textBox6.Text == "") { MessageBox.Show("Название не может быть пустым!"); textBox6.Text = ""; } else { if (textBox7.Text == "") { MessageBox.Show("Поле ФИО должно быть заполненно!"); textBox7.Text = ""; } var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.search_ing_provider(textBox7.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (result == "yes") { string res = client.drop_ing(textBox6.Text, textBox7.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (res == "yes") { vivod_ing(); MessageBox.Show("Ингредиент успешно удален!"); textBox7.Text = ""; textBox6.Text = ""; button22.Visible = false; button8.Visible = true; textBox7.Visible = false; textBox6.Visible = false; label7.Visible = false; label6.Visible = false; button9.Visible = true; button21.Visible = true; button7.Visible = true; } else { MessageBox.Show("Такого ингредиента не существует!"); textBox7.Text = ""; textBox6.Text = ""; } } else { MessageBox.Show("Такого поставщика не существует!"); textBox7.Text = ""; } } }
private void button4_Click(object sender, EventArgs e) { if (textBox3.Text == "") { MessageBox.Show("Поле не может быть пустым!"); } else { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); client.update_data(Settings.Default["user_id"].ToString(), "people", "fio", textBox3.Text, Settings.Default["token"].ToString()); MessageBox.Show("ФИО изменено!"); update_d(); textBox3.Text = ""; } }
private void button9_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.vivod_tovar_bez(Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); tabControl1.SelectedTab = tabPage2; dataGridView2.DataSource = dt; button9.Visible = false; button10.Visible = true; button8.Visible = false; button7.Visible = false; button11.Visible = false; button12.Visible = false; button21.Visible = false; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.search_sessions(Settings.Default["token"].ToString()); if (result == "yes") { Application.Run(new mainm()); } else { Application.Run(new login()); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "") { if (textBox2.Text != "") { if (textBox3.Text != "") { if (textBox4.Text != "") { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string resilt = client.add_buyer(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text); if (resilt == "no") { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; MessageBox.Show("Юзер успешно создан!"); this.Close(); } else { textBox1.Text = ""; MessageBox.Show("Юзер c таким логином существует!"); } } else { MessageBox.Show("Адрес не может быть пустым!"); } } else { MessageBox.Show("Имя не может быть пустым!"); } } else { MessageBox.Show("Пароль не может быть пустым!"); } } else { MessageBox.Show("Логин не может быть пустым!"); } }
private void button6_Click(object sender, EventArgs e) { string b_date = dateTimePicker1.Value.ToShortDateString(); string date_now = DateTime.Now.ToShortDateString(); if (b_date == date_now) { MessageBox.Show("Дата не может быть сегодняшней!"); } else { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); client.update_date(Settings.Default["user_id"].ToString(), dateTimePicker1.Value, Settings.Default["token"].ToString()); MessageBox.Show("Дата дня рождения изменена!"); update_d(); dateTimePicker1.Value = DateTime.Now; } }
private void button7_Click(object sender, EventArgs e) { button10.Visible = true; textBox2.Visible = false; textBox3.Visible = false; textBox4.Visible = false; textBox5.Visible = false; textBox1.Visible = true; var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.vivod_people(1, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; button1.Visible = true; button2.Visible = true; button3.Visible = true; button7.Visible = false; button6.Visible = true; }
private void button4_Click(object sender, EventArgs e) { tabControl1.SelectedTab = tabPage1; button13.Visible = false; button4.Visible = false; button2.Visible = false; button3.Visible = false; Button_Lable_false(); var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); DataTable dt = client.searc_tovar_name(textBox1.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; textBox1.Text = ""; textBox2.Text = ""; textBox4.Text = ""; textBox3.Text = ""; textBox5.Text = ""; button6.Visible = true; }
private void button1_Click(object sender, EventArgs e) { if (Settings.Default["username"].ToString() == textBox2.Text) { MessageBox.Show("Админ не может удалить самого себя!"); textBox2.Text = ""; } else { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.deluser(textBox2.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (result == "no") { MessageBox.Show("Пользователя не существует!"); textBox2.Text = ""; } else { MessageBox.Show("При удалении поставщика будут удалены его ингредиенты!"); MessageBox.Show("Пользователь удален!"); textBox2.Text = ""; } } }
private void button5_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); if (textBox1.Visible != false) { if (textBox1.Text == "") { MessageBox.Show("Поле поиска не может быть пустым!"); } else { button10.Visible = false; button9.Visible = false; DataTable dt = client.search_fio(textBox1.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; } } if (textBox2.Visible != false) { if (textBox2.Text == "") { MessageBox.Show("Поле поиска не может быть пустым!"); } else { button10.Visible = false; button9.Visible = false; DataTable dt = client.vivod_buyer(textBox2.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; } } if (textBox3.Visible != false) { if (textBox3.Text == "") { MessageBox.Show("Поле поиска не может быть пустым!"); } else { button10.Visible = false; button9.Visible = false; DataTable dt = client.vivod_provider(textBox3.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; } } if (textBox4.Visible != false) { if (textBox4.Text == "") { MessageBox.Show("Поле поиска не может быть пустым!"); } else { button10.Visible = false; button9.Visible = false; DataTable dt = client.vivod_staff(textBox4.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; } } if (textBox5.Visible != false) { if (textBox5.Text == "") { MessageBox.Show("Поле поиска не может быть пустым!"); } else { button10.Visible = false; button9.Visible = false; DataTable dt = client.vivod_admin(textBox5.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; } } if (textBox1.Text != "" || textBox2.Text != "" || textBox3.Text != "" || textBox4.Text != "" || textBox5.Text != "") { button1.Visible = false; button2.Visible = false; button3.Visible = false; button7.Visible = true; button8.Visible = false; button6.Visible = false; } textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; if (Settings.Default["role_bd"].ToString() == "staff") { button7.Visible = false; } }
private void button5_Click(object sender, EventArgs e) { var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); bool IsDigit2 = textBox2.Text.All(char.IsDigit); bool IsDigit3 = textBox3.Text.All(char.IsDigit); bool IsDigit5 = textBox3.Text.All(char.IsDigit); string res = client.search_sklad(textBox4.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "") { MessageBox.Show("Все поля должны быть заполнены!"); } else { if (IsDigit2 == true && IsDigit3 == true && IsDigit5 == true) { if (res == "yes") { if (Settings.Default["role_bd"].ToString() != "admin") { tabControl1.TabPages.Remove(tabPage5); } button13.Visible = true; button3.Visible = true; button2.Visible = true; button16.Visible = false; button5.Visible = false; Button_Lable_false(); string result = client.search_tovar(textBox1.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (result == "yes") { textBox1.Text = ""; textBox2.Text = ""; textBox4.Text = ""; textBox3.Text = ""; textBox5.Text = ""; MessageBox.Show("Товар уже существует!"); } else { client.search_add_tovar(textBox1.Text, textBox2.Text, textBox3.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); client.search_add_tovar_on_sklad(textBox1.Text, textBox4.Text, textBox5.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); textBox1.Text = ""; textBox2.Text = ""; textBox4.Text = ""; textBox3.Text = ""; MessageBox.Show("Товар создан!"); } DataTable dt = client.vivod_tovar(Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); dataGridView1.DataSource = dt; } else { MessageBox.Show("Такого склада не существует!"); textBox4.Text = ""; } } else { MessageBox.Show("Введите цифры!"); textBox2.Text = ""; textBox3.Text = ""; textBox5.Text = ""; } } }
private void button1_Click(object sender, EventArgs e) { bool proverka = false; if (!radioButton1.Checked) { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "") { proverka = true; } if (!radioButton2.Checked && !radioButton3.Checked && !radioButton4.Checked) { proverka = true; } } else { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "") { proverka = true; } } if (proverka == false) { string role = "user"; string role_bd = ""; if (radioButton2.Checked) { role = "admin"; } var client = new ServiceReference.Service_kursClient("NetTcpBinding_IService_kurs"); string result = client.search(textBox1.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (result == "no") { client.addpeople(textBox1.Text, textBox2.Text, textBox3.Text, role, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); client.addpeople_info(textBox1.Text, dateTimePicker1.Value, textBox4.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); client.addpeople_info_two(textBox1.Text, textBox5.Text, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); if (radioButton1.Checked) { role_bd = "staff"; } if (radioButton3.Checked) { role_bd = "provider"; } if (radioButton4.Checked) { role_bd = "buyer"; } client.addpeople_post(textBox1.Text, textBox7.Text, textBox6.Text, role_bd, Settings.Default["role_bd"].ToString(), Settings.Default["token"].ToString()); MessageBox.Show("Пользователь успешно создан!"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox7.Text = ""; textBox6.Text = ""; radioButton1.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; radioButton4.Checked = false; } else { MessageBox.Show("Пользователь существует!"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox7.Text = ""; textBox6.Text = ""; radioButton1.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; radioButton4.Checked = false; } } else { MessageBox.Show("Все данные должны быть заполнены!"); } }