public List <ModelResult> Parse(string query, System.DateTime refTime) { // preprocess the query query = FormatUtility.Preprocess(query); var extractResults = Extractor.Extract(query, refTime); var parseDateTimes = new List <DateTimeParseResult>(); foreach (var result in extractResults) { var parseResult = Parser.Parse(result, refTime); if (parseResult.Value is List <DateTimeParseResult> ) { parseDateTimes.AddRange((List <DateTimeParseResult>)parseResult.Value); } else { parseDateTimes.Add(parseResult); } } return(parseDateTimes.Select(o => new ModelResult { Start = o.Start.Value, End = o.Start.Value + o.Length.Value - 1, TypeName = o.Type, Resolution = o.Value as SortedDictionary <string, object>, Text = o.Text }).ToList()); }
public List <ModelResult> Parse(string query, DateObject refTime) { // Preprocess the query query = FormatUtility.Preprocess(query); var parsedDateTimes = new List <DateTimeParseResult>(); try { var extractResults = Extractor.Extract(query, refTime); foreach (var result in extractResults) { var parseResults = Parser.Parse(result, refTime); if (parseResults.Value is List <DateTimeParseResult> list) { parsedDateTimes.AddRange(list); } else { parsedDateTimes.Add(parseResults); } } // Filter out ambiguous cases. Naïve approach. parsedDateTimes = Parser.FilterResults(query, parsedDateTimes); } catch (Exception) { // Nothing to do. Exceptions in parse should not break users of recognizers. // No result. } return(parsedDateTimes.Select(o => GetModelResult(o)).ToList()); }
public List <ModelResult> Parse(string query, System.DateTime refTime) { // Preprocess the query query = FormatUtility.Preprocess(query); var parsedDateTimes = new List <DateTimeParseResult>(); try { var extractResults = Extractor.Extract(query, refTime); foreach (var result in extractResults) { var parseResult = Parser.Parse(result, refTime); if (parseResult.Value is List <DateTimeParseResult> ) { parsedDateTimes.AddRange((List <DateTimeParseResult>)parseResult.Value); } else { parsedDateTimes.Add(parseResult); } } } catch (Exception) { // Nothing to do. Exceptions in parse should not break users of recognizers. // No result. } return(parsedDateTimes.Select(o => GetModelResult(o)).ToList()); }
public EnglishTimeZoneExtractorConfiguration(DateTimeOptions options = DateTimeOptions.None) : base(options) { if ((options & DateTimeOptions.EnablePreview) != 0) { CityMatcher.Init(TimeZoneDefinitions.MajorLocations.Select(o => FormatUtility.RemoveDiacritics(o.ToLowerInvariant()))); } }
public static LiabilityViewModel GetLiabilityViewModelByLiability(Liabilities liability) { LiabilityViewModel result = new LiabilityViewModel(); result.Liability = liability; if (liability.LiabilityType == (int)Constants.Constants.LIABILITY_TYPE.CREDIT_CARD) { double interestPerMonth = liability.InterestRate / 1200; result.MonthlyInterestPayment = liability.Value * interestPerMonth; result.CurrentInterestRate = liability.InterestRate; } else { int totalPeriod = FormatUtility.CalculateTimePeriod(liability.StartDate.Value, liability.EndDate.Value); DateTime current = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); int currentPeriod = FormatUtility.CalculateTimePeriod(liability.StartDate.Value, current) + 1; double interestPerMonth = liability.InterestRate / 1200; result.TotalPaymentPeriod = totalPeriod; result.MonthlyOriginalPayment = liability.Value / totalPeriod; result.MonthlyInterestPayment = liability.Value * interestPerMonth; result.MonthlyPayment = result.MonthlyInterestPayment + result.MonthlyOriginalPayment; result.CurrentInterestRate = liability.InterestRate; result.RemainedValue = liability.Value - currentPeriod * result.MonthlyOriginalPayment; } return(result); }
public List <ModelResult> Parse(string query) { // preprocess the query query = FormatUtility.Preprocess(query, false); List <ModelResult> extractionResults = new List <ModelResult>(); foreach (var p in ExtractorParserDic) { var extractor = p.Key; var parser = p.Value; var extractResults = extractor.Extract(query); var parseResults = new List <ParseResult>(); foreach (var result in extractResults) { parseResults.Add(parser.Parse(result)); } var modelResults = parseResults.Select(o => new ModelResult { Start = o.Start.Value, End = o.Start.Value + o.Length.Value - 1, Resolution = (o.Value is UnitValue) ? new SortedDictionary <string, object> { { "value", ((UnitValue)o.Value).Number }, { "unit", ((UnitValue)o.Value).Unit } } : new SortedDictionary <string, object> { { "value", (string)o.Value } }, Text = o.Text, TypeName = ModelTypeName }).ToList(); foreach (var result in modelResults) { bool bAdd = true; foreach (var extractionResult in extractionResults) { if (extractionResult.Start == result.Start && extractionResult.End == result.End) { bAdd = false; } } if (bAdd) { extractionResults.Add(result); } } } return(extractionResults); }
public List <ExtractResult> Extract(string text, DateObject reference) { var normalizedText = FormatUtility.RemoveDiacritics(text); var tokens = new List <Token>(); tokens.AddRange(TimeZoneMatch(normalizedText)); tokens.AddRange(CityTimeMatch(normalizedText)); return(Token.MergeAllTokens(tokens, text, ExtractorName)); }
/// <summary> /// /// </summary> public void Format(Object sender, System.EventArgs e) { ITabbedDocument doc = PluginBase.MainForm.CurrentDocument; if (doc.IsEditable) { doc.SciControl.BeginUndoAction(); Int32 oldPos = CurrentPos; String source = doc.SciControl.Text; try { switch (DocumentType) { case TYPE_AS3PURE: ASPrettyPrinter asPrinter = new ASPrettyPrinter(true, source); FormatUtility.ConfigureASPrinter(asPrinter, this.settingObject, PluginBase.Settings.TabWidth); String asResultData = asPrinter.Print(0); if (asResultData == null) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } else { doc.SciControl.Text = asResultData; doc.SciControl.ConvertEOLs(doc.SciControl.EOLMode); } break; case TYPE_MXML: case TYPE_XML: MXMLPrettyPrinter mxmlPrinter = new MXMLPrettyPrinter(source); FormatUtility.ConfigureMXMLPrinter(mxmlPrinter, this.settingObject, PluginBase.Settings.TabWidth); String mxmlResultData = mxmlPrinter.Print(0); if (mxmlResultData == null) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } else { doc.SciControl.Text = mxmlResultData; doc.SciControl.ConvertEOLs(doc.SciControl.EOLMode); } break; } } catch (Exception) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } CurrentPos = oldPos; doc.SciControl.EndUndoAction(); } }
private void RefreshScaleText(Size actualSize) { var viewRect = new Rect(new Point(), actualSize); var centerPoint = new Point(viewRect.Width / 2.0, viewRect.Height / 2.0); var scale = Scale * Math.Min(centerPoint.X, centerPoint.Y); var textBrush = (Brush)FindResource("SystemMapScaleTextBrush"); var scaleWidth = (double)FindResource("SystemMapScaleWidth"); m_scaleText = new FormattedText(FormatUtility.RenderDistance(scaleWidth / scale), CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 12, textBrush, 1.0); }
public string GetCurrentFilesToProcessSize() { var files = FilesManager.GetFilesInfo(_context.Settings.GetApplicationFolderPath()); long size = 0; foreach (var fileInfo in files) { size += fileInfo.Size; } return(FormatUtility.FormatSizeDecimal(size, 2)); }
public string GetCurrentFilesToProcessSize() { var files = FilesManager.GetFilesInfo(_context.Settings.GetUpdaterFolderPath()).Where(f => !f.RelativePath.EndsWith(_context.Settings.UpdaterIndexFileName)); long size = 0; foreach (var fileInfo in files) { size += fileInfo.Size; } return(FormatUtility.FormatSizeDecimal(size, 2)); }
public void UpdateProgressChanged(UpdateProgress e) { Dispatcher.Invoke(() => { var totalSteps = Math.Max(e.TotalSteps, 1); ProgressBar.Progress = (float)e.CurrentSteps / totalSteps; ProgressPercentage.text = (e.CurrentSteps * 100 / totalSteps) + "%"; SizeProgress.text = FormatUtility.FormatSizeDecimal(e.CurrentSteps, 2) + "/" + FormatUtility.FormatSizeDecimal(e.TotalSteps, 2); }); Log(e.StepMessage); }
public async Task <Dictionary <Guid, RankStats> > GetRanksAsync(Platform platform, Region region, Season season, params Guid[] userIds) { RankResponse response = await RankRequests.GetRank(this, platform, region, season, userIds); return(response.Players.ToDictionary(kv => Guid.Parse(kv.Key), kv => new RankStats { Abandons = kv.Value.Abandons, Losses = kv.Value.Losses, Mmr = kv.Value.Mmr, Rank = kv.Value.Rank, SeasonId = kv.Value.Season, Wins = kv.Value.Wins, MaxMmr = kv.Value.MaxMmr, MaxRank = kv.Value.MaxRank, Region = FormatUtility.RegionFromString(kv.Value.Region) ?? throw new FormatException("Unknown region format") }));
public void DownloadProgressChanged(object sender, DownloadEventArgs e) { if (_lastTime.AddSeconds(1) <= DateTime.UtcNow) { _downloadSpeed = (int)((e.CurrentFileSize - _lastSize) / (DateTime.UtcNow - _lastTime).TotalSeconds); if (_downloadSpeed < 0) { _downloadSpeed = 0; } _lastSize = e.CurrentFileSize; _lastTime = DateTime.UtcNow; } Dispatcher.Invoke(() => { DownloadSpeed.text = FormatUtility.FormatSizeBinary(_downloadSpeed, 2) + "/s";; }); }
public CustomerModel(JObject json) { id = FormatUtility.ConvertToString(json, "id"); custom_contract_no = FormatUtility.ConvertToString(json, "custom_contract_no"); //email получаются списком. Брать только первый из списка email = GetFirstValue(json, "email"); //phone получаются списком. Брать только первый из списка phone = GetFirstValue(json, "phone"); balance = FormatUtility.ConvertToString(json, "balance"); name = FormatUtility.ConvertToString(json, "name"); if (!string.IsNullOrEmpty(phone)) { phone = phone.Replace("(", ""); phone = phone.Replace(")", ""); phone = phone.Replace("-", ""); } }
public Task <ActionResult> SavePersonalDetails(PersonDetailsVm model) { if (!ModelState.IsValid) { return(Index(ManageMessageId.Error)); } try { _userService.SavePersonalDetails(model, User.Identity.GetUserId()); _log.Info($"Successfully updated profile of user {User.Identity.Name}"); return(Index(ManageMessageId.UpdatedProfile)); } catch (Exception exception) { _log.Error(FormatUtility.GetExceptionMessage(exception)); return(Index(ManageMessageId.Error)); } }
public List <ModelResult> Parse(string query, System.DateTime refTime) { // Preprocess the query query = FormatUtility.Preprocess(query); var parsedDateTimes = new List <DateTimeParseResult>(); try { var extractResults = Extractor.Extract(query, refTime); foreach (var result in extractResults) { var parseResult = Parser.Parse(result, refTime); if (parseResult.Value is List <DateTimeParseResult> ) { parsedDateTimes.AddRange((List <DateTimeParseResult>)parseResult.Value); } else { parsedDateTimes.Add(parseResult); } } } catch (Exception) { // Nothing to do. Exceptions in parse should not break users of recognizers. // No result. } return(parsedDateTimes.Select(o => new ModelResult { Start = o.Start.Value, End = o.Start.Value + o.Length.Value - 1, TypeName = o.Type, Resolution = o.Value as SortedDictionary <string, object>, Text = o.Text, ParentText = GetParentText(o) }).ToList()); }
public static string FromBase64(this string val) { return(FormatUtility.ConvertBase64ToString(val)); }
public static string ToBase64(this string val) { return(FormatUtility.ConvertStringToBase64(val)); }
public async Task <string> Webhook(string token = null) { //token = "qwerty123456"; var stream = Request.InputStream; // Проверка токена var authAlfaCRMRepository = AppController.Get <IAuthAlfaCRMRepository>(); var authAlfaCRM = authAlfaCRMRepository.GetByToken(token); if (authAlfaCRM == null) { throw new ArgumentException("Даный токен не найден", "token"); } StreamReader reader = new StreamReader(stream); string text = reader.ReadToEnd(); LogService.Current.Debug("StreamReader : " + text); LogService.QueryLog.WriteRequest(text, (int)QueryType.Webhook, "Webhook от AlfaCRM", authAlfaCRM.ServiceId); var json = JObject.Parse(text); var eventName = FormatUtility.ConvertToString(json, "event"); // Должны обрабатываться только события добавления switch (eventName) { case "update": case "delete": return("200"); } var fields_new = JObject.Parse((json.GetValue("fields_new").ToString())); var customer_id = FormatUtility.ConvertToInteger(fields_new, "customer_id"); var tokenAlfa = await NetworkService.Authorization(authAlfaCRM); var responseCustomer = await NetworkService.GetCustomes(customer_id.ToString(), authAlfaCRM, tokenAlfa); var customer = new CustomerModel(JObject.Parse(responseCustomer).GetValue("items").First.ToString()); //var branch_id = json.GetValue("branch_id").ToString().Trim('{', '}'); /*var tokenAlfaCRM = await NetworkService.Authorization(authAlfaCRM); * * if(tokenAlfaCRM == null) * { * throw new ArgumentException("Ошибка получения токена от AlfaCRM", "tokenAlfaCRM"); * } * * var sessionAlfaCRMRepository = AppController.Get<ISessionAlfaCRMRepository>(); * * int session_id = sessionAlfaCRMRepository.Save(tokenAlfaCRM, authAlfaCRM.Id);*/ // формирование запроса на API ExpressPay // нужно получить токен для выставления счета var serviceIntegrationRepository = AppController.Get <IServiceIntegrationRepository>(); string tokenAPI = serviceIntegrationRepository.GetTokenByServiceId(authAlfaCRM.ServiceId); //"a75b74cbcfe446509e8ee874f421bd64"; var model = new InvoiceModel() { Token = "a75b74cbcfe446509e8ee874f421bd64", AccountNo = customer.custom_contract_no,//"100", Amount = FormatUtility.Convert(fields_new, "income"), Currency = 933, Info = FormatUtility.ConvertToString(fields_new, "note"), EmailNotification = customer.email, SmsPhone = customer.phone }; string response = await NetworkService.Invoicing(model, authAlfaCRM.ServiceId); var responseJson = JObject.Parse(response); var invoiceNo = FormatUtility.ConvertToInteger(responseJson, "InvoiceNo"); LogService.Current.Debug("InvoiceNo : " + invoiceNo); // var alfaCRMEntityRepository = AppController.Get<IAlfaCRMEntityRepository>(); //var id = alfaCRMEntityRepository.Save(entity_id, customer_id, invoiceNo); return("200"); }
public static string log_file(int index) { return(FormatUtility.Format("log/log_{0}.txt", index)); }
public ActionResult CheckAvailableMoney(DateTime?date) { double result = (double)AssetQueries.CheckAvailableMoney(UserQueries.GetCurrentUsername(), date == null ? DateTime.Now : date.Value); return(Content(FormatUtility.DisplayThousandSeparatorsForNumber(result))); }
public List <ModelResult> Parse(string query) { // Preprocess the query query = FormatUtility.Preprocess(query, false); List <ModelResult> extractionResults = new List <ModelResult>(); try { foreach (var p in ExtractorParserDic) { var extractor = p.Key; var parser = p.Value; var extractedResults = extractor.Extract(query); var parsedResults = new List <ParseResult>(); foreach (var result in extractedResults) { var parseResult = parser.Parse(result); if (parseResult.Value is List <ParseResult> ) { parsedResults.AddRange((List <ParseResult>)parseResult.Value); } else { parsedResults.Add(parseResult); } } var modelResults = parsedResults.Select(o => new ModelResult { Start = o.Start.Value, End = o.Start.Value + o.Length.Value - 1, Resolution = (o.Value is UnitValue) ? new SortedDictionary <string, object> { { ResolutionKey.Value, ((UnitValue)o.Value).Number }, { ResolutionKey.Unit, ((UnitValue)o.Value).Unit } } : (o.Value is CurrencyUnitValue) ? new SortedDictionary <string, object> { { ResolutionKey.Value, ((CurrencyUnitValue)o.Value).Number }, { ResolutionKey.Unit, ((CurrencyUnitValue)o.Value).Unit }, { ResolutionKey.IsoCurrency, ((CurrencyUnitValue)o.Value).IsoCurrency } } : new SortedDictionary <string, object> { { ResolutionKey.Value, (string)o.Value } }, Text = o.Text, TypeName = ModelTypeName }).ToList(); foreach (var result in modelResults) { bool bAdd = true; foreach (var extractionResult in extractionResults) { if (extractionResult.Start == result.Start && extractionResult.End == result.End) { bAdd = false; } } if (bAdd) { extractionResults.Add(result); } } } } catch (Exception) { // Nothing to do. Exceptions in parse should not break users of recognizers. // No result. } return(extractionResults); }
public async Task <string> Notification(string id) { string token = id; var stream = Request.InputStream; if (token == null) { throw new ArgumentException("Токен не может быт пустым", "token"); } var authAlfaCRMRepository = AppController.Get <IAuthAlfaCRMRepository>(); var authAlfaCRM = authAlfaCRMRepository.GetByTokenExpressPay(token); if (authAlfaCRM == null) { throw new ArgumentException("Полученный токен не найден!", "token"); } StreamReader reader = new StreamReader(stream); string text = reader.ReadToEnd(); text = text.Substring(text.IndexOf("{")); LogService.QueryLog.WriteRequest(text, (int)QueryType.Notification, "Уведомление о платеже от ExpressPay", authAlfaCRM.ServiceId); //LogService.Current.Debug("Уведомление о платеже от ExpressPay : " + text); var json = JObject.Parse(text); var cmdType = FormatUtility.ConvertToString(json, "CmdType"); // Если Тип уведомления не 3 то на него можно не реагировать и вернуть серверу статус 200 if (cmdType != "3") { return("200,OK"); } var status = FormatUtility.ConvertToString(json, "Status"); // Нужно реагированить только на оплату switch (status) { case "1": //Ожидает оплату case "2": //Просрочен case "5": //Отменен return("200,OK"); } var amount = FormatUtility.Convert(json, "Amount"); // Авторизация в alfaCRM var tokenAlfaCRM = await NetworkService.Authorization(authAlfaCRM); // Определить, что является лицевым счетом! var customer_id = FormatUtility.ConvertToString(json, "AccountNo"); // Получение баланса плательщика string response = await NetworkService.GetCustomes(customer_id, authAlfaCRM, tokenAlfaCRM); // Отправление изменений json = JObject.Parse(response); var items = JObject.Parse(json.GetValue("items").ToString().Trim('[', ']', '\r', '\n')); var balance = FormatUtility.Convert(items, "balance"); balance += amount; string responseUpdate = await NetworkService.UpdateCustomer(customer_id, tokenAlfaCRM, balance, authAlfaCRM); return("200,OK"); }
/// <summary> /// Formats the specified document /// </summary> private void DoFormat(ITabbedDocument doc) { if (doc.IsEditable) { doc.SciControl.BeginUndoAction(); Int32 oldPos = CurrentPos; String source = doc.SciControl.Text; try { switch (DocumentType) { case TYPE_AS3: ASPrettyPrinter asPrinter = new ASPrettyPrinter(true, source); FormatUtility.configureASPrinter(asPrinter, this.settingObject); String asResultData = asPrinter.print(0); if (asResultData == null) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } else { doc.SciControl.Text = asResultData; doc.SciControl.ConvertEOLs(doc.SciControl.EOLMode); } break; case TYPE_MXML: case TYPE_XML: MXMLPrettyPrinter mxmlPrinter = new MXMLPrettyPrinter(source); FormatUtility.configureMXMLPrinter(mxmlPrinter, this.settingObject); String mxmlResultData = mxmlPrinter.print(0); if (mxmlResultData == null) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } else { doc.SciControl.Text = mxmlResultData; doc.SciControl.ConvertEOLs(doc.SciControl.EOLMode); } break; case TYPE_CPP: AStyleInterface asi = new AStyleInterface(); String optionData = this.GetOptionData(doc.SciControl.ConfigurationLanguage.ToLower()); String resultData = asi.FormatSource(source, optionData); if (String.IsNullOrEmpty(resultData)) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } else { // Remove all empty lines if not specified for astyle if (!optionData.Contains("--delete-empty-lines")) { resultData = Regex.Replace(resultData, @"^\s+$[\r\n]*", Environment.NewLine, RegexOptions.Multiline); } doc.SciControl.Text = resultData; doc.SciControl.ConvertEOLs(doc.SciControl.EOLMode); } break; } } catch (Exception) { TraceManager.Add(TextHelper.GetString("Info.CouldNotFormat"), -3); PluginBase.MainForm.CallCommand("PluginCommand", "ResultsPanel.ShowResults"); } CurrentPos = oldPos; doc.SciControl.EndUndoAction(); } }
public static string GetApplyform(BaseApplyform obj) { StringBuilder str = new StringBuilder(); str.Append("<applyform><title>"); //退票申请 if (obj is RefundApplyform) { var applyform = obj as RefundApplyform; str.AppendFormat("<id>{0}</id>", applyform.Id); str.AppendFormat("<applyType>{0}</applyType>", "1"); str.AppendFormat("<status>{0}</status>", (int)applyform.Status); str.AppendFormat("<statusDescription>{0}</statusDescription>", Service.Order.StatusService.GetRefundApplyformStatus(applyform.Status, OrderRole.Purchaser)); str.AppendFormat("<refundType>{0}</refundType>", (int)applyform.RefundType); str.AppendFormat("<originalPNR>{0}</originalPNR>", applyform.OriginalPNR == null ? "" : applyform.OriginalPNR.BPNR + "|" + applyform.OriginalPNR.PNR); str.AppendFormat("<newPNR>{0}</newPNR>", applyform.NewPNR == null ? "" : applyform.NewPNR.BPNR + "|" + applyform.NewPNR.PNR); str.AppendFormat("<amount>{0}</amount>", applyform.Status == RefundApplyformStatus.Refunded ? FormatUtility.FormatAmount(applyform.RefundBill.Purchaser.Amount) : ""); // str.AppendFormat("<applyTime>{0}</applyTime>", FormatUtility.FormatDatetime(applyform.AppliedTime)); str.AppendFormat("<payTime>{0}</payTime>", ""); //退票没有支付时间 str.AppendFormat("<processedTime>{0}</processedTime>", FormatUtility.FormatDatetime(applyform.ProcessedTime)); str.Append("</title><passengers>"); foreach (var item in applyform.Passengers) { str.Append("<p>"); str.AppendFormat("<name>{0}</name>", item.Name); str.AppendFormat("<type>{0}</type>", (int)item.PassengerType); str.AppendFormat("<credentitals>{0}</credentitals>", item.Credentials); str.AppendFormat("<mobile>{0}</mobile>", item.Phone); str.AppendFormat("<settleCode>{0}</settleCode>", item.Tickets.FirstOrDefault().SettleCode); str.AppendFormat("<tickets>{0}</tickets>", item.Tickets.Join("|", num => num.No)); str.Append("</p>"); } str.Append("</passengers><flights>"); foreach (var item in applyform.Flights) { str.Append("<f>"); str.AppendFormat("<departure>{0}</departure>", item.OriginalFlight.Departure.Code); str.AppendFormat("<arrival>{0}</arrival>", item.OriginalFlight.Arrival.Code); str.AppendFormat("<flightNo>{0}</flightNo>", item.OriginalFlight.FlightNo); str.AppendFormat("<aircraft>{0}</aircraft>", item.OriginalFlight.AirCraft); str.AppendFormat("<takeoffTime>{0}</takeoffTime>", FormatUtility.FormatFlightDatetime(item.OriginalFlight.TakeoffTime)); str.AppendFormat("<arrivalTime>{0}</arrivalTime>", FormatUtility.FormatFlightDatetime(item.OriginalFlight.LandingTime)); str.AppendFormat("<bunk>{0}</bunk>", item.OriginalFlight.Bunk.Code); str.AppendFormat("<fare>{0}</fare>", FormatUtility.FormatAmount(item.OriginalFlight.Price.Fare)); str.AppendFormat("<discount>{0}</discount>", item.OriginalFlight.Bunk.Discount.TrimInvaidZero()); str.AppendFormat("<airportFee>{0}</airportFee>", FormatUtility.FormatAmount(item.OriginalFlight.AirportFee)); str.AppendFormat("<baf>{0}</baf>", FormatUtility.FormatAmount(item.OriginalFlight.Price.BAF)); str.AppendFormat("<refundRate>{0}</refundRate>", applyform.Status == RefundApplyformStatus.Refunded ? item.RefundRate.ToString() : ""); str.AppendFormat("<refundFee>{0}</refundFee>", applyform.Status == RefundApplyformStatus.Refunded ? FormatUtility.FormatAmount(applyform.RefundBill.Purchaser.Source.Details.FirstOrDefault(o => o.Flight.Id == item.OriginalFlight.Id) != null ? applyform.RefundBill.Purchaser.Source.Details.First(o => o.Flight.Id == item.OriginalFlight.Id).RefundFee : 0) : ""); str.AppendFormat("<refundServiceCharge>{0}</refundServiceCharge>", FormatUtility.FormatAmount(item.RefundServiceCharge)); str.AppendFormat("<newFlightNo>{0}</newFlightNo>", ""); str.AppendFormat("<newAircraft>{0}</newAircraft>", ""); str.AppendFormat("<newTakeoffTime>{0}</newTakeoffTime>", ""); str.AppendFormat("<newArrivalTime>{0}</newArrivalTime>", ""); str.AppendFormat("<postponeFee>{0}</postponeFee>", ""); str.Append("</f>"); } str.Append("</flights><bills>"); if (applyform.RefundBill != null && applyform.Status == RefundApplyformStatus.Refunded) { str.AppendFormat("<b><type>{0}</type>", "2"); str.AppendFormat("<status>{0}</status>", applyform.RefundBill.Succeed ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(applyform.RefundBill.Tradement.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", applyform.RefundBill.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", ""); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(applyform.RefundBill.Purchaser.Time)); str.Append("</b>"); } str.Append("</bills>"); } //废票申请 if (obj is ScrapApplyform) { var applyform = obj as ScrapApplyform; str.AppendFormat("<id>{0}</id>", applyform.Id); str.AppendFormat("<applyType>{0}</applyType>", "2"); str.AppendFormat("<status>{0}</status>", (int)applyform.Status); str.AppendFormat("<statusDescription>{0}</statusDescription>", Service.Order.StatusService.GetRefundApplyformStatus(applyform.Status, OrderRole.Purchaser)); str.AppendFormat("<refundType>{0}</refundType>", ""); str.AppendFormat("<originalPNR>{0}</originalPNR>", applyform.OriginalPNR == null ? "" : applyform.OriginalPNR.BPNR + "|" + applyform.OriginalPNR.PNR); str.AppendFormat("<newPNR>{0}</newPNR>", applyform.NewPNR == null ? "" : applyform.NewPNR.BPNR + "|" + applyform.NewPNR.PNR); str.AppendFormat("<amount>{0}</amount>", applyform.Status == RefundApplyformStatus.Refunded ? FormatUtility.FormatAmount(applyform.RefundBill.Purchaser.Amount) : ""); // str.AppendFormat("<applyTime>{0}</applyTime>", FormatUtility.FormatDatetime(applyform.AppliedTime)); str.AppendFormat("<payTime>{0}</payTime>", ""); //退票没有支付时间 str.AppendFormat("<processedTime>{0}</processedTime>", FormatUtility.FormatDatetime(applyform.ProcessedTime)); str.Append("</title><passengers>"); foreach (var item in applyform.Passengers) { str.Append("<p>"); str.AppendFormat("<name>{0}</name>", item.Name); str.AppendFormat("<type>{0}</type>", (int)item.PassengerType); str.AppendFormat("<credentitals>{0}</credentitals>", item.Credentials); str.AppendFormat("<mobile>{0}</mobile>", item.Phone); str.AppendFormat("<settleCode>{0}</settleCode>", item.Tickets.FirstOrDefault().SettleCode); str.AppendFormat("<tickets>{0}</tickets>", item.Tickets.Join("|", num => num.No)); str.Append("</p>"); } str.Append("</passengers><flights>"); foreach (var item in applyform.Flights) { str.Append("<f>"); str.AppendFormat("<departure>{0}</departure>", item.OriginalFlight.Departure.Code); str.AppendFormat("<arrival>{0}</arrival>", item.OriginalFlight.Arrival.Code); str.AppendFormat("<flightNo>{0}</flightNo>", item.OriginalFlight.FlightNo); str.AppendFormat("<aircraft>{0}</aircraft>", item.OriginalFlight.AirCraft); str.AppendFormat("<takeoffTime>{0}</takeoffTime>", FormatUtility.FormatFlightDatetime(item.OriginalFlight.TakeoffTime)); str.AppendFormat("<arrivalTime>{0}</arrivalTime>", FormatUtility.FormatFlightDatetime(item.OriginalFlight.LandingTime)); str.AppendFormat("<bunk>{0}</bunk>", item.OriginalFlight.Bunk.Code); str.AppendFormat("<fare>{0}</fare>", FormatUtility.FormatAmount(item.OriginalFlight.Price.Fare)); str.AppendFormat("<discount>{0}</discount>", item.OriginalFlight.Bunk.Discount.TrimInvaidZero()); str.AppendFormat("<airportFee>{0}</airportFee>", FormatUtility.FormatAmount(item.OriginalFlight.AirportFee)); str.AppendFormat("<baf>{0}</baf>", FormatUtility.FormatAmount(item.OriginalFlight.Price.BAF)); str.AppendFormat("<refundRate>{0}</refundRate>", applyform.Status == RefundApplyformStatus.Refunded ? item.RefundRate.ToString() : ""); str.AppendFormat("<refundFee>{0}</refundFee>", applyform.Status == RefundApplyformStatus.Refunded ? FormatUtility.FormatAmount(applyform.RefundBill.Purchaser.Source.Details.First(o => o.Flight.Id == item.OriginalFlight.Id).RefundFee) : ""); str.AppendFormat("<refundServiceCharge>{0}</refundServiceCharge>", FormatUtility.FormatAmount(item.RefundServiceCharge)); str.AppendFormat("<newFlightNo>{0}</newFlightNo>", ""); str.AppendFormat("<newAircraft>{0}</newAircraft>", ""); str.AppendFormat("<newTakeoffTime>{0}</newTakeoffTime>", ""); str.AppendFormat("<newArrivalTime>{0}</newArrivalTime>", ""); str.AppendFormat("<postponeFee>{0}</postponeFee>", ""); str.Append("</f>"); } str.Append("</flights><bills>"); if (applyform.RefundBill != null && applyform.Status == RefundApplyformStatus.Refunded) { str.AppendFormat("<b><type>{0}</type>", "2"); str.AppendFormat("<status>{0}</status>", applyform.RefundBill.Succeed ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(applyform.RefundBill.Tradement.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", applyform.RefundBill.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", ""); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(applyform.RefundBill.Purchaser.Time)); str.Append("</b>"); } str.Append("</bills>"); } //改期申请 if (obj is PostponeApplyform) { var applyform = obj as PostponeApplyform; str.AppendFormat("<id>{0}</id>", applyform.Id); str.AppendFormat("<applyType>{0}</applyType>", "4"); str.AppendFormat("<status>{0}</status>", (int)applyform.Status); str.AppendFormat("<statusDescription>{0}</statusDescription>", Service.Order.StatusService.GetPostponeApplyformStatus(applyform.Status, OrderRole.Purchaser)); str.AppendFormat("<refundType>{0}</refundType>", ""); str.AppendFormat("<originalPNR>{0}</originalPNR>", applyform.OriginalPNR == null ? "" : applyform.OriginalPNR.BPNR + "|" + applyform.OriginalPNR.PNR); str.AppendFormat("<newPNR>{0}</newPNR>", applyform.NewPNR == null ? "" : applyform.NewPNR.BPNR + "|" + applyform.NewPNR.PNR); str.AppendFormat("<amount>{0}</amount>", applyform.Status == PostponeApplyformStatus.Applied || applyform.PayBill == null ? "" : FormatUtility.FormatAmount(applyform.PayBill.Applier.Amount));// str.AppendFormat("<applyTime>{0}</applyTime>", FormatUtility.FormatDatetime(applyform.AppliedTime)); str.AppendFormat("<payTime>{0}</payTime>", applyform.Status == PostponeApplyformStatus.Applied || applyform.PayBill == null ? "" : FormatUtility.FormatDatetime(applyform.PayBill.Applier.Time)); str.AppendFormat("<processedTime>{0}</processedTime>", FormatUtility.FormatDatetime(applyform.ProcessedTime)); str.Append("</title><passengers>"); foreach (var item in applyform.Passengers) { str.Append("<p>"); str.AppendFormat("<name>{0}</name>", item.Name); str.AppendFormat("<type>{0}</type>", (int)item.PassengerType); str.AppendFormat("<credentitals>{0}</credentitals>", item.Credentials); str.AppendFormat("<mobile>{0}</mobile>", item.Phone); str.AppendFormat("<settleCode>{0}</settleCode>", item.Tickets.FirstOrDefault().SettleCode); str.AppendFormat("<tickets>{0}</tickets>", item.Tickets.Join("|", num => num.No)); str.Append("</p>"); } str.Append("</passengers><flights>"); foreach (var item in applyform.Flights) { str.Append("<f>"); str.AppendFormat("<departure>{0}</departure>", item.OriginalFlight.Departure.Code); str.AppendFormat("<arrival>{0}</arrival>", item.OriginalFlight.Arrival.Code); str.AppendFormat("<flightNo>{0}</flightNo>", item.OriginalFlight.FlightNo); str.AppendFormat("<aircraft>{0}</aircraft>", item.OriginalFlight.AirCraft); str.AppendFormat("<takeoffTime>{0}</takeoffTime>", FormatUtility.FormatFlightDatetime(item.OriginalFlight.TakeoffTime)); str.AppendFormat("<arrivalTime>{0}</arrivalTime>", FormatUtility.FormatFlightDatetime(item.OriginalFlight.LandingTime)); str.AppendFormat("<bunk>{0}</bunk>", item.OriginalFlight.Bunk.Code); str.AppendFormat("<fare>{0}</fare>", FormatUtility.FormatAmount(item.OriginalFlight.Price.Fare)); str.AppendFormat("<discount>{0}</discount>", item.OriginalFlight.Bunk.Discount.TrimInvaidZero()); str.AppendFormat("<airportFee>{0}</airportFee>", FormatUtility.FormatAmount(item.OriginalFlight.AirportFee)); str.AppendFormat("<baf>{0}</baf>", FormatUtility.FormatAmount(item.OriginalFlight.Price.BAF)); str.AppendFormat("<refundRate>{0}</refundRate>", ""); str.AppendFormat("<refundFee>{0}</refundFee>", ""); str.AppendFormat("<refundServiceCharge>{0}</refundServiceCharge>", ""); str.AppendFormat("<newFlightNo>{0}</newFlightNo>", item.NewFlight.FlightNo); str.AppendFormat("<newAircraft>{0}</newAircraft>", item.NewFlight.AirCraft); str.AppendFormat("<newTakeoffTime>{0}</newTakeoffTime>", FormatUtility.FormatFlightDatetime(item.NewFlight.TakeoffTime)); str.AppendFormat("<newArrivalTime>{0}</newArrivalTime>", FormatUtility.FormatFlightDatetime(item.NewFlight.LandingTime)); str.AppendFormat("<postponeFee>{0}</postponeFee>", FormatUtility.FormatAmount(item.PostponeFee)); str.Append("</f>"); } str.Append("</flights><bills>"); if (applyform.PayBill != null) { str.AppendFormat("<b><type>{0}</type>", "1"); str.AppendFormat("<status>{0}</status>", applyform.PayBill.Applier.Success ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(applyform.PayBill.Tradement.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", applyform.PayBill.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", applyform.PayBill.Tradement.ChannelTradeNo); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(applyform.PayBill.Applier.Time)); str.Append("</b>"); if (applyform.PayBill.RefundBill != null) { str.AppendFormat("<b><type>{0}</type>", "2"); str.AppendFormat("<status>{0}</status>", applyform.PayBill.RefundBill.Applier.Success ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(applyform.PayBill.RefundBill.Tradement.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", applyform.PayBill.RefundBill.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", ""); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(applyform.PayBill.RefundBill.Applier.Time)); str.Append("</b>"); } } str.Append("</bills>"); } str.Append("</applyform>"); return(str.ToString()); }
public static string GetOrder(Order orderInfo) { StringBuilder str = new StringBuilder(); str.Append("<order><title>"); str.AppendFormat("<id>{0}</id>", orderInfo.Id); str.AppendFormat("<status>{0}</status>", (int)orderInfo.Status); str.AppendFormat("<statusDescription>{0}</statusDescription>", Service.Order.StatusService.GetOrderStatus(orderInfo.Status, OrderRole.Purchaser)); str.AppendFormat("<product>{0}</product>", (int)orderInfo.Product.ProductType); str.AppendFormat("<ticket>{0}</ticket>", (int)orderInfo.Product.TicketType); str.AppendFormat("<associatePNR>{0}</associatePNR>", orderInfo.AssociatePNR == null ? "" : orderInfo.AssociatePNR.BPNR + "|" + orderInfo.AssociatePNR.PNR); str.AppendFormat("<rebate>{0}</rebate>", orderInfo.Purchaser.Rebate.TrimInvaidZero()); str.AppendFormat("<commission>{0}</commission>", FormatUtility.FormatAmount(orderInfo.Purchaser.Commission)); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(orderInfo.Purchaser.Amount)); str.AppendFormat("<producedTime>{0}</producedTime>", FormatUtility.FormatDatetime(orderInfo.Purchaser.ProducedTime)); str.AppendFormat("<payTime>{0}</payTime>", FormatUtility.FormatDatetime(orderInfo.Bill.PayBill.Purchaser.Time)); str.AppendFormat("<etdzTime>{0}</etdzTime>", FormatUtility.FormatDatetime(orderInfo.ETDZTime)); str.Append("</title>"); str.Append("<pnrs>"); foreach (var pnr in orderInfo.PNRInfos) { str.Append("<pnr>"); str.AppendFormat("<code>{0}</code>", pnr.Code == null ? "" : pnr.Code.BPNR + "|" + pnr.Code.PNR); str.Append("<passengers>"); foreach (var person in pnr.Passengers) { str.AppendFormat("<p><name>{0}</name><type>{1}</type><credentitals>{2}</credentitals><mobile>{3}</mobile><settleCode>{4}</settleCode><tickets>{5}</tickets></p>", person.Name, (int)person.PassengerType, person.Credentials, person.Phone, person.Tickets.FirstOrDefault().SettleCode, person.Tickets.Join("|", num => num.No)); } str.Append("</passengers>"); str.Append("<flights>"); foreach (var filght in pnr.Flights) { str.AppendFormat("<f><departure>{0}</departure><arrival>{1}</arrival><airline>{2}</airline><flightNo>{3}</flightNo><aircraft>{11}</aircraft><takeoffTime>{4}</takeoffTime><arrivalTime>{5}</arrivalTime><bunk>{6}</bunk><fare>{7}</fare><discount>{8}</discount><airportFee>{9}</airportFee><baf>{10}</baf></f>", filght.Departure.Code + "|" + filght.Departure.City, filght.Arrival.Code + "|" + filght.Arrival.City, filght.Carrier.Code + "|" + filght.Carrier.Name, filght.FlightNo, FormatUtility.FormatFlightDatetime(filght.TakeoffTime), FormatUtility.FormatFlightDatetime(filght.LandingTime), filght.Bunk.Code, FormatUtility.FormatAmount(filght.Price.Fare), filght.Bunk.Discount.TrimInvaidZero(), FormatUtility.FormatAmount(filght.AirportFee), FormatUtility.FormatAmount(filght.BAF), filght.AirCraft); } str.Append("</flights>"); str.Append("</pnr>"); } str.Append("</pnrs>"); str.Append("<bills>"); if (orderInfo.Bill.PayBill != null) {//支付 str.Append("<b>"); str.AppendFormat("<type>1</type>"); str.AppendFormat("<status>{0}</status>", orderInfo.Bill.PayBill.Purchaser.Success ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(orderInfo.Bill.PayBill.Purchaser.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", orderInfo.Bill.PayBill.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", orderInfo.Bill.PayBill.Tradement.ChannelTradeNo); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(orderInfo.Bill.PayBill.Purchaser.Time)); str.Append("</b>"); } if (orderInfo.Bill.NormalRefundBills != null) {//退款 foreach (var item in orderInfo.Bill.NormalRefundBills) { str.Append("<b>"); str.AppendFormat("<type>2</type>"); str.AppendFormat("<status>{0}</status>", item.Purchaser.Success ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(item.Tradement.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", item.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", ""); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(item.Purchaser.Time)); str.Append("</b>"); } } if (orderInfo.Bill.PostponePayBills != null) {//支付 foreach (var item in orderInfo.Bill.PostponePayBills) { str.Append("<b>"); str.AppendFormat("<type>1</type>"); str.AppendFormat("<status>{0}</status>", item.Applier.Success ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(item.Applier.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", item.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", item.Tradement.ChannelTradeNo); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(item.Applier.Time)); str.Append("</b>"); } } if (orderInfo.Bill.PostponeRefundBills != null) {//退款 foreach (var item in orderInfo.Bill.PostponeRefundBills) { str.Append("<b>"); str.AppendFormat("<type>2</type>"); str.AppendFormat("<status>{0}</status>", item.Applier.Success ? "1" : "0"); str.AppendFormat("<amount>{0}</amount>", FormatUtility.FormatAmount(item.Applier.Amount)); str.AppendFormat("<tradeNo>{0}</tradeNo>", item.Tradement.TradeNo); str.AppendFormat("<channelTradeNo>{0}</channelTradeNo>", ""); str.AppendFormat("<time>{0}</time>", FormatUtility.FormatDatetime(item.Applier.Time)); str.Append("</b>"); } } str.Append("</bills></order>"); return(str.ToString()); }
private static Region GetRegion(string regionId) { return(FormatUtility.RegionFromString(regionId) ?? throw new NotImplementedException()); }
private static string GetRegionId(Region region) { return(FormatUtility.RegionToString(region)); }
public static void GetPolicy(List <MatchedPolicy> matchedPolicies, List <MatchedPolicy> matchedSpeciafPolicies, StringBuilder str, PolicyType policyType, List <DataTransferObject.FlightQuery.FlightView> flights, Service.Organization.Domain.ExternalInterfaceSetting interfaceSetting) { if ((policyType & PolicyType.Special) != PolicyType.Special) { var list = from item in matchedPolicies let generalPolicy = item.OriginalPolicy as IGeneralPolicy let regulation = item.OriginalPolicy as IHasRegulation select new { Id = item.Id, Type = item.PolicyType == PolicyType.BargainDefault ? (int)PolicyType.Bargain : item.PolicyType == PolicyType.NormalDefault ? (int)PolicyType.Normal : (int)item.PolicyType, Fare = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue), Rebate = FormatUtility.FormatAmount(item.Commission * 100), Commission = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue - item.SettleAmount), Amount = FormatUtility.FormatAmount(item.SettleAmount), Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter((regulation == null ? getEI(flights) : getProvision(regulation))), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource ? "1" : "0", ChangePNR = generalPolicy == null ? false : generalPolicy.ChangePNR, EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60 }; foreach (var item in list) { if (((interfaceSetting.PolicyTypes & PolicyType.Normal) == (PolicyType)item.Type) || ((interfaceSetting.PolicyTypes & PolicyType.Bargain) == (PolicyType)item.Type) || ((interfaceSetting.PolicyTypes & PolicyType.Team) == (PolicyType)item.Type)) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR ? 1 : 0); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } if ((policyType & PolicyType.Team) != PolicyType.Team) { var queryList = from item in matchedSpeciafPolicies where item != null && item.OriginalPolicy != null let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue), Rebate = FormatUtility.FormatAmount(item.Commission * 100), Commission = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue - item.SettleAmount), Amount = FormatUtility.FormatAmount(item.SettleAmount), Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource ? "1" : "0", ChangePNR = "0", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60 }; foreach (var item in queryList) { if (((interfaceSetting.PolicyTypes & PolicyType.Team) == (PolicyType)item.Type)) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } foreach (var item in matchedSpeciafPolicies) { if (!matchedPolicies.Contains(item)) { matchedPolicies.Add(item); } } } } else { var queryList = from item in matchedPolicies let specialPolicy = item.OriginalPolicy as SpecialPolicyInfo let specialPolicyInfo = SpecialProductService.Query(specialPolicy.Type) where item != null && item.OriginalPolicy != null && !specialPolicy.ConfirmResource select new { Id = item.Id, Type = (int)item.PolicyType, Fare = item.ParValue == 100000 ? "" : FormatUtility.FormatAmount(item.ParValue), Rebate = FormatUtility.FormatAmount(item.Commission * 100), Commission = 0, Amount = FormatUtility.FormatAmount(item.SettleAmount), Ticket = (int)(item.OriginalPolicy == null ? TicketType.BSP : item.OriginalPolicy.TicketType), EI = ReplaceEnter(getProvision(item.OriginalPolicy as IHasRegulation)), OfficeNo = item.OriginalPolicy == null && item.NeedAUTH ? item.OfficeNumber : (item.OriginalPolicy != null && item.OriginalPolicy.NeedAUTH ? item.OriginalPolicy.OfficeCode : ""), Condition = item.OriginalPolicy == null ? "" : item.OriginalPolicy.Condition, Confirm = item.ConfirmResource ? "1" : "0", ChangePNR = "0", EtdzTime = getTimeRange(item.WorkStart, item.WorkEnd), RefundTime = getTimeRange(item.WorkStart, item.WorkEnd), ScrapTime = getTimeRange(item.RefundStart, item.RefundEnd), EtdzSpeed = item.Speed == null ? 0 : item.Speed.ETDZ / 60, RefundSpeed = item.Speed == null ? 0 : item.Speed.Refund / 60, OrganizaPolicy = item.OriginalPolicy }; foreach (var item in queryList) { if (((interfaceSetting.PolicyTypes & PolicyType.Special) == (PolicyType)item.Type)) { str.Append("<policy>"); str.AppendFormat("<id>{0}</id>", item.Id); str.AppendFormat("<type>{0}</type>", item.Type); str.AppendFormat("<fare>{0}</fare>", item.Fare); str.AppendFormat("<rebate>{0}</rebate>", item.Rebate); str.AppendFormat("<commission>{0}</commission>", item.Commission); str.AppendFormat("<amount>{0}</amount>", item.Amount); str.AppendFormat("<ticket>{0}</ticket>", item.Ticket); str.AppendFormat("<ei>{0}</ei>", item.EI); //需要授权的office号才有,否则为空字符 str.AppendFormat("<officeNo>{0}</officeNo>", item.OfficeNo); str.AppendFormat("<condition>{0}</condition>", item.Condition); str.AppendFormat("<confirm>{0}</confirm>", item.Confirm); str.AppendFormat("<changePNR>{0}</changePNR>", item.ChangePNR); str.AppendFormat("<etdzTime>{0}</etdzTime>", item.EtdzTime); str.AppendFormat("<refundTime>{0}</refundTime>", item.RefundTime); str.AppendFormat("<scrapTime>{0}</scrapTime>", item.ScrapTime); str.AppendFormat("<etdzSpeed>{0}</etdzSpeed>", item.EtdzSpeed); str.Append("</policy>"); } } } }