//刷新指定订单 private void RefreshOrders(ResponseOrder order) { IsBusy = true; Action action = () => CommunicateManager.Invoke <IOrderService>(service => { var data = service.GetOrderBySearch(order.OrderId, null, null, null, null, null, 0, 1, OutTradeNo, StartFlightTime, EndFlightTime); if (data.List == null) { return; } DispatcherHelper.UIDispatcher.Invoke(new Action(() => { try { var index = Orders.IndexOf(Orders.FirstOrDefault(p => p.OrderId == order.OrderId)); Orders[index] = data.List[0]; } catch (Exception ex) { Console.WriteLine(ex.Message); //throw; } })); }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); }); }
private void ExecutePayCommand(ResponseOrder model) { if (String.IsNullOrEmpty(model.OrderId)) { return; } IsBusy = true; Action action = () => CommunicateManager.Invoke <IOrderService>(service => { //var isPay = service.PnrIsPay(model.OrderId); string result = service.QueryPayStatus(model.OrderId, "Pay"); if (result != "已支付") { LocalUIManager.ShowPayInsuranceAndRefund(model.OrderId, dialogResult => RefreshOrders(model)); } else { UIManager.ShowMessage("该订单已支付"); } }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); RefreshOrders(model); }); }
private void ExecuteCancelOrderCommand(ResponseOrder order) { // var dialogResult = UIManager.ShowMessageDialog("提醒:你正在进行取消订单操作!"); // if (dialogResult == null || !dialogResult.Value) // return; // if (order.ClientOrderStatus == EnumOrderStatus.Invalid) { UIManager.ShowMessage("订单已经失效"); ExecuteQueryCommand(); return; } bool isChecked; var dialogResult = UIManager.ShowCancelOrderWindow(order.PnrSource == EnumPnrSource.CreatePnr, out isChecked); if (dialogResult == null || !dialogResult.Value) { return; } Logger.WriteLog(LogType.INFO, "取消订单时,勾选是否同时取消编码状态:" + isChecked); IsBusy = true; Action action = () => CommunicateManager.Invoke <IOrderService>(service => service.CancelOrder(order.OrderId, isChecked), UIManager.ShowErr); //Task.Factory.StartNew(action).ContinueWith(task => //{ // Action setBusyAction = () => { IsBusy = false; }; // DispatcherHelper.UIDispatcher.Invoke(setBusyAction); // RefreshOrders(order); //}); Task.Factory.StartNew(action).ContinueWith(task => RefreshOrders(order)); }
private void ExecuteChoosePolicy(ResponseOrder order) { //if (order.ClientOrderStatus == EnumOrderStatus.Invalid) { UIManager.ShowMessage("订单已经失效"); ExecuteQueryCommand(); return; } if (order.Passengers.Count == order.Passengers.Count(p => p.PassengerType == EnumPassengerType.Baby)) { UIManager.ShowMessage("婴儿不能选择政策"); return; } if (order.Policy != null && order.Policy.PolicySpecialType != null && order.Policy.PolicySpecialType != EnumPolicySpecialType.Normal) { UIManager.ShowMessage("特价订单不能选择政策"); return; } IsBusy = true; Func <PolicyPack> func = () => { PolicyPack result = null; CommunicateManager.Invoke <IOrderService>( service => { result = service.GetPolicyByOrderId(order.OrderId); }, UIManager.ShowErr); return(result); }; Task.Factory.StartNew(func).ContinueWith(task => { IsBusy = false; var model = task.Result; if (model == null) { return; } LocalUIManager.ShowPolicyList(model, () => RefreshOrders(order)); }); }
private void ExecuteReissueCommand(ResponseOrder order) { LocalUIManager.ShowReissue(order, isOk => { if (isOk == null || !isOk.Value) { return; } RefreshOrders(order); }); }
private void ExecuteAuthCommand(ResponseOrder model) { if (String.IsNullOrEmpty(model.OrderId)) { return; } CommunicateManager.Invoke <IOrderService>(service => { var oo = service.GetClientOrderDetail(model.OrderId); UIManager.ShowMessage("授权指令:RMK TJ AUTH " + oo.Policy.CPOffice); }, UIManager.ShowErr); }
private void ExecuteOpenOrderInfoCommand(ResponseOrder order) { var oo = new OrderDetailDto(); CommunicateManager.Invoke <IOrderService>(service => { oo = service.GetClientOrderDetail(order.OrderId); }, UIManager.ShowErr); try { var flag = oo.Policy.PolicySourceType == "接口" ? 1 : 0; LocalUIManager.ShowOrderInfo(order.OrderId, null, flag); } catch (Exception exx) { Logger.WriteLog(LogType.ERROR, exx.Message, exx); } }
private void ExecuteQueryPayStatusCommand(ResponseOrder model) { if (String.IsNullOrEmpty(model.OrderId)) { return; } //CommunicateManager.Invoke<IOrderService>(service => service.QueryPayStatus(model.OrderId), UIManager.ShowErr); Logger.WriteLog(LogType.INFO, "订单号:" + model.OrderId + "执行支付查询"); IsBusy = true; Action action = () => CommunicateManager.Invoke <IOrderService>(service => UIManager.ShowMessage(service.QueryPayStatus(model.OrderId)), UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); RefreshOrders(model); }); }
/// <summary> /// 显示退改签面板 /// </summary> /// <param name="order"></param> /// <param name="call"></param> internal static void ShowReissue(ResponseOrder order, Action <bool?> call = null) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { var window = new ReissueWindow { Owner = Application.Current.MainWindow }; var vm = new ReissueViewModel(); vm.LoadOrderInfo(order.OrderId); window.DataContext = vm; var dialogResult = window.ShowDialog(); if (call != null) { call(dialogResult); } window.DataContext = null; })); }
public async Task <string> GetStatistics(string idShiping) { var s = Request; string res = ""; if (idShiping != null && idShiping != "") { res = JsonConvert.SerializeObject(await managerShope.GetStatistics(idShiping)); } else { Response response = new Response(); ResponseOrder responseOrder = new ResponseOrder(); ResponseStore responseStore = new ResponseStore(); responseOrder.Status = "No_Content"; responseStore.Status = "No_Content"; response.ResponseOrder = responseOrder; response.ResponseStore = responseStore; res = JsonConvert.SerializeObject(response); } Response.Headers.Add("Access-Control-Allow-Origin", "*"); return(res); }
public bool UpdateEx(Order input) { OrderJson orderjson = ConfigFactory.GetConfig <OrderJson>() ?? new OrderJson(); List <SuccessOrder> list = orderjson.list; if (list == null || list.Count == 0) { return(false); } SuccessOrder success = list.FirstOrDefault(r => r.ResponseOrder.out_biz_no == input.Out_trade_no); var flag = false; if (success != null) { ResponseOrder res = success.ResponseOrder; TakeList takelist = takelistapp.Repository.GetWhere(r => r.Out_trade_no == res.out_biz_no).FirstOrDefault(); Order order = Repository.Get(res.oid); if (order == null || order.Out_trade_no != input.Out_trade_no) { throw new MsgException("文件信息有误."); } if (order.IsSuccess != 0) { throw new MsgException("订单已经改写,不能覆盖."); } Account account = accountapp.Get(res.aid); TipsFlow tf = tipsflowapp.Get(res.tfid); if (tf == null || tf.IsActive == true) { throw new MsgException("手续费信息有误"); } if (account == null) { throw new MsgException("找不到该资金账户"); } using (var tran = new TransactionScope()) { if (res.point >= 1) { UnitWork.RegisterNew(new PointDetail() { FromType = order.PayType, Money = order.Total_amount, CreateTime = DateTime.Now, IsActive = true, Point = res.point, StoreId = order.StoreNo, StoreName = takelist.StoreName, BuyerId = takelist.Account }); } UnitWork.RegisterDirty(tf, () => new TipsFlow { IsActive = true }); UnitWork.RegisterDirty(takelist, () => new TakeList { State = 1 }); order.Gmt_payment = Convert.ToDateTime(res.pay_date); order.Trade_status = res.code; order.IsSuccess = 1; order.Trade_no = res.order_id; UnitWork.RegisterDirty <Order>(order); account.Balance -= order.Total_amount; account.TakeOut += order.Total_amount; UnitWork.RegisterDirty <Account>(account); UnitWork.Commit(); tran.Complete(); } list.Remove(success); //订单Json文件修改. ConfigFactory.SetConfig <OrderJson>(orderjson); flag = true; } else { throw new MsgException("未找到该订单信息"); } return(flag); }
public async Task <Response> GetStatistics(string idShiping) { Store store = null; ResponseOrder responseOrder = null; ResponseStore responseStore = null; Response response = new Response(); OfferOrder offerOrder1 = await GetOfferOrder(idShiping); if (offerOrder1.Store_id != 0) { store = await GetStore(offerOrder1.Store_id.ToString()); } if (offerOrder1 != null) { responseOrder = new ResponseOrder(); DateTime dateTime = DateTime.Parse(offerOrder1.PriceOffers.First().DatateUpdate); if (dateTime.AddMonths(1) <= DateTime.Now) { responseOrder.PriceOffers = offerOrder1.PriceOffers; responseOrder.Status = "OK"; } else { responseOrder.PriceOffers = new List <PriceOffer>(); responseOrder.Status = "No_Content"; } } else { responseOrder = new ResponseOrder(); responseOrder.PriceOffers = new List <PriceOffer>(); responseOrder.Status = "No_Content"; } if (store != null) { responseStore = new ResponseStore(); double timeOnTheMarketYears = 0; responseStore.CommunicationS = Convert.ToInt32(store.Communication.Replace("%", "")); responseStore.ShippingSpeedS = Convert.ToInt32(store.ShippingSpeed.Replace("%", "")); responseStore.ItemAsDescribedS = Convert.ToInt32(store.ItemAsDescribed.Replace("%", "")); responseStore.StartOfSaleS = GetPercentStartOfSale(store.StartOfSales, ref timeOnTheMarketYears); responseStore.FeedBackS = GetPercentFeedBack(Convert.ToInt32(store.Positive4_5Stars.Replace(",", "").Trim()), Convert.ToInt32(store.Neutral3Stars.Replace(",", "").Trim()), Convert.ToInt32(store.Negative1_2Stars.Replace(",", "").Trim())); responseStore.Seller_RatingS = GetPercentSeller_Rating(responseStore.CommunicationS + responseStore.ShippingSpeedS + responseStore.ItemAsDescribedS + responseStore.StartOfSaleS + responseStore.FeedBackS); responseStore.TimeOnTheMarketYears = timeOnTheMarketYears.ToString(); responseStore.Communication = GetDescCommunication(responseStore.CommunicationS); responseStore.ShippingSpeed = GetShippingSpeed(responseStore.ShippingSpeedS); responseStore.ItemAsDescribed = GetDescItemAsDescribed(responseStore.ItemAsDescribedS); responseStore.StartOfSale = GetDescStartOfSale(timeOnTheMarketYears); responseStore.FeedBack = GetDescFeedBack(responseStore.FeedBackS); responseStore.Seller_Rating = GetDescSeller_Rating(responseStore.Seller_RatingS); responseStore.Status = "OK"; } else { responseStore = new ResponseStore(); responseStore.Status = "No_Content"; } response.ResponseOrder = responseOrder; response.ResponseStore = responseStore; return(response); }
public IHttpContext Check(IHttpContext context) { string payload = context.Request.Payload.ToString(); //Liefert einen JSON String mit escaped zeichen zurück JToken token = JToken.Parse(payload); JObject json = JObject.Parse(token.ToString()); if (payload == null || payload.Equals("")) { context.Response.SendResponse(Grapevine.Shared.HttpStatusCode.InternalServerError, "Oops, something went wrong!"); return(context); } CheckOrder orderObject = JsonConvert.DeserializeObject <CheckOrder>(json.ToString()); try { bool foundOrder = false; var dbOrders = dbConnectionOrders._db; var entrys = dbOrders.Find(new BsonDocument()).ToList(); foreach (var item in entrys) { //Getting the order from the database Guid deserializedOrderID = new Guid(item.GetElement("orderID").Value.ToString()); Guid deserializedAktienID = new Guid(item.GetElement("aktienID").Value.ToString()); int deserializedAmount = Int32.Parse(item.GetElement("amount").Value.ToString(), System.Globalization.NumberStyles.Any); double deserializedLimit = Double.Parse(item.GetElement("limit").Value.ToString(), System.Globalization.NumberStyles.Any); int deserializedTimestamp = Int32.Parse(item.GetElement("timestamp").Value.ToString(), System.Globalization.NumberStyles.Any); string deserializedHash = item.GetElement("hash").Value.ToString(); int deserializedUseCase = Int32.Parse(item.GetElement("useCase").Value.ToString(), System.Globalization.NumberStyles.Any); int deserializedStatusOfOrder = Int32.Parse(item.GetElement("statusOfOrder").Value.ToString(), System.Globalization.NumberStyles.Any); if (orderObject.orderID.Equals(deserializedOrderID)) { foundOrder = true; //Find the current price of the stock double course = 0L; var dbStocks = dbConnectionStocks._db; var stockEntrys = dbStocks.Find(new BsonDocument()).ToList(); foreach (var stock in stockEntrys) { Guid aktienID = new Guid(stock.GetElement("aktienID").Value.ToString()); if (aktienID.Equals(deserializedAktienID)) { course = double.Parse(stock.GetElement("course").Value.ToString(), System.Globalization.NumberStyles.Any); break; //Since the aktienID should be uniquely, no need to try the remaining stocks in the list } } //Create a Response Order ResponseOrder responseOrder = new ResponseOrder(); responseOrder.orderID = deserializedOrderID; responseOrder.status = deserializedStatusOfOrder; responseOrder.amount = deserializedAmount; responseOrder.price = deserializedLimit; string response = JsonConvert.SerializeObject(responseOrder); response.Replace("state", "status"); //Send back a response context.Response.ContentType = Grapevine.Shared.ContentType.JSON; context.Response.ContentEncoding = Encoding.UTF8; context.Response.SendResponse(Grapevine.Shared.HttpStatusCode.Ok, response); break; } } if (!foundOrder) { context.Response.SendResponse(Grapevine.Shared.HttpStatusCode.NotFound, "OrderID not found!"); } } catch (Exception ex) { Debug.WriteLine(ex); } return(context); }
private bool CanExecuteQueryPayStatusCommand(ResponseOrder model) { return(!isBusy); }
private bool CanExecuteAuthCommand(ResponseOrder model) { return(true); }
private bool CanExecuteOpenOrderInfoCommand(ResponseOrder order) { return(true); }
private bool CanExecuteReissueCommand(ResponseOrder order) { return(true); }
private void ExecuteOpenAfterSaleCommand(ResponseOrder order) { LocalUIManager.ShowAfterSale(order.OrderId); }
private bool CanExecutePayCommand(ResponseOrder model) { return(!IsBusy); }
private bool CanExecuteOpenAfterSaleCommand(ResponseOrder order) { return(true); }
private bool CanExecuteCancelOrderCommand(ResponseOrder order) { return(!isBusy); }
private bool CanExecuteChoosePolicy(ResponseOrder arg) { return(!isBusy); }
private void ExecuteChooseOrderId(ResponseOrder order) { OrderId = order.OrderId; IsSelected = true; }
private void ExecuteOpenSendMsgCommand(ResponseOrder order) { LocalUIManager.ShowSendMsg(order.OrderId); }
private bool CanExecuteOpenCoordinationCommand(ResponseOrder order) { return(true); }
private void ExecuteOpenCoordinationCommand(ResponseOrder order) { LocalUIManager.ShowCoordination(order.OrderId); }