Esempio n. 1
0
        public DataSet GetTable(LoginUserModel objLoginUserModel)
        {
            BaseTale();
              SqlString += "Where UserId'" + objLoginUserModel.UserId + "'Or UserRole='"+objLoginUserModel.UserRole+"'Or LoginCount='"+objLoginUserModel.LoginCount+"'";

              return (objDataBaseOperateClass2.GetDataSet(SqlString));
        }
Esempio n. 2
0
        //根据条件搜索用户名,用于验证用户名与密码、身份是否一致
        //这是程序启动后,第一条发送到SQL数据库的语句;容易出现异常,所以这里进行异常捕捉、处理。
        public SqlDataReader LoginUserRead(LoginUserModel objLoginUserModel)
        {
            SqlString = "Select UserId From LoginUser Where UserId='"+objLoginUserModel.UserId+"' AND UserPw='"+objLoginUserModel.UserPw+"' AND UserRole='"+objLoginUserModel.UserRole+"'";
             //try{
              return (objDataBaseOperateClass2.getread(SqlString));
             #region MyRegion
               //}
             //   catch (Exception e1)
             //       {
             //           if (MessageBox.Show("登录失败!你是否仔细阅读了使用说明呢?请根据错误消息进行处理。\n是否查看错误消息?", "温馨提醒", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
             //           {
             //             MessageBox.Show("错误消息:" + e1);
             //             //MessageBox.Show("即将返回使用说明窗口!");
             //             MessageBox.Show("再见!如需要登录使用,请重新启动程序,仔细阅读说明后再操作!", "温馨提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
             //             //Application.Exit();   //执行这一句后,为什么不能把整个程序结束呢?还会继续执行。怎样停止?或者改为调用其它窗口也可以。
             //             //Application.ExitThread();

             //           }
             //           else
             //           {
             //               //MessageBox.Show("即将返回使用说明窗口!");
             //MessageBox.Show("再见!如需要登录使用,请重新启动程序,仔细阅读说明后再操作!","温馨提醒",MessageBoxButtons.OK, MessageBoxIcon.Information);
             //               Application.Exit();
             //               ////▲▲▲在类库文件可以调用窗口吗?要加using?加哪个?还是要通过另外一个方法来调用出窗口?
             //           }
             //               SqlDataReader aa=null;
             //               return aa;
                    //return (objDataBaseOperateClass2.getread(SqlString));
             //▲▲▲怎样【不经过数据库】而返回一个空的SqlDataReader类型的变量,当连接不到数据库时,想让它返回一个空的,避免再次异常,
            //文本控件的空值可以表示为:XXX.Text="",那SqlDataReader类型声明的变量如何赋空值?
            #endregion

            // }
        }
Esempio n. 3
0
        //Add:
        public bool AddLoginUser(LoginUserModel objLoginUserModel)
        {
            objLoginUserModel.UserPw = GetMD5.GetMd5.GetMd5_32(objLoginUserModel.UserId + objLoginUserModel.UserPw);

              SqlString = "Insert into LoginUser(UserId,UserRole,UserPw,LoginCount) Values('" + objLoginUserModel.UserId + "','" + objLoginUserModel.UserRole + "','" + objLoginUserModel.UserPw + "','" + objLoginUserModel.LoginCount + "')";

              return (objDataBaseOperateClass2.GetExecute(SqlString));
        }
Esempio n. 4
0
        private void frmStuMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            LoginUIBLL objLoginUIBLL = new LoginUIBLL();
            LoginUserModel objLoginUserModel = new LoginUserModel();
            objLoginUserModel.UserId = toolLoginUserId.Text;
            objLoginUIBLL.UpdateLoginUserStateClose();

            Application.Exit();
        }
Esempio n. 5
0
        public DataTable ScoreStuSearch(LoginUserModel objLoginUserModel)
        {
            string SqlStringStu="Select SelCourse.StuNum AS 学号,StuName AS 姓名 ,CourseName As 课程,SelCourse.Score AS 成绩 From SelCourse Join Student on Student.StuNum=SelCourse.StuNum join Course on Course.CourseNum=SelCourse.CourseNum Where SelCourse.StuNum='"+objLoginUserModel.UserId+"'";

                DataBaseOperateClass2 objDataBaseOperate2 = new DataBaseOperateClass2();

                DataTable objDataTable;

                return objDataTable = objDataBaseOperate2.ShowTable(SqlStringStu);
        }
Esempio n. 6
0
        private void ChangeLoginRole_Click(object sender, EventArgs e)
        {
            LoginUI objLoginUI = new LoginUI();
            objLoginUI.Show();
            //this.Close();
            this.Hide();

            LoginUIBLL objLoginUIBLL = new LoginUIBLL();
            LoginUserModel objLoginUserModel = new LoginUserModel();
            objLoginUserModel.UserId = toolLoginUserId.Text;
            objLoginUIBLL.UpdateLoginUserStateClose();
        }
