Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (sbl.IsExistCSStudent(this.loginUserName) || sbl.IsExistEEEStudent(this.loginUserName) || sbl.IsExistBBAStudent(this.loginUserName))
            {
                this.Hide();
                StudentPage sp = new StudentPage(this.loginUserName, this.department);      //for student
                sp.Show();
            }
            else
            {
                this.Hide();
                StudentsList sl = new StudentsList(this.loginUserName, this.department);       //for admin
                sl.Show();
            }

            //if (loginUserName != null && loginUserName.Length == 8)
            //{
            //    this.Hide();
            //    StudentsList sl = new StudentsList(loginUserName, department);
            //    sl.Show();
            //}
            //else if (loginUserName != null && loginUserName.Length == 6)
            //{
            //    this.Hide();
            //    StudentPage sp = new StudentPage(loginUserName, department);
            //    sp.Show();
            //}
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text != selectedItem && sbl.IsExistCSStudent(textBox1.Text)) || (textBox1.Text != selectedItem && sbl.IsExistEEEStudent(textBox1.Text)) || (textBox1.Text != selectedItem && sbl.IsExistBBAStudent(textBox1.Text)))
            {
                MessageBox.Show("Student with same User Name already exist.\nPlease use another UserName.");
            }
            else if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox8.Text == "" || textBox4.Text == "" || textBox5.Text == "" ||
                     textBox7.Text == "" || textBox6.Text == "" || textBox9.Text == "" || textBox13.Text == "" || textBox14.Text == "" || textBox15.Text == "" ||
                     comboBox1.SelectedIndex == 0 || textBox12.Text == "" || textBox11.Text == "" || textBox16.Text == "" || textBox17.Text == "" || pictureBox1.Image == null)
            {
                MessageBox.Show("Please fill all the information correctly.");
            }
            else if (textBox1.Text.Length != 6)
            {
                MessageBox.Show("Please use 6 character for a User Name.");
            }
            else
            {
                bloodGroup = comboBox1.Items[comboBox1.SelectedIndex].ToString();

                if (radioButton1.Checked == true)
                {
                    gender = "Male";
                }
                else
                {
                    gender = "Female";
                }

                if (checkBox1.Checked == true)
                {
                    maritalStatus = "Married";
                }
                else
                {
                    maritalStatus = "Unmarried";
                }

                sbl.UpdateStudent(selectedItem, textBox1.Text, textBox2.Text, textBox3.Text, textBox8.Text, textBox4.Text, textBox5.Text, textBox7.Text, textBox6.Text, textBox9.Text, textBox13.Text, textBox14.Text, textBox15.Text, gender, textBox12.Text, textBox11.Text, maritalStatus, bloodGroup, textBox16.Text, textBox17.Text, pictureBox1.Image, department);
                this.Hide();
                StudentInfo fl = new StudentInfo(loginUserName, department);
                fl.Show();

                MessageBox.Show("Student information updated successfully.");
            }
        }