Exemplo n.º 1
0
 void initLazyLoaders(bool newOrder)
 {
     _OemInfoLoader = new LazyLoader <OEMInfo>(() => OEMService.QueryOEMById(OEMID.Value));
     if (newOrder)
     {
         _applyformLoader    = new EnumerableLazyLoader <BaseApplyform>();
         _operationLoader    = new EnumerableLazyLoader <Log.Domain.OrderLog>();
         _coordinationLoader = new EnumerableLazyLoader <Coordination>();
     }
     else
     {
         _applyformLoader = new EnumerableLazyLoader <BaseApplyform>(() => {
             return(ApplyformQueryService.QueryApplyforms(this.Id));
         });
         _operationLoader = new EnumerableLazyLoader <Log.Domain.OrderLog>(() => {
             return(LogService.QueryOrderLog(this.Id));
         });
         _coordinationLoader = new EnumerableLazyLoader <Coordination>(() => {
             return(CoordinationService.QueryOrderCoordinations(this.Id));
         });
     }
     _associateOrderLoader   = new LazyLoader <Order>();
     _distributionBillLoader = new LazyLoader <Service.Distribution.Domain.OrderBill>(() => {
         return(DistributionQueryService.QueryOrderBill(this.Id));
     });
 }
Exemplo n.º 2
0
 public object QueryOEMApplyform(ApplyformQueryCondition condition, Pagination pagination)
 {
     try
     {
         var oem = ChinaPay.B3B.Service.Organization.OEMService.QueryOEM(CurrentCompany.CompanyId);
         if (oem == null)
         {
             throw new Exception("没有找到对应的oem信息");
         }
         condition.OEMID = oem.Id;
         if (condition.ApplyformType == ApplyformType.Refund || condition.ApplyformType == ApplyformType.Scrap)
         {
             if (!string.IsNullOrWhiteSpace(condition.RefundStatusText) && condition.RefundStatusText != "全部")
             {
                 var statues = Service.Order.StatusService.GetRoleRefundApplyformStatus(OrderRole.OEMOwner).Where(s => s.Value == condition.RefundStatusText).Select(s => s.Key);
                 if (statues.Any())
                 {
                     condition.ApplyDetailStatus = 0;
                     foreach (var status in statues)
                     {
                         condition.ApplyDetailStatus |= (byte)status;
                     }
                 }
             }
         }
         else if (condition.ApplyformType == ApplyformType.Postpone)
         {
             if (!string.IsNullOrWhiteSpace(condition.PostponeStatusText) && condition.PostponeStatusText != "全部")
             {
                 var statues = Service.Order.StatusService.GetRolePostponeApplyformStatus(OrderRole.OEMOwner).Where(s => s.Value == condition.PostponeStatusText).Select(s => s.Key);
                 if (statues.Any())
                 {
                     condition.ApplyDetailStatus = 0;
                     foreach (var status in statues)
                     {
                         condition.ApplyDetailStatus |= (byte)status;
                     }
                 }
             }
         }
         List <ApplyformListView> forms = ApplyformQueryService.QueryApplyforms(condition, pagination).ToList();
         var lockInfos = LockService.Query(forms.Select(form => form.ApplyformId.ToString())).ToList();
         var applyform = forms.Select(form =>
         {
             LockInfo lockInfo = lockInfos.FirstOrDefault(l => l.Key == form.ApplyformId.ToString());
             return(new
             {
                 form.ApplyformId,
                 PNR = form.OriginalPNR == null ? string.Empty : form.OriginalPNR.ToListString(),
                 Voyage = IEnumerableExtension.Join <FlightListView>(form.Flights, "<br />",
                                                                     f =>
                                                                     string.Format(
                                                                         "{0}{1}-{2}{3}",
                                                                         f.DepartureCity,
                                                                         f.DepartureAirport,
                                                                         f.ArrivalCity,
                                                                         f.ArrivalAirport)),
                 FlightInfo = form.Flights.Join("<br />", f => string.Format(
                                                    "{0}{1}<br />{2} / {3}",
                                                    f.Carrier,
                                                    f.FlightNo,
                                                    string.IsNullOrEmpty(f.Bunk) ? "-" : f.Bunk, getDiscountText
                                                        (f.Discount))),
                 TakeoffTime = form.Flights.Join("<br />", f =>
                                                 f.TakeoffTime.
                                                 ToString(
                                                     "yyyy-MM-dd<br />HH:mm")),
                 Passengers = String.Join("<br />", (IEnumerable <string>)form.Passengers),
                 ApplyTypeDesc = form.ApplyformType.GetDescription(),
                 ApplyType = form.ApplyformType,
                 ProcessStatus = GetProcessStatus(form, OrderRole.OEMOwner),
                 form.AppliedTime,
                 form.ApplierAccount,
                 ProductType = form.ProductType.GetDescription(),
                 LockInfo = lockInfo == null
                                ? string.Empty
                                : lockInfo.Company ==
                            CurrentCompany.CompanyId
                                      ? string.Format("{0}<br />{1}", lockInfo.Account, lockInfo.Name)
                                      : string.Format("{0}<br />({1})", lockInfo.LockRole.GetDescription(), lockInfo.Account),
                 RenderSupperUnLock = lockInfo != null,
                 RefundType = form.RefundType.HasValue ? form.RefundType.GetDescription() : string.Empty,
                 IsRefund = form.ApplyformType == ApplyformType.Refund,
                 EnableQueryPaymentInfo = form.ApplyformType == ApplyformType.Postpone && (PostponeApplyformStatus)form.ApplyDetailStatus == PostponeApplyformStatus.Agreed
             });
         });
         return(new { Applyforms = applyform, Pagination = pagination });
     }
     catch (Exception ex)
     {
         LogService.SaveExceptionLog(ex);
         throw;
     }
 }