Beispiel #1
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(LoginForm.getForm());
     //Application.Run(AdminShowForm.GetForm());
     //Application.Run(StudentShowForm.GetForm());
 }
Beispiel #2
0
        /// <summary>
        /// 点击提交,保存学生注册的个人信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RsbtnSubmit_Click(object sender, EventArgs e)
        {
            CheckUserName(rsNameInput.Text.Trim(), rsNameInfo);
            CheckPhone(rsPhone.Text.Trim(), rsphoneInfo);
            CheckEmail(rsEmail.Text.Trim(), rsemailInfo);
            CheckCbInput(rsCollege, rsCollegeInfo, "学院");
            CheckCbInput(rsMajorInput, rsMajorInfo, "专业");
            CheckCbInput(rsClass, rsClassInfo, "班级");


            if (rsNameInfo.Visible || rsCollegeInfo.Visible || rsMajorInfo.Visible || rsClassInfo.Visible || rsphoneInfo.Visible || rsemailInfo.Visible)
            {
                MessageBox.Show("信息填入错误,提交失败");
            }
            else
            {
                string  userName = runInput.Text.Trim();
                string  userPwd  = rupInput.Text;
                string  name     = rsNameInput.Text;
                char    gender   = rsGenderM.Checked ? '男' : '女';
                string  birthday = rsAgeInput.Value.Date.ToShortDateString();
                string  college  = rsCollege.SelectedItem.ToString();
                string  major    = rsMajorInput.SelectedItem.ToString();
                string  classes  = rsClass.SelectedItem.ToString();
                string  phone    = rsPhone.Text;
                string  email    = rsEmail.Text;
                Student stu      = new Student(userName, userPwd, name, birthday, gender, phone, email, college, major, classes);
                if (MyData.AddManOfCate(category, userName, stu))
                {
                    MessageBox.Show("提交成功");
                    LoginForm loginForm = LoginForm.getForm();
                    loginForm.loginName = runInput.Text.Trim();
                    loginForm.loginPwd  = rupInput.Text;
                    loginForm.category  = category;
                    MyUtils.SetFocus(loginForm.nameTextBox);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("提交失败");
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 管理员点击提交按钮时,检查姓名、手机号、邮箱,加入数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RaSubmit_Click(object sender, EventArgs e)
        {
            CheckUserName(raNameInput.Text.Trim(), raNameInfo);
            CheckPhone(raPhoneInput.Text.Trim(), raPhoneInfo);
            CheckEmail(raEmailInput.Text.Trim(), raEmailInfo);

            if (raNameInfo.Visible || raPhoneInfo.Visible || raEmailInfo.Visible)
            {
                MessageBox.Show("输入不合法,提交失败");
            }
            else
            {
                string aName     = runInput.Text.Trim();
                string aPwd      = rupInput.Text;
                string aUserName = raNameInput.Text.Trim();
                string aBirthday = raBirthday.Value.Date.ToShortDateString();
                char   agender   = raGenderM.Checked ? '男' : '女';
                string aPhone    = raPhoneInput.Text.Trim();
                string aEmail    = raEmailInput.Text.Trim();

                // 如果添加成功 提示 关闭注册框
                if (MyData.AddAdmin(aName, new Admin(aName, aPwd, aUserName, aBirthday, agender, aPhone, aEmail)))
                {
                    MessageBox.Show("提交成功");
                    LoginForm loginForm = LoginForm.getForm();
                    loginForm.loginName = runInput.Text.Trim();
                    loginForm.loginName = rupInput.Text;
                    loginForm.category  = category;
                    MyUtils.SetFocus(loginForm.nameTextBox);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("提交失败");
                }
            }
        }
Beispiel #4
0
 private void StudentShowForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     LoginForm.getForm().Dispose();
 }
Beispiel #5
0
 /// <summary>
 /// 点击返回登录
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void RLogin_Click(object sender, EventArgs e)
 {
     this.Close();
     LoginForm.getForm().Show();
 }