Beispiel #1
0
        /// <summary>
        /// Thực hiện thao tác đổi mật khẩu
        /// </summary>
        /// <param name="username"></param>
        /// <param name="passwordOld"></param>
        /// <param name="password"></param>
        /// <param name="passwordRe"></param>
        /// <param name="secText"></param>
        /// <param name="thetype"></param>
        /// <returns></returns>
        public JsonResult ChangeMyPass(string username, string passwordOld, string password, string passwordRe, string secText, string thetype)
        {
            //Kiểm tra phân quyền
            if (ses.isLogin() < 0)
            {
                return(Json(new { ret = -1 }, JsonRequestBehavior.AllowGet));
            }
            if (string.Compare(password, passwordRe, false) != 0)
            {
                return(Json(new { ret = -1 }, JsonRequestBehavior.AllowGet));
            }
            int ret = -1;

            if (ses.loginType == "LECTURER")
            {
                //if (thetype == "LECTURER")
                //{
                //Lấy dữ iệu
                STAFF_BUS bus = new STAFF_BUS();
                ret = bus.changePass(username, passwordOld, password);
                bus.CloseConnection();
                //}
            }
            else//STUDENT
            {
                STUDENT_BUS bus = new STUDENT_BUS();
                ret = bus.changePass(username, passwordOld, password);
                bus.CloseConnection();
            }

            //Trả về cho client
            return(Json(new { ret = ret, thetype = thetype }, JsonRequestBehavior.AllowGet));
        }