예제 #1
0
        public ActionResult EditUser(User user)
        {
            try
            {
                UserService service = new UserService();
                var oldUser = service.GetUserById(UserInfo.UserId);
                if (oldUser != null)
                {
                    oldUser.Adress = user.Adress;
                    oldUser.QQ = user.QQ;
                    oldUser.LocationId = Request.Form["LocationId[]"];

                    if (!string.IsNullOrEmpty(Request.Form["Photo"]))
                    {
                        oldUser.Photo = Request.Form["Photo"];
                    }
                    if (service.UserUpdate(oldUser))
                    {
                        Session[USERINFO] = oldUser;
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.Log("会员列表", ex.ToString());
            }
            return RedirectToAction("ViewUser");
        }
예제 #2
0
        public ActionResult Identify(string identifyImgUrl, string returnUrl = null)
        {
            WeChatUserViewModel model = new WeChatUserViewModel { 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);
        }
예제 #3
0
        /// <summary>
        /// 更新默认城市地址
        /// </summary>
        /// <param name="cityId"></param>
        /// <returns></returns>
        public virtual bool UpdateDefaultCity(string cityId)
        {
            bool isSuccessful = false;

            if (CurrentUser.IsNotNull())
            {
                try
                {
                    var city = ConvertToCityObject(cityId);
                    if (city.IsNotNull())
                    {
                        UserService userService = new UserService();
                        CurrentUser.LocationId = city.ParentId + "," + city.Id + ",";

                        isSuccessful = userService.UserUpdate(CurrentUser);
                    }
                }
                catch(Exception ex)
                {
                    LogService.Log("UpdateDefaultCity", ex.ToString());
                }
            }

            return isSuccessful;
        }
예제 #4
0
        public ActionResult EditUser(string UserId, string Cellphone, string Email,
            string QQ, string Address, string UCard, string SiteUrl)
        {
            MemberViewModel viewModel = new MemberViewModel();
            try
            {
                UserService service = new UserService();
                User user = service.GetUserById(int.Parse(UserId));

                if (user != null)
                {
                    user.Cellphone = Cellphone;
                    user.Email = Email;
                    user.QQ = QQ;
                    user.Adress = Address;
                    user.UCard = UCard;
                    user.SiteUrl = SiteUrl;
                }

                service.UserUpdate(user);
                viewModel.SingleUser = service.GetUserById(user.UserId); ;
            }
            catch (Exception ex)
            {
                LogService.Log("会员列表", ex.ToString());
            }
            return View(viewModel);
        }
예제 #5
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);
        }