示例#1
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.");
     }
 }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminInfo obj = new AdminInfo(selectedItem, loginUserName);

            obj.Show();
        }
示例#3
0
        private void ItemSelected(object sender, MouseEventArgs e)
        {
            string selectedItem = listBox1.SelectedItem.ToString();

            if (loginUserName == "admin123" || selectedItem == loginUserName)
            {
                this.Hide();
                AdminInfo obj = new AdminInfo(selectedItem, loginUserName);
                obj.Show();
            }
            else
            {
                MessageBox.Show("Can't show other admin information");
            }

            //if ((loginUserName != "root" && listBox1.SelectedItem.ToString() == "root") || (loginUserName != "root" && listBox1.SelectedItem.ToString() != loginUserName))
            //{
            //    MessageBox.Show("Can not show other admin information.");
            //}
            //else
            //{
            //    this.Hide();
            //    AdminInfo obj = new AdminInfo(selectedItem, loginUserName);
            //    obj.Show();
            //}
        }