示例#1
0
        public StudentInfo(string loginUserName, string department)
        {
            this.loginUserName = loginUserName;
            this.department    = department;
            InitializeComponent();
            button3.BackColor = Color.LightSeaGreen;
            button4.BackColor = Color.LightSeaGreen;
            label2.Visible    = false;
            label27.Visible   = false;
            button1.Visible   = false;
            button2.Visible   = false;
            AutoScroll        = true;
            List <string> GetStudentInfo = sbl.GetStudentInfo(this.loginUserName, this.department);

            label27.Text = GetStudentInfo[0];
            label26.Text = GetStudentInfo[0];
            label25.Text = GetStudentInfo[2];
            label24.Text = GetStudentInfo[3];
            label23.Text = GetStudentInfo[4];
            label4.Text  = GetStudentInfo[5];
            label20.Text = GetStudentInfo[6];
            label21.Text = GetStudentInfo[7];
            label6.Text  = GetStudentInfo[8];
            label14.Text = GetStudentInfo[9];
            label22.Text = GetStudentInfo[10];
            label16.Text = GetStudentInfo[11];
            label28.Text = GetStudentInfo[12];
            label30.Text = GetStudentInfo[13];
            label18.Text = GetStudentInfo[14];
            label34.Text = GetStudentInfo[15];
            label36.Text = GetStudentInfo[16];
            label32.Text = GetStudentInfo[17];
            label38.Text = GetStudentInfo[18];

            if (department == "CS")
            {
                pictureBox1.Image = sbl.GetCSStudentImage(this.loginUserName);
            }
            else if (department == "EEE")
            {
                pictureBox1.Image = sbl.GetEEEStudentImage(this.loginUserName);
            }
            else if (department == "BBA")
            {
                pictureBox1.Image = sbl.GetBBAStudentImage(this.loginUserName);
            }

            AutoScroll = true;
        }
        public EditStudent(string selectedItem, string loginUserName, string department)
        {
            this.selectedItem  = selectedItem;
            this.loginUserName = loginUserName;
            this.department    = department;
            InitializeComponent();
            FillComboBox();
            button1.BackColor = Color.LightSeaGreen;
            button2.BackColor = Color.LightSeaGreen;
            button3.BackColor = Color.LightSeaGreen;
            AutoScroll        = true;
            List <string> studentInfo = sbl.GetStudentInfo(selectedItem, department);

            textBox1.Text  = studentInfo[0];
            textBox2.Text  = studentInfo[1];
            textBox3.Text  = studentInfo[2];
            textBox8.Text  = studentInfo[3];
            textBox4.Text  = studentInfo[4];
            textBox5.Text  = studentInfo[5];
            textBox7.Text  = studentInfo[6];
            textBox6.Text  = studentInfo[7];
            textBox9.Text  = studentInfo[8];
            textBox13.Text = studentInfo[9];
            textBox14.Text = studentInfo[10];
            textBox15.Text = studentInfo[11];
            gender         = studentInfo[12];
            if (gender == "Male")
            {
                radioButton1.Checked = true;
            }
            else if (gender == "Female")
            {
                radioButton2.Checked = true;
            }
            bloodGroup = studentInfo[16];
            if (bloodGroup == "A+")
            {
                comboBox1.SelectedIndex = 1;
            }
            else if (bloodGroup == "A-")
            {
                comboBox1.SelectedIndex = 2;
            }
            else if (bloodGroup == "B+")
            {
                comboBox1.SelectedIndex = 3;
            }
            else if (bloodGroup == "B-")
            {
                comboBox1.SelectedIndex = 4;
            }
            else if (bloodGroup == "AB+")
            {
                comboBox1.SelectedIndex = 5;
            }
            else if (bloodGroup == "AB-")
            {
                comboBox1.SelectedIndex = 6;
            }
            else if (bloodGroup == "O+")
            {
                comboBox1.SelectedIndex = 7;
            }
            else if (bloodGroup == "O-")
            {
                comboBox1.SelectedIndex = 8;
            }
            textBox12.Text = studentInfo[13];
            textBox11.Text = studentInfo[14];
            maritalStatus  = studentInfo[15];
            if (maritalStatus == "Married")
            {
                checkBox1.Checked = true;
            }
            else if (maritalStatus == "Unmarried")
            {
                checkBox2.Checked = true;
            }
            textBox16.Text = studentInfo[17];
            textBox17.Text = studentInfo[18];

            if (department == "CS")
            {
                pictureBox1.Image = sbl.GetCSStudentImage(selectedItem);
            }
            else if (department == "EEE")
            {
                pictureBox1.Image = sbl.GetEEEStudentImage(selectedItem);
            }
            else if (department == "BBA")
            {
                pictureBox1.Image = sbl.GetBBAStudentImage(selectedItem);
            }
        }