Esempio n. 7
0
        private void btnPost_Click(object sender, EventArgs e)
        {
            #region 获取当前登录用户ID
            LoginUIBLL objLoginUIBLL = new LoginUIBLL();
            LoginUserModel objLoginUserModel = new LoginUserModel();
            SqlDataReader SqlRead;
            SqlRead = objLoginUIBLL.LoginUserRead();

            if (SqlRead.Read() == true)
            {
                objLoginUserModel.UserId = SqlRead["UserId"].ToString();
            }
            #endregion

            string SqlString="Insert into V_StuWebComment";

            #region 类型选择
            if (rdbSuggest.Checked == true)
            {
                SqlString += "(学号,建议) Values('" + objLoginUserModel.UserId + "','" + txtComment.Text + "')";
            }
            if (rdbCriticism.Checked == true)
            {
                SqlString += "(学号,批评) Values('" + objLoginUserModel.UserId + "','" + txtComment.Text + "')";
            }

            if (rdbconsult.Checked == true)
            {
                SqlString += "(学号,咨询) Values('" + objLoginUserModel.UserId + "','" + txtComment.Text + "')";
            }
            #endregion

            DataBaseOperateClass2 objDataBaseOperateClass2 = new DataBaseOperateClass2();

            #region 异常处理
            try
            {
                if (objDataBaseOperateClass2.GetExecute(SqlString) == true)
                    MessageBox.Show("成功提交!谢谢参与!");
                else
                    MessageBox.Show("抱歉!提交失败!请查看错误消息:");
            }
            catch (Exception e1)
            {
                MessageBox.Show("抱歉!提交失败!请查看错误消息:");
                MessageBox.Show("错误消息:" + e1);
            }
            #endregion
        }
Esempio n. 8
0
 //Change LoginUser States
 public bool UpdateLoginUserStates(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.UpdateLoginUserStateOpen(objLoginUserModel));
 }
Esempio n. 9
0
 //Search:
 public DataTable SearchLoginUser(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.SearchLoginUser(objLoginUserModel));
 }
Esempio n. 10
0
 //按条件从数据库读取内容
 public SqlDataReader LoginUserRead(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.LoginUserRead(objLoginUserModel));
 }
Esempio n. 11
0
 public DataSet GetTable(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.GetTable(objLoginUserModel));
 }
Esempio n. 12
0
 //Del:
 public bool DelLoginUser(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.DelLoginUser(objLoginUserModel));
 }
Esempio n. 13
0
 //Add;
 public bool AddLoginUser(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.AddLoginUser(objLoginUserModel));
 }
Esempio n. 14
0
 public DataTable LoginUserSearchStuInfo(LoginUserModel objLoginUserModel)
 {
     return (objStudentDAL.LoginUserSearchStuInfo(objLoginUserModel));
 }
Esempio n. 15
0
 //Update:
 public bool UpdatLoginUser(LoginUserModel objLoginUserModel)
 {
     return (objLoginUIDAL.UpdateLoginUser(objLoginUserModel));
 }
Esempio n. 16
0
        //Search:
        public DataTable SearchLoginUser(LoginUserModel objLoginUserModel)
        {
            SqlString = "Select UserId as 用户编号,UserRole AS 用户身份, UserPw as 用户密码 ,LoginCount AS 登录次数 From LoginUser Where UserId='" + objLoginUserModel.UserId + "'Or UserRole='" + objLoginUserModel.UserRole + "'Or LoginCount='" + objLoginUserModel.LoginCount + "'";

              return objDataBaseOperateClass2.ShowTable(SqlString);
        }
Esempio n. 17
0
        //Del:
        public bool DelLoginUser(LoginUserModel objLoginUserModel)
        {
            SqlString = "Delete From LoginUser Where UserId='"+objLoginUserModel.UserId+"'";

            return (objDataBaseOperateClass2.GetExecute(SqlString));
        }
Esempio n. 18
0
        //Update:
        public bool UpdateLoginUser(LoginUserModel objLoginUserModel)
        {
            objLoginUserModel.UserPw = GetMD5.GetMd5.GetMd5_32(objLoginUserModel.UserId + objLoginUserModel.UserPw);

            SqlString ="Update LoginUser Set UserId='"+objLoginUserModel.UserId+"',UserRole='"+objLoginUserModel.UserRole+"',UserPw='"+objLoginUserModel.UserPw+"',LoginCount='"+objLoginUserModel.LoginCount+"'where UserID='"+objLoginUserModel.UserId+"'";

            return (objDataBaseOperateClass2.GetExecute(SqlString));
        }
Esempio n. 19
0
        //Changes LoginUser's States Use to Show Login Interface
        public bool UpdateLoginUserStateOpen(LoginUserModel objLoginUserModel)
        {
            SqlString = "Update LoginUser Set State='连接' where UserId='" + objLoginUserModel.UserId + "'";

              return (objDataBaseOperateClass2.GetExecute(SqlString));
        }
Esempio n. 20
0
 public DataTable ScoreStuSearch(LoginUserModel objLoginUserModel)
 {
     return (objScoreSearchDAL.ScoreStuSearch(objLoginUserModel));
 }
Esempio n. 21
0
 //按当前登录的身份来查找
 public DataTable LoginUserSearchStuInfo(LoginUserModel objLoginUserModel)
 {
     string SqlString = "Select * From Student Where StuNum='"+objLoginUserModel.UserId + "'";
      return (objDataBaseOperateClass2.ShowTable(SqlString));
 }