コード例 #1
0
ファイル: SystemPayAccount.cs プロジェクト: a864610877/src
        public void Ready()
        {
            var defaultPos = PosEndPointService.Query(new PosEndPointRequest()).FirstOrDefault();

            if (defaultPos != null)
            {
                PosName = defaultPos.Name;
            }
        }
コード例 #2
0
ファイル: PayDone.cs プロジェクト: a864610877/src
        public void Ready()
        {
            var    user    = SecurityHelper.GetCurrentUser().CurrentUser;
            string posName = "";
            // debug
            AdminUser adminUser = user as AdminUser;

            if (adminUser != null)
            {
                _sourceShopName = Constants.SystemShopName;
                var pos = this.PosEndPointService.GetByCurrentUserId(adminUser.UserId);
                if (pos == null)
                {
                    Error = "请先创建终端,再进行交易!";
                    return;
                }
                posName = pos.Name;
            }
            ShopUser shopUser = user as ShopUser;

            if (shopUser != null)
            {
                var pos = PosEndPointService.Query(new PosEndPointRequest()
                {
                    ShopId = shopUser.ShopId, State = PosEndPointStates.Normal
                }).FirstOrDefault();
                if (pos == null)
                {
                    Error = "请先创建终端,再进行交易!";
                    return;
                }
                var shop = ShopService.GetById(shopUser.ShopId);
                _sourceShopName = shop.Name;
                ShopName        = shop.Name;
                posName         = pos.Name;
            }


            // debug end
            IPasswordService passwordService = UnityContainer.Resolve <IPasswordService>(HostSite.PasswordType);
            var password = passwordService.Decrypto(Password);

            Response = InnerCall(AccountToken, posName, password);

            this.Code = Response.Code;
            SerialNo  = Response.SerialServerNo;
            if (Response.Code == ResponseCode.InvalidatePassword)
            {
                IsRetry = true;
                Error   = ModelHelper.GetBoundText(this, x => x.Code);
            }
            else if (Response.Code != ResponseCode.Success)
            {
                Error = ModelHelper.GetBoundText(this, x => x.Code);
            }
        }
コード例 #3
0
 public IEnumerable <ValidationError> Validate()
 {
     if (PosEndPointService.Query(new PosEndPointRequest {
         Name = Name, ShopId = this.Shop
     }).Count() > 0)
     {
         yield return
             (new ValidationError("Name", string.Format(Localize("messages.duplicationPos"), InnerObject.Name)));
     }
 }
コード例 #4
0
        public void Query()
        {
            var request = new DealLogRequest();

            if (State != DealLogStates.All)
            {
                request.State = State;
            }
            request.AccountName = this.AccountName;
            //if (DealLogQueryType != DealLogQueryTypes.All)
            //{
            //    request.DealLogQueryType = DealLogQueryType;
            //}
            request.SubmitTimeMin = Data.Start;
            request.SubmitTimeMax = Data.GetEnd();
            request.ShopName      = this.ShopName;
            if (this.AccountShop != Globals.All)
            {
                //var user = (AdminUser)MembershipService.GetUserById(this.Pos);
                //var pos = PosEndPointService.GetByName(user.PosName);
                request.ShopId = AccountShop.Key;
            }
            if (this.PosId != Globals.All)
            {
                request.PosId = this.PosId;
            }
            if (DealType.Key != 0)
            {
                request.DealType = DealType.Key;
            }
            var currentUser = SecurityHelper.GetCurrentUser();
            var shopUser    = currentUser as ShopUserModel;

            if (shopUser != null)
            {
                request.ShopId = shopUser.ShopId;
            }

            var accountUser = currentUser as AccountUserModel;

            if (accountUser != null)
            {
                var accountId = accountUser.Accounts.Select(x => x.AccountId).First();
                request.AccountId = accountId;
            }
            if (AccountShop != Globals.All)
            {
                request.AccountShopId = AccountShop;
            }
            var query = this.DealLogService.Query(request);

            List = query.ToList(this, x => new ListDealLog(x));
            var NewItem = new ListDealLog();

            NewItem.SerialNo = "汇 总";
            foreach (var item in List)
            {
                NewItem.Amount += item.Amount;
                NewItem.Point  += item.Point;
            }
            List.Add(NewItem);
            //var shopIds = List.Select(x => x.InnerObject.ShopId).Distinct();

            //var shops = ShopService.Query(new ShopRequest() { ShopIds = shopIds.ToArray() }).ToList();
            //foreach (var log in List)
            //{
            //    var shop = shops.FirstOrDefault(x => x.ShopId == log.InnerObject.ShopId);
            //    if (shop != null)
            //        log.TempShop = shop;
            //}

            // ready
            //
            var queryPos = PosEndPointService.Query(new PosEndPointRequest()
            {
                State = PosEndPointStates.Normal
            }).ToList();

            this.PosId.Bind(queryPos.Select(x => new IdNamePair {
                Key = x.PosEndPointId, Name = x.Name
            }), true);
            var users = MembershipService.QueryUsers <AdminUser>(new UserRequest()
            {
                State = UserStates.Normal
            }).ToList();
            var poss = PosEndPointService.Query(new PosEndPointRequest()
            {
                State = PosEndPointStates.Normal
            }).ToList();
            var adminusers = from x in users
                             let p = poss.FirstOrDefault(y => y.CurrentUserId == x.UserId)
                                     select new IdNamePair {
                Key = x.UserId, Name = string.Format("{0} - {1}", x.DisplayName, p == null ? "" : p.Name)
            };

            this.Pos.Bind(adminusers, true);
            //
            var q = (from x in ShopService.Query(new ShopRequest()
            {
                IsBuildIn = false
            })
                     select new IdNamePair {
                Key = x.ShopId, Name = x.FormatedName
            }).ToList();

            q.Insert(0, new IdNamePair {
                Key = Ecard.Models.Shop.Default.ShopId, Name = Ecard.Models.Shop.Default.FormatedName
            });
            this.AccountShop.Bind(q, true);

            IdNamePair ii = new IdNamePair();

            ii.Key  = 0;
            ii.Name = "全部";
            DealType.Items.Add(ii);
            IdNamePair ip = new IdNamePair();

            ip.Key  = DealTypes.Deal;
            ip.Name = "会员卡支付";
            DealType.Items.Add(ip);
            IdNamePair ip2 = new IdNamePair();

            ip2.Key  = DealTypes.Integral;
            ip2.Name = "现金支付";
            DealType.Items.Add(ip2);
            IdNamePair ip1 = new IdNamePair();

            ip1.Key  = DealTypes.CancelDeal;
            ip1.Name = "撤销交易";
            DealType.Items.Add(ip1);
            IdNamePair ip3 = new IdNamePair();

            ip3.Key  = DealTypes.PayIntegral;
            ip3.Name = "积分消费";
            DealType.Items.Add(ip3);
            IdNamePair ip4 = new IdNamePair();

            ip4.Key  = DealTypes.Recharging;
            ip4.Name = "充值";
            DealType.Items.Add(ip4);
            IdNamePair ip5 = new IdNamePair();

            ip5.Key  = DealTypes.CancelRecharging;
            ip5.Name = "取消充值";
            DealType.Items.Add(ip5);
            IdNamePair ip6 = new IdNamePair();

            ip6.Key  = DealTypes.Invalid;
            ip6.Name = "冲正";
            DealType.Items.Add(ip6);
        }