示例#1
0
        public ActionResult SaveChangeUserPass()
        {
            int userID = GetUserID();
            User user = GetUser();
            UserEditViewData viewData = new UserEditViewData();
            if (GetString("NewuserPassword") == "" || GetString("ReNewuserPassword") == "" || GetString("userPassword") == "")
            {
                viewData.ActionSucess = true;
                viewData.Message = "密码不能为空";
                viewData.javascriptMessage = "/user/UserEditPre";
                return View("MessagePage", viewData);
            }
            string strPassword = GetString("NewuserPassword");
            string strPasswordcof = GetString("ReNewuserPassword");
            string Password = GetString("userPassword");

            if (strPassword == strPasswordcof)
            {
                if (Security.MD5Encrypt(Password) == user.Password)
                {
                    CQGJ.SaveChanges();
                    viewData.ActionSucess = true;
                    viewData.Message = "密码修改成功";
                    viewData.javascriptMessage = "/user/UserEditPre";
                    return View("MessagePage", viewData);
                }
                else
                {
                    viewData.ActionSucess = true;
                    viewData.Message = "原密码错误";
                    viewData.javascriptMessage = "/user/UserEditPre";
                    return View("MessagePage", viewData);
                }
            }
            else
            {
                viewData.ActionSucess = true;
                viewData.Message = "两次输入密码不同";
                viewData.javascriptMessage = "/user/UserEditPre";
                return View("MessagePage", viewData);
            }
        }
示例#2
0
        /// <summary>
        /// 跳转到UserInfo页面
        /// </summary>
        /// <param name="id">SSO用户ID</param>
        public ActionResult UserInfo(int id)
        {
            int userID = GetUserID();
            int friendID = id;
            UserEditViewData viewData = new UserEditViewData();
            viewData.user = (from u in CQGJ.User
                             where u.UserID == friendID
                             select u).First();
            //HttpContext.Session["Photo"] = viewData.user.Photo;
            //HttpContext.Session["PhotoType"] = viewData.user.PhotoType;
            //cqgjPassport.GetEduLevelByUserID(userID);
            //viewData.Edulevels = cqgjPassport.GetEduLevelByUserID(userID).ToList().First();
            //viewData.SchoolRecords = cqgjPassport.GetSchoolRecordByUserID(userID).ToList().First();

            var friends = (from f in CQGJ.Friend
                           where f.MainUserID == userID && f.SubUserID == friendID
                           select f).ToList();
            if (friends.Count() > 0)
            { viewData.IsFriend = true; }
            return View("UserInfo", viewData);
        }
示例#3
0
        /// <summary>
        /// 用户修改自己信息
        /// </summary>
        public ActionResult UserEdit()
        {
            int userID = GetUser().UserID;
            UserEditViewData viewData = new UserEditViewData();
            User user = (from u in CQGJ.User
                         where u.UserID == userID
                         select u).First();

            if (Request.HttpMethod == "POST")
            {
                user.Username = GetString("UserName");
                user.Gender = GetString("Gender");
                user.Nation = GetString("Nation");
                user.Birthday = GetDate("Birthday");
                user.WorkingOrgName = GetString("WorkingOrgName");
                user.Position = GetString("Position");
                user.Telephone = GetString("Telephone");
                user.Cellphone = GetString("Cellphone");

                HttpPostedFileBase photo = this.HttpContext.Request.Files["photo"];
                int lenght = photo.ContentLength;
                if (lenght > 0)
                {
                    byte[] PhotoArray = new byte[lenght];
                    Stream PhotoStream = photo.InputStream;
                    PhotoStream.Read(PhotoArray, 0, lenght);
                    user.Photo = PhotoArray;
                }
                CQGJ.SaveChanges();
                Session["User"] = user;
            }
            viewData.user = user;
            return View("UserEdit", viewData);
        }
示例#4
0
        public void UserInfo(int id)
        {
            IsLogin();
            int userID = GetUserID();
            int friendID = id;
            UserEditViewData viewData = new UserEditViewData();
            viewData.user = cqgjPassport.GetCQGJUser(friendID);
            HttpContext.Session["Photo"] = viewData.user.Photo;
            HttpContext.Session["PhotoType"] = viewData.user.PhotoType;
            //cqgjPassport.GetEduLevelByUserID(userID);
            //viewData.Edulevels = cqgjPassport.GetEduLevelByUserID(userID).ToList().First();
            //viewData.SchoolRecords = cqgjPassport.GetSchoolRecordByUserID(userID).ToList().First();

            friendID = ToUserID(friendID);
            var friends = (from f in CQGJ.Friend
                           where f.MainUserID == userID && f.SubUserID == friendID
                           select f).ToList();
            if (friends.Count() > 0)
            { viewData.IsFriend = true; }
            RenderView("UserInfo", viewData);
        }
示例#5
0
 /// <summary>
 /// 用户修改自己信息
 /// </summary>
 //[RequireLogin]
 public void UserEdit()
 {
     IsLogin();
     int userID = ToPassportUserID(GetUserID());
     UserEditViewData viewData = new UserEditViewData();
     viewData.user = cqgjPassport.GetCQGJUser(userID);
     HttpContext.Session["Photo"] = viewData.user.Photo;
     HttpContext.Session["PhotoType"] = viewData.user.PhotoType;
     //cqgjPassport.GetEduLevelByUserID(userID);
     //viewData.Edulevels = cqgjPassport.GetEduLevelByUserID(userID).ToList().First();
     //viewData.SchoolRecords = cqgjPassport.GetSchoolRecordByUserID(userID).ToList().First();
     RenderView("UserEdit", viewData);
 }
示例#6
0
        public void SaveChangeUserPass()
        {
            int userID = GetUserID();
            UserEditViewData viewData = new UserEditViewData();
            if (GetString("NewuserPassword") == "" || GetString("ReNewuserPassword") == "" || GetString("userPassword") == "")
            {
                viewData.ActionSucess = true;
                viewData.Message = "密码不能为空";
                viewData.javascriptMessage = "/user/UserEditPre";
                RenderView("MessagePage", viewData);
            }
            string strPassword = GetString("NewuserPassword");
            string strPasswordcof = GetString("ReNewuserPassword");
            string Password = GetString("userPassword");
            passport.User user = cqgjPassport.GetCQGJUser(userID);
            if (strPassword == strPasswordcof)
            {
                if (Security.MD5Encrypt(Password) == user.Password)
                {
                    cqgjPassport.SavePswChange(userID, strPassword);
                    viewData.ActionSucess = true;
                    viewData.Message = "密码修改成功";
                    viewData.javascriptMessage = "/user/UserEditPre";
                    RenderView("MessagePage", viewData);
                }
                else
                {
                    viewData.ActionSucess = true;
                    viewData.Message = "原密码错误";
                    viewData.javascriptMessage = "/user/UserEditPre";
                    RenderView("MessagePage", viewData);
                }

            }
            else
            {
                viewData.ActionSucess = true;
                viewData.Message = "两次输入密码不同";
                viewData.javascriptMessage = "/user/UserEditPre";
                RenderView("MessagePage", viewData);
            }
        }