private void button1_Click(object sender, EventArgs e) { Regex regex = new Regex("^[А-Яа-я]+$"); if (regex.IsMatch(textBox1.Text)) { changes ch = new changes(); ch.name_group = textBox1.Text; ch.IDs_privgr = "-1"; ch.name_priv = "-1"; ch.name = "-11"; OperationChangesClient operationclient = new OperationChangesClient("BasicHttpBinding_IOperationChanges"); int flag = operationclient.add_group(ch); if (flag == 1) { MessageBox.Show("Операция прошла успешно."); } else { MessageBox.Show("Ошибка! Попробуйте еще раз."); } this.Close(); } else { MessageBox.Show("Некорректный ввод."); } }
public List <object> GetL(object filter) { OperationChangesClient operationclient = new OperationChangesClient("BasicHttpBinding_IOperationChanges"); object[] o = operationclient.GetList(filter); List <object> lo = o.ToList(); return(lo); }
private void button3_Click(object sender, EventArgs e) { w_client.OperationChangesRef.changes ch = new w_client.OperationChangesRef.changes(); ch.ID_person = Convert.ToInt32(this.textBox1.Text); for (int i = 0; i <= dataGridView2.RowCount - 1; i++) { try { if (dataGridView2.Rows[i].Cells[2].Value.ToString() == "True") { if (ch.IDs_privch != null) { ch.IDs_privch = ch.IDs_privch + ", " + dataGridView2.Rows[i].Cells[0].Value; } else { ch.IDs_privch = dataGridView2.Rows[i].Cells[0].Value.ToString(); } } } catch { } } Form2 a = new Form2(); w_client.OperationChangesRef.Group_ g = new w_client.OperationChangesRef.Group_(); g.name = comboBox1.SelectedItem.ToString(); g.tableName = "data_base.groups"; List <object> s = a.GetL(g); g = (w_client.OperationChangesRef.Group_)s[0]; ch.ID_group = g.ID_group; ch.surname = textBox2.Text; ch.name = textBox3.Text; ch.middle_name = textBox4.Text; OperationChangesClient operationclient = new OperationChangesClient("BasicHttpBinding_IOperationChanges"); int flag = operationclient.update_per_priv(ch); int flag_ = operationclient.update_pers(ch); if ((flag == 1) && (flag_ == 1)) { MessageBox.Show("Операция прошла успешно."); } else { MessageBox.Show("Ошибка! Попробуйте еще раз."); } }
private void button2_Click(object sender, EventArgs e) { Regex regex = new Regex("^[А-Яа-я]+$"); if (regex.IsMatch(textBox2.Text)) { changes ch = new changes(); ch.ID_group = Convert.ToInt32(textBox1.Text); ch.name_group = textBox2.Text; try { for (int i = 0; i <= dataGridView1.RowCount - 1; i++) { if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "True") { if (ch.IDs_privgr != null) { ch.IDs_privgr = ch.IDs_privgr + ", " + dataGridView1.Rows[i].Cells[0].Value; } else { ch.IDs_privgr = dataGridView1.Rows[i].Cells[0].Value.ToString(); } } } } catch { } Form2 ad = new Form2(); ch.ID_person = -1; ch.name = "-1"; //admin ad = new admin(); OperationChangesClient operationclient = new OperationChangesClient("BasicHttpBinding_IOperationChanges"); int flag = operationclient.update_groups(ch); if (flag == 1) { MessageBox.Show("Операция прошла успешно."); } else { MessageBox.Show("Ошибка! Попробуйте еще раз."); } } else { MessageBox.Show("Ошибка! Некорректный ввод."); } }
private void button1_Click(object sender, EventArgs e) { Regex regex = new Regex("^[А-Яа-я]+$"); if (regex.IsMatch(textBox2.Text) && regex.IsMatch(textBox3.Text) && regex.IsMatch(textBox4.Text)) { Form2 ad = new Form2(); w_client.OperationChangesRef.changes ch = new w_client.OperationChangesRef.changes(); ch.surname = textBox2.Text; ch.name = textBox3.Text; ch.middle_name = textBox4.Text; Dictionary <string, int> namegr_id = new Dictionary <string, int>(); w_client.OperationChangesRef.Group_ gr = new w_client.OperationChangesRef.Group_(); gr.tableName = "data_base.groups"; List <object> g = ad.GetL(gr); foreach (object g_ in g) { w_client.OperationChangesRef.Group_ group = (w_client.OperationChangesRef.Group_)g_; try { namegr_id.Add(group.name, group.ID_group); } catch { } } ch.ID_group = namegr_id[comboBox1.SelectedItem.ToString()]; OperationChangesClient operationclient = new OperationChangesClient("BasicHttpBinding_IOperationChanges"); int flag = operationclient.add_pers(ch); if (flag == 1) { MessageBox.Show("Операция прошла успешно."); } else { MessageBox.Show("Ошибка! Попробуйте еще раз."); } } else { MessageBox.Show("Ошибка! Некорректный ввод."); } }