Пример #1
0
 public static CurrentUser GetCurrentUserByTuser(UserDto user)
 {
     var currentUser = new CurrentUser();
     currentUser.SystemLevel = 1;
     currentUser.LoginAccount = user.LoginAccount;
     currentUser.UserID = new Guid(user.Id);
     currentUser.UserName = user.UserName;
     return currentUser;
 }
Пример #2
0
 public ActionResult CreateOrders(ProductDto porduct, int? count)
 {
     var currentUser = CurrentOperator;
     var userDto = new UserDto()
     {
         Id = CurrentOperator.UserID.ToString()
     };
     _orderServiceImp.CreateOrderDirect(userDto, porduct, count ?? 0);
     return Alert("下单成功","/zhongzhuan?note=下单成功!立即支付?&url=/lijizhifu");//需要跳转到待付款界面吧?
 }
Пример #3
0
 /// <summary>
 /// 用户注册逻辑
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ActionResult CreateUser(UserDto user)
 {
     if (user != null)
     {
         var list = new List<UserDto>();
         list.Add(user);
         _userServiceImp.CreateUsers(list);
         UserLogin(user);//注册完毕直接登录
     }
     //这里应该跳转到注册完毕的页面
     return RedirectToAction("UserHaveRegisted", new { LoginAccount = user.LoginAccount });
 }
Пример #4
0
 public bool EnableUser(UserDto userDto)
 {
     if (userDto == null)
         throw new ArgumentNullException("userDto");
     User user;
     if (!IsEmptyGuidString(userDto.Id))
         user = _userRepository.GetByKey(new Guid(userDto.Id));
     else if (!string.IsNullOrEmpty(userDto.UserName))
         user = _userRepository.GetByExpression(u => u.UserName == userDto.UserName);
     else if (!string.IsNullOrEmpty(userDto.Email))
         user = _userRepository.GetByExpression(u => u.Email == userDto.Email);
     else
         throw new ArgumentNullException("userDto", "Either ID, UserName or Email should be specified.");
     user.Enable();
     _userRepository.Update(user);
     RepositorytContext.Commit();
     return user.IsDisabled;
 }
Пример #5
0
 public OrderDto CreateOrderDirect(UserDto userDto, ProductDto productDto, int quantity)
 {
     var user = _userRepository.GetByKey(new Guid(userDto.Id));
     var product=_productRepository.GetByKey(new Guid(productDto.Id));
     if (user!=null)
     {
         var order = _domainService.CreateOrderDirect(user, product,quantity);
         return Mapper.Map<OrderDto>(order);
     }
     return null;
 }
Пример #6
0
 public OrderDto CheckOutByItem(UserDto userDto, List<ShoppingCartItemDto> shopItems)
 {
     var user = _userRepository.GetByKey(new Guid(userDto.Id));
     //var shoppingCart = _shoppingCartRepository.GetByExpression(s => s.User.Id == user.Id);
     var list = shopItems.ConvertAll(x => { return Mapper.Map<ShoppingCartItemDto, ShoppingCartItem>(x); });
     var order = _domainService.CreateOrderByItem(user, list);
     return Mapper.Map<OrderDto>(order);
 }
Пример #7
0
 /// <summary>
 /// 用户登录action
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ActionResult UserLoginFromPage(UserDto user)
 {
     UserLogin(user);
     return Redirect("http://www.tutgou.com");
 }
Пример #8
0
 public void UserLogin(UserDto user)
 {
     var tUser = _userServiceImp.GetUserByLoginAccount(user.LoginAccount);
     if (tUser.Password.Equals(user.Password))//登录成功
     {
         if (tUser.IsDisabled.Value)//说明不可用
         {
             //待定
             return;
         }
         var currentUser = CustomUserSession.GetCurrentUserByTuser(tUser);//获取当前登录用户信息
         CustomUserSession.SaveSessionForLogin(currentUser);
     }
 }
Пример #9
0
 /// <summary>
 /// 用户注册成功后中转页面
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ActionResult UserHaveRegisted(UserDto user)
 {
     var tUser = _userServiceImp.GetUserByLoginAccount(user.LoginAccount);
     ViewData["userName"] = tUser.UserName;
     return View();
 }