/// <summary>
 ///     用户登录
 /// </summary>
 /// <param name="model">登录模型信息</param>
 /// <returns>业务操作结果</returns>
 public OperationResult Login(LoginModel model)
 {
     PublicHelper.CheckArgument(model, "model");
     LoginInfo loginInfo = new LoginInfo
     {
         Account = model.Account,
         Password = model.Password,
         IpAddress = HttpContext.Current.Request.UserHostAddress
     };
     OperationResult result = base.Login(loginInfo);
     if (result.ResultType == OperationResultType.Success)
     {
         Member member = (Member)result.AppendData;
         DateTime expiration = model.IsRememberLogin
             ? DateTime.Now.AddDays(7)
             : DateTime.Now.Add(FormsAuthentication.Timeout);
         FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, member.UserName, DateTime.Now, expiration,
             true, member.NickName, FormsAuthentication.FormsCookiePath);
         HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
         if (model.IsRememberLogin)
         {
             cookie.Expires = DateTime.Now.AddDays(7);
         }
         HttpContext.Current.Response.Cookies.Set(cookie);
         result.AppendData = null;
     }
     return result;
 }
 public ActionResult Login()
 {
     string returnUrl = Request.Params["returnUrl"];
     returnUrl = returnUrl ?? Url.Action("Index", "Home", new { area = "" });
     LoginModel model = new LoginModel
     {
         ReturnUrl = returnUrl
     };
     return View(model);
 }
 public ActionResult Login(LoginModel model)
 {
     try
     {
         OperationResult result = AccountContract.Login(model);
         string msg = result.Message ?? result.ResultType.ToDescription();
         if (result.ResultType == OperationResultType.Success)
         {
             return Redirect(model.ReturnUrl);
         }
         ModelState.AddModelError("", msg);
         return View(model);
     }
     catch (Exception e)
     {
         ModelState.AddModelError("", e.Message);
         return View(model);
     }
 }