public OperatorViewModel() { if (OperatorStateList == null) { OperatorStateList = new ObservableCollection <KeyValuePair <EnumOperatorState?, string> > { new KeyValuePair <EnumOperatorState?, string>(null, "所有") }; } EnumItemManager.GetItemList <EnumOperatorState>().ForEach(x => { var kv = new KeyValuePair <EnumOperatorState?, string>(x.Key, x.Value); OperatorStateList.Add(kv); }); if (OpList == null) { OpList = new ObservableCollection <OperatorDto>(); } if (IsInDesignMode) { return; } Initialize(); }
public bool UpdateTripNumberInfo(List <string> tripNumberList, string ticketNumber, EnumTripStatus tripStatus, string useOffice, string iataCode, string ticketCompanyName) { bool IsUpdate = false; if (tripNumberList == null || tripNumberList.Count == 0) { throw new OrderCommException("需要修改的行程单数据不能为空!"); } var result = m_travelPaperRepository.FindAll(p => tripNumberList.Contains(p.TripNumber)).ToList(); if (result.Count > 0) { result.ForEach(p => { TravelPaper travelPaper = p; if (travelPaper != null) { string tripNumber = p.TripNumber; StringBuilder sbCon = new StringBuilder(); if (!string.IsNullOrEmpty(ticketNumber) && ticketNumber != travelPaper.TicketNumber) { travelPaper.TicketNumber = ticketNumber; sbCon.AppendFormat("原票号:{0} 新票号:{1},", travelPaper.TicketNumber, tripNumber); } if (tripStatus != travelPaper.TripStatus) { travelPaper.TripStatus = tripStatus; sbCon.AppendFormat("原状态:{0} 新状态:{1},", EnumItemManager.GetDesc(travelPaper.TripStatus), EnumItemManager.GetDesc(tripStatus)); } if (!string.IsNullOrEmpty(useOffice) && useOffice != travelPaper.UseOffice) { travelPaper.UseOffice = useOffice; sbCon.AppendFormat("原Office号:{0} 新Office号:{1},", travelPaper.UseOffice, useOffice); } if (!string.IsNullOrEmpty(iataCode) && iataCode != travelPaper.IataCode) { travelPaper.IataCode = iataCode; sbCon.AppendFormat("原航协号:{0} 新航协号:{1},", travelPaper.IataCode, iataCode); } if (!string.IsNullOrEmpty(ticketCompanyName) && ticketCompanyName != travelPaper.TicketCompanyName) { travelPaper.TicketCompanyName = ticketCompanyName; sbCon.AppendFormat("原填开单位:{0} 新填开单位:{1},", travelPaper.TicketCompanyName, ticketCompanyName); } travelPaper.WriteLog(new TravelPaperLog() { OperationType = "修改", OperationPerson = currentUser.OperatorAccount, OperationDatetime = System.DateTime.Now, OperationContent = sbCon.ToString() }); unitOfWorkRepository.PersistUpdateOf(travelPaper); } }); //提交 unitOfWork.Commit(); IsUpdate = true; } else { throw new OrderCommException("未能查到行程单数据!"); } return(IsUpdate); }
public static PolicyDto ToPolicyDto(this Policy policy, Order order) { DataBill databill = new DataBill(); decimal PayMoney = databill.GetPayPrice(policy.SeatPrice, policy.ABFee, policy.RQFee, policy.PolicyPoint, policy.ReturnMoney); decimal Commission = databill.GetCommission(policy.PolicyPoint, policy.SeatPrice, policy.ReturnMoney); var _p = new PolicyDto() { Commission = Commission, AreaCity = policy.AreaCity, Id = policy.PolicyId, PlatformCode = policy.PlatformCode, PlatformName = policy.PlatformCode, Point = policy.PolicyPoint, DownPoint = policy.DownPoint, PaidPoint = policy.PaidPoint, OriginalPolicyPoint = policy.OriginalPolicyPoint, ReturnMoney = policy.ReturnMoney, IsChangePNRCP = policy.IsChangePNRCP, IssueTicketWay = ((int)policy.EnumIssueTicketWay).ToString(), IsSp = policy.IsSp, IsLow = policy.IsLow, PolicyType = policy.PolicyType, WorkTime = policy.WorkTime.ToString(), ReturnTicketTime = policy.ReturnTicketTime.ToString(), AnnulTicketTime = policy.AnnulTicketTime.ToString(), TFGTime = FormatPNR.GetIntersectionTimeSlot(policy.ReturnTicketTime.ToString(), policy.AnnulTicketTime.ToString()), CPOffice = policy.CPOffice, IssueSpeed = policy.IssueSpeed, Remark = policy.Remark, PolicySourceType = EnumItemManager.GetDesc(policy.PolicySourceType), CarryCode = policy.CarryCode, PolicyOwnUserRole = ((int)policy.PolicyOwnUserRole).ToString(), Code = policy.Code, Name = policy.Name, CashbagCode = policy.CashbagCode, Rate = policy.Rate, CarrierCode = policy.CarrierCode, SeatPrice = policy.SeatPrice, ABFee = policy.ABFee, RQFee = policy.RQFee, TicketPrice = policy.SeatPrice + policy.ABFee + policy.RQFee, PayMoney = PayMoney, DefaultPolicySource = order.OrderType, PolicySpecialType = policy.PolicySpecialType, SpecialPriceOrDiscount = policy.SpecialPriceOrDiscount, TodayGYCode = policy.TodayGYCode }; var currentUser = AuthManager.GetCurrentUser(); if (currentUser.Type == "Buyer") { _p.ShowPolicySource = EnumItemManager.GetDesc(policy.PolicySourceType); } else if (currentUser.Type == "Carrier") { if (policy.PolicySourceType != EnumPolicySourceType.Local) { _p.ShowPolicySource = "系统"; } else if (currentUser.Code == policy.Code) { _p.ShowPolicySource = policy.PolicyType; } else { _p.ShowPolicySource = policy.Code; } } else if (currentUser.Type == "Supplier") { _p.ShowPolicySource = policy.PolicyType; } else { if (policy.PolicySourceType == EnumPolicySourceType.Interface) { _p.ShowPolicySource = policy.PlatformCode; } else { _p.ShowPolicySource = policy.Code; } } return(_p); }
public static string ToEnumDesc(this Enum source) { return(EnumItemManager.GetDesc(source)); }
/// <summary> /// 空白行程单详情导出 空白行程单管理 /// </summary> /// <returns></returns> public ActionResult ImportTravelDetail(string UseBusinessmanCode, string UseBusinessmanName, string startTripNumber, string endTripNumber, string startTicketNumber, string endTicketNumber, string useOffice, int?TripStatus, DateTime?startGrantTime, DateTime?endGrantTime, DateTime?startCreateTime, DateTime?endCreateTime, DateTime?startVoidTime, DateTime?endVoidTime, string exportType, string BuyerType, int page = 1, int rows = 10) { DateTime defaultTime = DateTime.Parse("1900-01-01"); ExportExcelContext export = new ExportExcelContext(exportType); DataTable table = new DataTable(); if (string.IsNullOrEmpty(BuyerType)) { table.TableName = "空白行程单管理"; List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户名称", typeof(string)), new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("Office", typeof(string)), new KeyValuePair <string, Type>("行程单号", typeof(string)), new KeyValuePair <string, Type>("行程单状态", typeof(string)), new KeyValuePair <string, Type>("回收时间", typeof(string)), new KeyValuePair <string, Type>("分配时间", typeof(string)) }; headArray.ForEach(p => table.Columns.Add(p.Key, p.Value)); } else if (BuyerType == "0")// 采购详情 { table.TableName = "行程单详情"; List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("领用商户名", typeof(string)), new KeyValuePair <string, Type>("行程单号", typeof(string)), new KeyValuePair <string, Type>("Office号", typeof(string)), new KeyValuePair <string, Type>("票号", typeof(string)), new KeyValuePair <string, Type>("状态", typeof(string)), new KeyValuePair <string, Type>("分配时间", typeof(string)), new KeyValuePair <string, Type>("回收时间", typeof(string)), new KeyValuePair <string, Type>("创建打印时间", typeof(string)), new KeyValuePair <string, Type>("作废时间", typeof(string)), new KeyValuePair <string, Type>("备注", typeof(string)) }; headArray.ForEach(p => table.Columns.Add(p.Key, p.Value)); } else if (BuyerType == "1")//行程单综合查询 { table.TableName = "行程单综合查询"; List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户名", typeof(string)), new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("Office", typeof(string)), new KeyValuePair <string, Type>("票号", typeof(string)), new KeyValuePair <string, Type>("行程单号", typeof(string)), new KeyValuePair <string, Type>("状态", typeof(string)), new KeyValuePair <string, Type>("回收时间", typeof(string)), new KeyValuePair <string, Type>("分配时间", typeof(string)), new KeyValuePair <string, Type>("创建时间", typeof(string)), new KeyValuePair <string, Type>("作废时间", typeof(string)) }; headArray.ForEach(p => table.Columns.Add(p.Key, p.Value)); } using (ChannelFactory <ITravelPaperService> cf = new ChannelFactory <ITravelPaperService>(typeof(ITravelPaperService).Name)) { var client = cf.CreateChannel(); DataPack <TravelPaperDto> datapackList = client.FindTravelPaper(UseBusinessmanCode, UseBusinessmanName, useOffice, startTripNumber, endTripNumber, startTicketNumber, endTicketNumber , startCreateTime, endCreateTime, startVoidTime, endVoidTime, startGrantTime, endGrantTime, null, null, (string.IsNullOrEmpty(BuyerType) ? "black" : ""), TripStatus, page, rows, false); List <TravelPaperDto> TravelPaperList = datapackList.List; if (string.IsNullOrEmpty(BuyerType)) { TravelPaperList.ForEach(p => { table.Rows.Add( p.BusinessmanName, p.BusinessmanCode, p.UseOffice, p.TripNumber, EnumItemManager.GetDesc(p.TripStatus), p.BlankRecoveryTime > defaultTime ? p.BlankRecoveryTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.GrantTime > defaultTime ? p.GrantTime.ToString("yyyy-MM-dd HH:mm:ss") : "" ); }); } else if (BuyerType == "0")// 采购详情 { TravelPaperList.ForEach(p => { table.Rows.Add( p.BusinessmanName, p.TripNumber, p.UseOffice, p.TicketNumber, EnumItemManager.GetDesc(p.TripStatus), p.GrantTime > defaultTime ? p.GrantTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.BlankRecoveryTime > defaultTime ? p.BlankRecoveryTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.PrintTime > defaultTime ? p.PrintTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.InvalidTime > defaultTime ? p.InvalidTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.UseTripRemark ); }); } else if (BuyerType == "1")// 综合查询 { TravelPaperList.ForEach(p => { table.Rows.Add( p.BusinessmanName, p.BusinessmanCode, p.UseOffice, p.TicketNumber, p.TripNumber, EnumItemManager.GetDesc(p.TripStatus), p.BlankRecoveryTime > defaultTime ? p.BlankRecoveryTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.GrantTime > defaultTime ? p.GrantTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.PrintTime > defaultTime ? p.PrintTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.InvalidTime > defaultTime ? p.InvalidTime.ToString("yyyy-MM-dd HH:mm:ss") : "" ); }); } } return(File(export.GetMemoryStream(table), "application/ms-excel", HttpUtility.UrlEncode(string.Format("{0}_{1}.{2}", table.TableName, System.DateTime.Now.ToString("yyy-MM-ddHHMMss"), export.TypeName), System.Text.Encoding.UTF8))); }