private void buttonMain_Click(object sender, EventArgs e)
        {
            StudentMainForm main = new StudentMainForm();

            this.Hide();
            main.Show();
        }
Exemplo n.º 2
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (radiobtnStudent.IsChecked == true)
            {
                BaseResult br = sts.login(txtUserName.Text, txtPassword.Password);
                if (br.code == 0)
                {
                    MessageBox.Show("恭喜你已登录成功");
                    int    sex = sts.getSexByStuSpecId(txtUserName.Text.ToString());
                    string pngfile;
                    //headImage是image控件名
                    if (sex == 0)
                    {
                        pngfile = @"..\..\Resources\女生头像.png";
                    }
                    else
                    {
                        pngfile = @"..\..\Resources\男生头像.png";
                    }
                    StudentMainForm smf = new StudentMainForm(txtUserName.Text, (string)br.data, pngfile);

                    smf.Show();
                    this.Visibility = Visibility.Hidden;
                }
                else
                {
                    MessageBox.Show(br.msg);
                }
            }
            else if (radiobtnTeacher.IsChecked == true)
            {
                BaseResult br = tts.login(txtUserName.Text, txtPassword.Password);
                if (br.code == 0)
                {
                    MessageBox.Show("恭喜你已登录成功");

                    int sex = tts.getSexByTeaSpecId(txtUserName.Text.ToString());

                    string pngfile;
                    //headImage是image控件名
                    if (sex == 0)
                    {
                        pngfile = @"..\..\Resources\女教师.png";
                    }
                    else
                    {
                        pngfile = @"..\..\Resources\男教师.png";
                    }
                    TeacherMainForm tmf = new TeacherMainForm(txtUserName.Text, (string)br.data, pngfile);
                    //txtUserName.Text是教师工号Z0004520
                    //(string)br.data是刘树栋
                    tmf.Show();
                    this.Visibility = System.Windows.Visibility.Hidden;
                }
                else
                {
                    MessageBox.Show(br.msg);
                }
            }
            else if (radiobtnAdmin.IsChecked == true)
            {
                BaseResult br = ats.login(txtUserName.Text, txtPassword.Password);
                if (br.code == 0)
                {
                    MessageBox.Show("恭喜你已登录成功");

                    AdminIndex sm = new AdminIndex(txtUserName.Text, (string)br.data);
                    sm.Show();
                }
                else
                {
                    MessageBox.Show(br.msg);
                }
            }
        }