예제 #1
0
        public ActionResult RegisterUser()
        {
            var flag = false;

            try
            {
                var model = new UserInfoModel()
                {
                    Account           = Normal.ListStr(Request["Account"]),
                    Password          = Normal.CheckPoint(PwdUtil.MD5Encrypt(Request["Password"])),
                    Email             = Normal.ListStr(Request["Email"]),
                    Name              = Normal.ListStr(Request["Name"]),
                    Sex               = Normal.ListStr(Request["Sex"]),
                    BirthDay          = Normal.ListStr(Request["BirthDay"]),
                    HomeTown          = Normal.ListStr(Request["HomeTown"]),
                    Marriage          = Normal.ListStr(Request["Marriage"]),
                    TheLatter         = Normal.ListStr(Request["TheLatter"]),
                    Position          = Normal.ListStr(Request["Position"]),
                    Company           = Normal.ListStr(Request["Company"]),
                    WorkingConditions = Normal.ParseInt(Request["WorkingConditions"]),
                    InterestIn        = Normal.ListStr(Request["InterestIn"]),
                    QQ = Normal.ListStr(Request["QQ"]),
                    IntroduceMyself = Normal.ListStr(Request["IntroduceMyself"])
                };
                var personService = new PersonService();
                flag = personService.AddUserInfo(model);
                return(flag ? Content("修改成功!") : Content("修改失败!"));
            }
            catch (Exception)
            {
                return(Content("修改失败!"));
            }
        }
예제 #2
0
        public ActionResult Login()
        {
            PersonService service  = new PersonService();
            var           account  = Normal.ListStr(Request["Account"]);
            var           password = Normal.CheckPoint(PwdUtil.MD5Encrypt(Request["Password"]));
            var           id       = service.Login(account, password);

            if (id > 0)
            {
                var cookie = new HttpCookie("PH_User");
                cookie.Expires = DateTime.Now.AddMonths(1);
                cookie.Values.Add("User_Account", account);
                cookie.Values.Add("User_Id", id.ToString());
                Response.AppendCookie(cookie);
                return(Content("True"));
            }
            return(Content("False"));
        }