/// <summary>
        /// 登录按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
            {
                return;
            }
            string msg;
            string id  = textBox1.Text.Trim();
            string pwd = textBox2.Text.Trim();

            if (ucSwitch1.Checked)
            {
                TeacherBLL bll = new TeacherBLL();
                Boolean    b   = bll.GetTeacherInfo(id, pwd, out msg);
                if (b)
                {
                    //FrmTips.ShowTipsSuccess(this, msg);
                    //fea.Obj = bll.GetTeacher(id);
                    //FrmTeacherMain frmTeacher = new FrmTeacherMain();
                    //this.evtFt += new EventHandler(frmTeacher.SetTxt);
                    //if (this.evtFt!=null)
                    //{
                    //    this.evtFt(this, fea);

                    //    frmTeacher.ShowDialog();

                    //}
                    FrmTips.ShowTipsSuccess(this, msg);
                    this.Tag          = bll.GetTeacher(id);
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    FrmTips.ShowTipsError(this, msg);
                }
            }
            else
            {
                StudentBLL bll = new StudentBLL();
                Student    stu = new Student();
                bool       b   = bll.getStudentInfoBySid(id, pwd, out msg, out stu);
                if (b)
                {
                    this.Tag          = stu;
                    this.DialogResult = DialogResult.Yes;
                }
                else
                {
                    FrmTips.ShowTipsError(this, msg);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 个人基本信息
        /// </summary>
        /// <returns></returns>
        public ActionResult OwnInfo()
        {
            User      user  = (User)Session["User"];
            DataTable table = null;

            switch (user.RuleName)
            {
            case "学生":
                StudentBLL student = new StudentBLL();
                table               = student.GetStudent(user.ID);
                ViewBag.LoginID     = table.Rows[0]["LoginID"].ToString();
                ViewBag.Sex         = (table.Rows[0]["Sex"].ToString() == "True" ? "男" : "女");
                ViewBag.Age         = table.Rows[0]["Age"].ToString();
                ViewBag.RuleName    = table.Rows[0]["RuleName"].ToString();
                ViewBag.ChangeTime  = Convert.ToDateTime(table.Rows[0]["ChangeTime"]).ToString("yyyy年MM月dd日hh时mm分");
                ViewBag.ClassName   = table.Rows[0]["ClassName"].ToString();
                ViewBag.ClassMaster = table.Rows[0]["TeacherName"].ToString();
                break;

            case "教师":
                TeacherBLL teacher = new TeacherBLL();
                table               = teacher.GetTeacher(user.ID);
                ViewBag.LoginID     = table.Rows[0]["LoginID"].ToString();
                ViewBag.Sex         = (table.Rows[0]["Sex"].ToString() == "True" ? "男" : "女");
                ViewBag.Age         = table.Rows[0]["Age"].ToString();
                ViewBag.ChangeTime  = Convert.ToDateTime(table.Rows[0]["ChangeTime"]).ToString("yyyy年MM月dd日hh时mm分");
                ViewBag.PostName    = table.Rows[0]["PostName"].ToString();
                ViewBag.ClassMaster = (table.Rows[0]["ClassName"].ToString() == "" ? "不是" : "是");
                ViewBag.ClassName   = (table.Rows[0]["ClassName"].ToString() == "" ? "不定" : table.Rows[0]["ClassName"].ToString());
                ViewBag.CourseName  = table.Rows[0]["CourseName"].ToString();
                break;

            case "管理员":
                AdminBLL admin = new AdminBLL();
                table              = admin.GetAdmin(user.ID);
                ViewBag.LoginID    = table.Rows[0]["LoginID"].ToString();
                ViewBag.Sex        = (table.Rows[0]["Sex"].ToString() == "True" ? "男" : "女");
                ViewBag.Age        = table.Rows[0]["Age"].ToString();
                ViewBag.RuleName   = table.Rows[0]["RuleName"].ToString();
                ViewBag.ChangeTime = Convert.ToDateTime(table.Rows[0]["ChangeTime"]).ToString("yyyy年MM月dd日hh时mm分");
                break;

            default:
                break;
            }
            return(View());
        }