Exemple #1
0
        public void Ready()
        {
            LiquidateId = Id;
            _hasError   = true;
            Liquidate   = LiquidateService.GetById(Id);
            State       = ModelHelper.GetBoundText(Liquidate, x => x.State);
            var currentUser = SecurityHelper.GetCurrentUser().CurrentUser;
            var shop        = ShopService.GetById(Liquidate.ShopId);

            var rate = shop.ShopDealLogChargeRate ?? HostSite.ShopDealLogChargeRate;

            RateAmount   = (Liquidate.DealAmount * rate);
            Amount       = (Liquidate.DealAmount - Liquidate.CancelAmount) - RateAmount;
            Formula      = string.Format("({0} - {1}) - {0} * {2}", Liquidate.DealAmount, Liquidate.CancelAmount, rate.ToString("P"));
            DealAmount   = Liquidate.DealAmount;
            CancelAmount = Liquidate.CancelAmount;
            Count        = Liquidate.Count;

            var ids = Liquidate.DealIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(x => Convert.ToInt32(x)).ToArray();

            Items = new ItemList <ListShopDealLog>(this.ShopDealLogService.GetByIds(ids).Select(x => new ListShopDealLog(x)));

            CashAmount = CashDealLogService.GetSummary(currentUser.UserId);


            var dealways = from x in DealWayService.Query()
                           where new ApplyToModel(x.ApplyTo).EnabledShopDealAccount
                           select new IdNamePair {
                Key = x.DealWayId, Name = x.DisplayName
            };

            this.DealWay.Bind(dealways);
            this.DealWay.IsReadOnly = this.Liquidate.State == LiquidateStates.Done;
            _hasError = false;
        }