コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (blc.IsExistAdmin(textBox1.Text))
            {
                MessageBox.Show("Admin with same User Name already exist.\nPlease use another UserName.");
            }
            else if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" ||
                     textBox7.Text == "" || textBox8.Text == "")
            {
                MessageBox.Show("Please fill all the information correctly.");
            }
            else if (textBox1.Text.Length != 8)
            {
                MessageBox.Show("Please use 8 character for a User Name.");
            }
            else
            {
                blc.AddAdmin(textBox1.Text, textBox2.Text, textBox3.Text, textBox8.Text, textBox4.Text, textBox5.Text, textBox7.Text, textBox6.Text);
                this.Hide();
                AdminSettings obj = new AdminSettings(loginUserName);
                obj.Show();

                MessageBox.Show("Admin added successfully.");
            }
        }
コード例 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != selectedItem && blc.IsExistAdmin(textBox1.Text))
     {
         MessageBox.Show("Admin with same User Name already exist.\nPlease use another UserName.");
     }
     else if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" ||
              textBox7.Text == "" || textBox8.Text == "")
     {
         MessageBox.Show("Please fill all the information correctly.");
     }
     else if (textBox1.Text.Length != 8)
     {
         MessageBox.Show("Please use 8 character for a User Name.");
     }
     else
     {
         blc.UpdateAdmin(selectedItem, textBox1.Text, textBox2.Text, textBox3.Text, textBox8.Text, textBox4.Text, textBox5.Text, textBox7.Text, textBox6.Text);
         //selectedItem = textBox1.Text;
         this.Hide();
         AdminInfo obj = new AdminInfo(selectedItem, loginUserName);
         obj.Show();
         MessageBox.Show("Admin informaton updated successfully.");
     }
 }