示例#1
0
        public ActionResult Header()
        {
            if (CurrentCityName == null)
            {
                CurrentCityId = null;
                CurrentCityName = "全国";
            }
            UserViewModel model = new UserViewModel();
            if (UserInfo != null)
            {
                model.UserEntity = UserInfo;
                model.ErrorMsg = new UserService().CheckUserVipEndTimeWithStatusMessage(UserInfo.UserId);
            }

            return PartialView(model);
        }
示例#2
0
 /// <summary>
 /// 上传证件
 /// </summary>
 /// <returns></returns>
 public ActionResult Identify()
 {
     RequireLogin();
     UserViewModel model = new UserViewModel { UserEntity = UserInfo };
     try
     {
         UserService service = new UserService();
         model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
     }
     catch (Exception e)
     {
         LogService.Log("Identify 出错了!", e.ToString());
     }
     model.ErrorMsg = GetErrorMessage(model.VipInfo);
     return View(model);
 }
示例#3
0
        /// <summary>
        /// 上传证件
        /// </summary>
        /// <returns></returns>
        public ActionResult Identify(string returnUrl = null)
        {
            if (!IsUserLogin)
            {
                return Redirect("/Mobile/account/login");
            }

            UserViewModel model = new UserViewModel { UserEntity = UserInfo };
            try
            {
                UserService service = new UserService();
                model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
            }
            catch (Exception e)
            {
                LogService.Log("Identify 出错了!", e.ToString());
            }
            model.ErrorMsg = GetErrorMessage(model.VipInfo);

            ViewData["returnUrl"] = returnUrl;
            return View(model);
        }
示例#4
0
 public ActionResult UpdatePassword(string oldpassword, string newpassword)
 {
     UserViewModel model = new UserViewModel { UserEntity = UserInfo };
     string message = null;
     try
     {
         if (string.Equals(oldpassword.ToMD5(),
             model.UserEntity.EncryptedPassword,
             StringComparison.InvariantCultureIgnoreCase))
         {
             UserService service = new UserService();
             model.UserEntity.EncryptedPassword = newpassword.ToMD5();
             service.ResetUserPassword(model.UserEntity);
         }
         else
         {
             message = "原密码输入错误!";
         }
     }
     catch (Exception e)
     {
         LogService.Log("UpdatePassword 出错了!", e.ToString());
         message = "密码更新失败!";
     }
     model.ErrorMsg = message;
     return View(model);
 }
示例#5
0
 public ActionResult UpdatePassword()
 {
     UserViewModel model = new UserViewModel { UserEntity = UserInfo };
     return View(model);
 }
示例#6
0
        /// <summary>
        /// 会员须知
        /// </summary>
        /// <returns></returns>
        public ActionResult ToVip()
        {
            UserViewModel model = new UserViewModel { UserEntity = UserInfo };
            try
            {
                UserService service = new UserService();
                UserVip vipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
                if (vipInfo != null && vipInfo.State.HasValue && vipInfo.State.Value == (int)VipState.VIP)
                {
                    return Redirect(GetUrl("/Wechat/user/VipInfo"));
                }

                SinglePageService singlePageService = new SinglePageService();
                model.ToVipNotice = singlePageService.GetSingPageById("95");
            }
            catch (Exception e)
            {
                LogService.Log("ToVip 出错了!", e.ToString());
            }
            return View(model);
        }
示例#7
0
        public ActionResult Identify(string identifyImgUrl, string returnUrl = null)
        {
            UserViewModel model = new UserViewModel { UserEntity = UserInfo };

            if (!string.IsNullOrWhiteSpace(identifyImgUrl))
            {
                UserService service = new UserService();
                try
                {
                    UserVip vipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);

                    CurrentUser.IdentiyImg = identifyImgUrl;
                    CurrentUser.Vip = (int)VipState.Normal;
                    if (service.UserUpdate(CurrentUser) && service.UpdateUserVipInfo(vipInfo.Id, vipInfo.OrderId, identifyImgUrl,
                        DateTime.Now, DateTime.Now, vipInfo.Duration, vipInfo.Amount, VipState.Normal))
                    {
                        model.ErrorMsg = "照片上传成功,等待管理员审核";
                    }

                    // get it again
                    model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
                    if (string.IsNullOrEmpty(model.ErrorMsg))
                    {
                        model.ErrorMsg = GetErrorMessage(model.VipInfo);
                    }
                }
                catch (Exception e)
                {
                    LogService.Log("Identify 出错了!", e.ToString());
                    model.ErrorMsg = "认证照片上传失败!";
                }
            }
            else
            {
                model.ErrorMsg = "请选择认证照片!";
            }

            if (!string.IsNullOrWhiteSpace(returnUrl))
            {
                return Redirect(returnUrl);
            }

            return View(model);
        }
