コード例 #1
0
ファイル: ApplyBuilder.cs プロジェクト: pikaer/BingoService
        /// <summary>
        /// 获取动态申请列表
        /// </summary>
        /// <param name="momentId">动态Id</param>
        /// <param name="passApply">仅仅查看申请通过数据</param>
        /// <returns></returns>
        public static List <ApplyItem> GetApplyList(Guid momentId, bool isValid, RequestHead head, long momentUId = 0)
        {
            var applyList = applyInfoDao.GetListByMomentId(momentId);

            if (applyList.IsNullOrEmpty())
            {
                return(null);
            }
            if (isValid)
            {
                applyList = applyList.Where(a => a.ApplyState == ApplyStateEnum.申请通过 || a.UId == head.UId || a.MomentUId == head.UId).ToList();
            }
            var resultList = new List <ApplyItem>();

            for (var index = 0; index < applyList.Count; index++)
            {
                var apply    = applyList[index];
                var userInfo = uerInfoBiz.GetUserInfoByUid(apply.UId);
                if (userInfo == null)
                {
                    continue;
                }
                var result = new ApplyItem()
                {
                    ApplyId        = apply.ApplyId,
                    TextColor      = TextColorMap(apply.ApplyState),
                    UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, head),
                    ShowBorder     = index != applyList.Count - 1,
                    CreateTimeDesc = DateTimeHelper.GetDateDesc(apply.CreateTime, true),
                };
                if (apply.UId == head.UId)
                {
                    result.StateDesc = StateDescMapV1(apply.ApplyState);
                }
                else
                {
                    result.StateDesc = StateDescMap(apply.ApplyState);
                }
                if (!isValid)
                {
                    var applyDetaiList = applyDetailDao.GetListByApplyId(apply.ApplyId);
                    if (applyDetaiList.NotEmpty())
                    {
                        applyDetaiList = applyDetaiList.Where(a => a.UId != momentUId).OrderByDescending(a => a.CreateTime).ToList();
                        if (applyDetaiList.NotEmpty())
                        {
                            result.Content = applyDetaiList[0].Content;
                        }
                    }
                }

                resultList.Add(result);
            }
            return(resultList);
        }
コード例 #2
0
        private async Task LoadServices(ApplyItem item)
        {
            var acc    = AccountHelper.GetAccount(item.Account);
            var api    = new APIClient(acc.User, acc.Pwd);
            var method = new LogisticsServiceByOrderID()
            {
                OrderID = item.OrderNO
            };

            item.Services = await api.Execute(method);

            item.NotifyOfPropertyChange(() => item.Services);
        }
コード例 #3
0
 public async Task LoadLogisticsInfo(ApplyItem item)
 {
     await Task.Factory.StartNew(async() => {
         var acc    = AccountHelper.GetAccount(item.Account);
         var api    = new APIClient(acc.User, acc.Pwd);
         var method = new LogisticsGetOnlineLogisticsInfo()
         {
             OrderID = item.OrderNO
         };
         //排除取消的
         var datas = await api.Execute(method);
         item.ExistsLogisticInfos = datas.Where(i => i.Status != OnlineLogisticStatus.Closed).ToList();
         item.NotifyOfPropertyChange(() => item.ExistsLogisticInfos);
     });
 }
コード例 #4
0
        private async Task SetLocalLogisticCompany(ApplyItem item)
        {
            if (this.LocalLogisticsCompany == null)
            {
                var acc    = AccountHelper.GetAccount(item.Account);
                var api    = new APIClient(acc.User, acc.Pwd);
                var method = new LogisticsGetLocalCompanies();
                this.LocalLogisticsCompany = await api.Execute(method);

                item.LogisticsCompanies = this.LocalLogisticsCompany;
                item.NotifyOfPropertyChange(() => item.LogisticsCompanies);
            }
            else
            {
                item.LogisticsCompanies = this.LocalLogisticsCompany;
                item.NotifyOfPropertyChange(() => item.LogisticsCompanies);
            }
        }
