Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox1.Text.Length != 2)
     {
         MessageBox.Show("Please fill up the boxes properly!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (CheckDuplicateID(label5.Text + textBox1.Text + label6.Text + textBox2.Text))
     {
         MessageBox.Show("Duplicate ID! Please enter unique ID.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         ManageSubForm f = new ManageSubForm()
         {
             id       = label5.Text + textBox1.Text + label6.Text + textBox2.Text,
             position = comboBox1.Text
         };
         f.Show();
         button1.Enabled = button2.Enabled = button3.Enabled = button5.Enabled = false;
         textBox1.Text   = textBox2.Text = "";
     }
 }
Beispiel #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox3.Text.Equals("") || textBox4.Text.Equals("") || textBox4.Text.Length != 2)
     {
         MessageBox.Show("Please fill up the boxes properly!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (!CheckDuplicateID(label8.Text + textBox4.Text + label7.Text + textBox3.Text))
     {
         MessageBox.Show("ID doesn't exist!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         DataTable dt = dl.GetStaff();
         Console.WriteLine(dt.Rows[index]["sName"].ToString());
         ManageSubForm f = new ManageSubForm(dt.Rows[index]["sName"].ToString(), dt.Rows[index]["sPhone"].ToString(), dt.Rows[index]["sPass"].ToString(), dt.Rows[index]["sSalary"].ToString())
         {
             id       = label8.Text + textBox4.Text + label7.Text + textBox3.Text,
             position = comboBox2.Text
         };
         f.Show();
         button1.Enabled = button2.Enabled = button3.Enabled = button5.Enabled = false;
         textBox3.Text   = textBox4.Text = "";
     }
 }