示例#8
0
        public ActionResult ViewUser()
        {
            UserViewModel model = new UserViewModel { UserEntity = CurrentUser };
            try
            {
                if (!IsUserLogin)
                {
                    return Redirect("/mobile/account/login");
                }

                CityService cityService = new CityService();
                model.Provinces = cityService.GetProvinces(true);
                if (!string.IsNullOrEmpty(model.UserEntity.LocationId))
                {
                    model.Cities = cityService.GetCitiesByProvinceId(model.UserEntity.Province, true); //市
                    model.Areas = cityService.GetAreasByCityId(model.UserEntity.City, true); //区
                }
            }
            catch (Exception e)
            {
                LogService.Log("用户中心-viewuser", e.ToString());
            }
            return View(model);
        }
示例#9
0
        public ActionResult Identify(FormCollection form)
        {
            RequireLogin();
            UserViewModel model = new UserViewModel { UserEntity = UserInfo };
            UserService service = new UserService();
            try
            {
                UserVip vipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);

                string errorMsg = string.Empty;
                string imgUrl = string.Empty;
                try
                {
                    HttpPostedFileBase postFile = this.HttpContext.Request.Files["IdentiyImg"];
                    using (System.Drawing.Image img = System.Drawing.Image.FromStream(postFile.InputStream))
                    {
                    }

                }
                catch
                {
                    errorMsg = "图片格式错误,请重新选择";
                }

                if (string.IsNullOrEmpty(errorMsg))
                {
                    errorMsg = FileUploadHelper.SaveFile(this.HttpContext, "IdentiyImg", out imgUrl);
                    if (string.IsNullOrEmpty(errorMsg))
                    {
                        UserInfo.IdentiyImg = imgUrl;
                        UserInfo.Vip = (int)VipState.Normal;
                        if (service.UserUpdate(UserInfo) && service.UpdateUserVipInfo(vipInfo.Id, vipInfo.OrderId, imgUrl,
                            DateTime.Now, DateTime.Now, vipInfo.Duration, vipInfo.Amount, VipState.Normal))
                        {
                            errorMsg = "图片上传成功,等待管理员审核";
                        }
                    }
                }

                // get it again
                model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
                if (string.IsNullOrEmpty(errorMsg))
                {
                    errorMsg = GetErrorMessage(model.VipInfo);
                }
                model.ErrorMsg = errorMsg;
            }
            catch (Exception e)
            {
                LogService.Log("Identify 出错了!", e.ToString());
            }

            model.VipInfo = model.VipInfo ?? service.GetUserVipInfoByUserId(UserInfo.UserId);
            return View(model);
        }
示例#10
0
        /// <summary>
        /// vip会员费
        /// </summary>
        /// <returns></returns>
        public ActionResult VipOrder()
        {
            RequireLogin();
            UserViewModel model = new UserViewModel { UserEntity = UserInfo ?? new User() };
            UserService service = new UserService();

            try
            {
                model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);

                if (model.VipInfo != null)
                {
                    if (!model.VipInfo.State.HasValue || model.VipInfo.State.Value == (int)VipState.Normal || model.VipInfo.State.Value == (int)VipState.Invalid)
                    {
                        return Redirect(GetUrl("/m/user/Identify"));
                    }
                    else if (model.VipInfo.State.Value == (int)VipState.VIP)
                    {
                        return Redirect(GetUrl("/m/user/VipInfo"));
                    }
                }
            }
            catch (Exception e)
            {
                LogService.Log("VipOrder 出错了!", e.ToString());
            }

            return View(model);
        }
示例#11
0
        public ActionResult VipInfo()
        {
            RequireLogin();
            UserViewModel model = new UserViewModel { UserEntity = UserInfo ?? new User() };
            UserService service = new UserService();

            try
            {
                model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);

                if (model.VipInfo != null)
                {
                    if (!model.VipInfo.State.HasValue || model.VipInfo.State.Value != (int)VipState.VIP)
                    {
                        return Redirect(GetUrl("/m/user/ToVip"));
                    }
                    else
                    {
                        if (model.VipInfo.EndTime > DateTime.Now)
                        {
                            model.ErrorMsg = "您的VIP已过期,请重新申请";
                            //service.SetUserToVip(
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LogService.Log("VipInfo 出错了!", e.ToString());
            }

            return View(model);
        }
示例#12
0
 public ActionResult ViewUser()
 {
     RequireLogin();
     UserViewModel model = new UserViewModel { UserEntity = UserInfo };
     try
     {
         CityService cityService = new CityService();
         model.Provinces = cityService.GetProvinces(true);
         if (!string.IsNullOrEmpty(model.UserEntity.LocationId))
         {
             model.Cities = cityService.GetCitiesByProvinceId(model.UserEntity.Province, true); //市
             model.Areas = cityService.GetAreasByCityId(model.UserEntity.City, true); //区
         }
     }
     catch (Exception e)
     {
         LogService.Log("用户中心-index", e.ToString());
     }
     return View(model);
 }