コード例 #5
0
        public void LoadData(ApplyItem item)
        {
            if (!string.IsNullOrWhiteSpace(item.OrderNO))
            {
                var order = this.OrderBiz.GetOrder(item.OrderNO);
                if (order != null)
                {
                    item.Account   = order.Account;
                    item.Status    = order.Status;
                    item.OrderNote = (order.Note ?? new OrderNote()).Note;
                    //item.LogisticType = string.Join(",", order.Details.Select(s => EnumHelper.GetDescription(s.LogisticsType.ToEnum<AsNum.Xmj.Entity.LogisticsTypes>())));
                    item.LogisticType = string.Join(",", order.Details.Select(s => s.LogisticsType));

                    item.Receiver             = new Xmj.API.Entity.OnlineLogisticsContacts();
                    item.Receiver.CountryCode = order.Receiver.CountryCode;
                    item.Receiver.CountryName = order.Receiver.Country.ZhName;
                    item.Receiver.Address     = order.Receiver.Address;
                    item.Receiver.City        = order.Receiver.City;
                    item.Receiver.Mobile      = order.Receiver.Mobi;
                    item.Receiver.Name        = order.Receiver.Name;
                    item.Receiver.Phone       = order.Receiver.Phone;
                    item.Receiver.PostCode    = order.Receiver.ZipCode;
                    item.Receiver.Province    = order.Receiver.Province;

                    item.Sender             = new Xmj.API.Entity.OnlineLogisticsContacts();
                    item.Sender.CountryCode = "CN";
                    item.Sender.Address     = order.AccountOf.SenderAddress;
                    item.Sender.City        = order.AccountOf.SenderCity;
                    item.Sender.Mobile      = order.AccountOf.SenderMobi;
                    item.Sender.Name        = order.AccountOf.SenderName;
                    item.Sender.Phone       = order.AccountOf.SenderPhone;
                    item.Sender.PostCode    = order.AccountOf.SenderPostCode;
                    item.Sender.Province    = order.AccountOf.SenderProvince;

                    item.Pickup             = new Xmj.API.Entity.OnlineLogisticsContacts();
                    item.Pickup.CountryCode = "CN";
                    item.Pickup.County      = order.AccountOf.PickupCounty;
                    item.Pickup.Address     = order.AccountOf.PickupAddress;
                    item.Pickup.City        = order.AccountOf.PickupCity;
                    item.Pickup.Mobile      = order.AccountOf.PickupMobi;
                    item.Pickup.Name        = order.AccountOf.PickupName;
                    item.Pickup.Phone       = order.AccountOf.PickupPhone;
                    item.Pickup.PostCode    = order.AccountOf.PickupPostCode;
                    item.Pickup.Province    = order.AccountOf.PickupProvince;

                    item.LocalTrackNO = order.OrderNO;

                    var ds = order.Details.GroupBy(d => d.ProductID)
                             .Select(g => new OnlineLogisticsDeclareInfo {
                        ProductID   = g.Key,
                        Count       = g.Sum(gg => gg.Qty),
                        Weight      = 0.5,
                        WithBattery = false,
                        Amount      = 5
                    });

                    item.IsSummary = true;
                    item.Declares  = new BindableCollection <OnlineLogisticsDeclareInfo>(ds);

                    item.NotifyOfPropertyChange(() => item.NeedPickup);
                    item.NotifyOfPropertyChange(() => item.Account);
                    item.NotifyOfPropertyChange(() => item.Status);
                    item.NotifyOfPropertyChange(() => item.OrderNote);
                    item.NotifyOfPropertyChange(() => item.Receiver);
                    item.NotifyOfPropertyChange(() => item.Sender);
                    item.NotifyOfPropertyChange(() => item.Pickup);
                    item.NotifyOfPropertyChange(() => item.LocalTrackNO);
                    item.NotifyOfPropertyChange(() => item.LogisticType);
                    item.NotifyOfPropertyChange(() => item.IsSummary);

                    item.NotifyOfPropertyChange(() => item.Declares);

                    this.LoadServices(item);
                    this.LoadLogisticsInfo(item);
                }
            }
        }