public void CompleteTransaction() { var webOrder = new WebOrder( Customer, SelectedDeliveryMode, Bracket ); if (SelectedDeliveryMode == DeliveryMode.AtHome) { _webOrderService.EmitOrder( webOrder ); } else { var shop = _shopInfosService.GetShop(SelectedIdShopClickNCollectId); _webOrderService.EmitClickAndCollect( shop, webOrder ); } Customer.SendMailWebOrderCompleted(webOrder); }
public async Task <WebOrderInfo> GetOrderInfoAsync(WebOrder webOrder) { var url = baseUrl + "api/webOrders/getOrderInfo"; var result = await _restService.PostAsync <WebOrder, WebOrderInfo>(url, webOrder); return(result); }
private void btnProcessFile_Click(object sender, RoutedEventArgs e) { FilePath_TxtBox.Text = string.Empty; WebOrderModel webOrderModel = new WebOrderModel(); try { webOrderModel = WebOrderHelpers.DeserializeToObject <WebOrderModel>(filePath); } catch (System.Exception exception) { MessageBox.Show($"There was an error in processing your file. Make sure it is the correct type and format. {Environment.NewLine}" + $"Error message: {exception.Message}"); } WebOrder webOrderView = new WebOrder(); if (webOrderModel.Equals(new WebOrderModel())) { MessageBox.Show("There seems to be an error with your input file. Check its structure and try again."); } else { webOrderView = new WebOrder(webOrderModel); Id.Content = webOrderView.ID == 0 ? "Wrong order ID" : webOrderView.ID.ToString(); Customer.Content = string.IsNullOrEmpty(webOrderView.Customer) ? "No customer name found." : webOrderView.Customer; Date.Content = webOrderView.Date.Equals(new System.DateTime(0001, 01, 01)) ? Date.Content = "Wrong date format" : webOrderView.Date; PriceAvg.Content = webOrderView.PriceAvg.Equals("000.000") ? "No items found" : webOrderView.PriceAvg; Total.Content = webOrderView.Total.Equals("000.000") ? "No items found" : webOrderView.Total; } }
public async Task <MessageResult> AddOrderAsync(WebOrder webOrder) { var url = baseUrl + "api/webOrders/getOrderInfo"; var result = await _restService.PostAsync <WebOrder, MessageResult>(url, webOrder); return(result); }
public void EmitClickAndCollect(Shop shop, WebOrder webOrder) { _webToShopProxyService.EmitClickAndCollect( shop, webOrder ); }
/// <summary> /// /// </summary> /// <param name="inOrder"></param> public void ValidateOrder(WebOrder inOrder) { if (orderGUIDExists(inOrder.HeaderSection.GUID)) { throw new ExceptionOrderGUIDDuplicate(inOrder.HeaderSection.GUID); } }
public static Order2 ConvertWebOrderToDbOrder(WebOrder webOrder) { return(new Order2 { Address = null, ApartmentOrUnit = webOrder.ApartmentOrUnit, City = webOrder.City, Country = webOrder.Country, EMail = webOrder.EMail, Name = webOrder.Name, OrderNumber = GetWebOrderNumber(webOrder.Id), OrderPaid = webOrder.IsPaid ? DateTime.UtcNow : (DateTime?)null, OrderSent = false, OrderLostInMail = false, Promotion = false, Test = false, Comment = null, Password = null, PasswordClaimed = null, RegionOrState = webOrder.RegionOrState, Street = webOrder.Street, WebId = webOrder.Id, WebOrder = true, ZipCode = webOrder.ZipCode, DynamicProperties = new List <Tuple <string, string> >() }); }
/// <summary> /// /// </summary> /// <param name="inOrderHandle"></param> /// <returns></returns> WebOrder readIncompleteOrder(string inOrderHandle) { WebOrder result = createWebOrder(); result.Load(inOrderHandle); return(result); }
/// <summary> /// Creates an empty web order /// Creates a WebOrder object and opens its related file /// </summary> /// <returns></returns> WebOrder openWebOrder() { WebOrder result = createWebOrder(); result.Open(); return(result); }
public void EmitClickAndCollect( Shop shop, WebOrder webOrder ) { shop.SendNewClickNCollect( webOrder ); }
public void CompleteTransaction() { if (GetRemainsDependent() != 0) { throw new InvalidOperationException(); } Bracket = null; WebOrder = null; }
public WebOrderRespondVo(WebOrder webOrder) { if (null != webOrder) { TradeNo = webOrder.TradeNo; ExternalTradeNo = webOrder.ExternalTradeNo; BuyTime = webOrder.BuyTime; IsWebOrderVaild = true; PaymentVendor = webOrder.PaymentVendor; OriAFCStationCode = webOrder.OriAFCStationCode; DesAFCStationCode = webOrder.DesAFCStationCode; OriStationChineseName = String.Empty; DesStationChineseName = String.Empty; OriStationEnglishName = String.Empty; DesStationEnglishName = String.Empty; TicketPrice = webOrder.TicketPrice; TicketNum = webOrder.TicketNum; Discount = webOrder.Discount; ActualFee = 0; if (null != webOrder.ActualFee) { ActualFee = webOrder.ActualFee.Value; } TicketTarget = TicketTargetType.NONE; if (!String.IsNullOrEmpty(webOrder.TicketTarget)) { try { TicketTarget = EnumHelper.GetTicketTargetType(webOrder.TicketTarget); } catch (Exception) { } } TransactionId = webOrder.TransactionId; PayEndTime = webOrder.PayEndTime; //// 临时处理 //ExpiryTime = new DateTime(); Voucher = String.Empty; TicketTakeNum = 0; if (null != webOrder.TicketTakeNum) { TicketTakeNum = webOrder.TicketTakeNum.Value; IsUsed = true; } UsedTime = webOrder.TicketTakeTime; OrderStatus = OrderStatusType.None; try { OrderStatus = EnumHelper.GetOrderStatusTypeByFlagString(webOrder.OrderStatus); } catch (Exception) { } OrderStep = EnumHelper.GetWebOrderStep(webOrder.Step); } }
public static WPFApp.WebOrder LoadXml(string path) { XmlSerializer serializer = new XmlSerializer(typeof(WebOrder)); using (FileStream fileStream = new FileStream(@"" + path, FileMode.Open)) { WebOrder result = (WebOrder)serializer.Deserialize(fileStream); return(result); } }
/// <summary> /// /// </summary> /// <param name="inOrderHandle"></param> /// <returns></returns> WebOrder getWebOrder(string inOrderHandle) { WebOrder order = findWebOrder(inOrderHandle); if (order != null) { return(order); } throw new Exception(@"Invalid order handle"); }
/// <summary> /// NOT USED SO FAR!!! /// </summary> /// <param name="inOrderHandle"></param> /// <returns></returns> WebOrder popWebOrder(string inOrderHandle) { WebOrder order = findWebOrder(inOrderHandle); if (order != null) { removeIncompleteOrder(order); return(order); } throw new Exception(@"Invalid order handle"); }
public static string VoucherCodeCombine(WebOrder webOrder, string voucher) { string voucherCode = String.Empty; if (null != webOrder && !String.IsNullOrEmpty(voucher)) { try { Dictionary <string, string> dictFlagValue = new Dictionary <string, string>(); dictFlagValue.Add("site_begin", webOrder.OriAFCStationCode); dictFlagValue.Add("site_end", webOrder.DesAFCStationCode); dictFlagValue.Add("ticket_num", ((int)webOrder.TicketNum).ToString()); dictFlagValue.Add("ticket_price", ((int)webOrder.TicketPrice).ToString()); dictFlagValue.Add("total_fee", ((int)webOrder.ActualFee).ToString()); dictFlagValue.Add("trade_no", webOrder.TradeNo); dictFlagValue.Add("ticket_no", voucher); // 按二维码规则广州地铁生成的一定是gzmtr dictFlagValue.Add("source", "gzmtr"); // 适应广电错误临时处理 //dictFlagValue.Add("source", "1001"); dictFlagValue.Add("target", webOrder.TicketTarget); StringBuilder sbVoucherCode = new StringBuilder(); foreach (KeyValuePair <string, string> eachFlagValue in dictFlagValue) { sbVoucherCode.Append("&"); sbVoucherCode.Append(eachFlagValue.Key); sbVoucherCode.Append("="); sbVoucherCode.Append(eachFlagValue.Value); } string processVoucherCode = sbVoucherCode.ToString(); if (processVoucherCode.StartsWith("&")) { voucherCode = processVoucherCode.Substring(1, (processVoucherCode.Length - 1)); } } catch (Exception ex) { _log.Error(ex.Message); if (null != ex.InnerException) { _log.Error(ex.InnerException.Message); } } } return(voucherCode); }
private void SynchWithWebsite() { //Get latest web order in database: lock (fileStore) { int lastWebOrder = 0; int holeIndex = 0; bool go = true; List <string> keys = fileStore.Keys; //Will not work. while (go) { if (knownHoleStarts.Contains(lastWebOrder)) { lastWebOrder = knownHoleEnds[holeIndex]; holeIndex++; } Order2 order = fileStore[OrderConverters.GetWebOrderNumber(lastWebOrder + 1)]; if (order == null) { break; } if (order.WebOrder) //Should always be true... TODO: Better error handling... { lastWebOrder = Math.Max(order.WebId ?? 0, lastWebOrder); } } WebOrder webOrder = WebApiConnector.GetWebOrderByNumber(lastWebOrder + 1); Order2 newOrder; while (webOrder != null) { if (webOrder == null) { break; } newOrder = OrderConverters.ConvertWebOrderToDbOrder(webOrder); fileStore[newOrder.OrderNumber] = newOrder; webOrder = WebApiConnector.GetWebOrderByNumber(webOrder.Id + 1); } } isSynchedWithWeb = true; }
public void OnNavigatedTo(NavigationParameters parameters) { var order = parameters["WebOrder"] as WebOrder; webOrder = order; if (order == null) { return; } showRoute(); OnPropertyChanged(nameof(Distance)); OnPropertyChanged(nameof(Amount)); }
/// <summary> /// /// </summary> /// <param name="outHandle"></param> /// <returns></returns> public DTO_WebOrderResponse OpenWebOrder(out string outHandle) { try { WebOrder webOrder = openWebOrder(); outHandle = webOrder.Handle; // WebOrder successfuly open return(createResponseNoError()); } catch (Exception exc) { outHandle = Guid.Empty.ToString(); // WebOrder: Failed to create an order return(createResponseError("Failed to open a weborder", exc.Message, ResponseCode.FailedToOpenOrder)); } }
public ActionResult OrderConfirmation(string drink, string size, string selection, string time, string firstname, string lastname, string streetAddress1, string streetAddress2, string city, string state, string zipCode, string country) { WebOrder webOrder1 = new WebOrder() { Drink = drink, Size = size, Selection = selection, Time = time, FirstName = firstname, LastName = lastname, StreetAddress1 = streetAddress1, StreetAddress2 = streetAddress2, City = city, State = state, ZipCode = zipCode, Country = country }; ViewBag.ThankYou = "Thank you for your order. Below is your order"; return(View(webOrder1)); }
public CommonOrderVo(WebOrder webOrder) { if (null != webOrder) { TicketOrderType = OrderType.WebOrder; TradeNo = webOrder.TradeNo; BuyTime = webOrder.BuyTime; TicketPrice = 0; TicketPrice = webOrder.TicketPrice; TicketNum = webOrder.TicketNum; Discount = webOrder.Discount; if (null != webOrder.ActualFee) { ActualFee = webOrder.ActualFee.Value; } PaymentVendor = webOrder.PaymentVendor; OriAFCStationCode = webOrder.OriAFCStationCode; DesAFCStationCode = webOrder.DesAFCStationCode; OriStationChineseName = StationInfoHelper.Instance.GetAFCChineseStationName(webOrder.OriAFCStationCode); DesStationChineseName = StationInfoHelper.Instance.GetAFCChineseStationName(webOrder.DesAFCStationCode); TicketTarget = TicketTargetType.NONE; if (!String.IsNullOrEmpty(webOrder.TicketTarget)) { try { TicketTarget = EnumHelper.GetTicketTargetType(webOrder.TicketTarget); } catch (Exception) { } } IsUsed = false; if (null != webOrder.TicketTakeTime) { IsUsed = true; UseTime = webOrder.TicketTakeTime.Value; } DeviceId = webOrder.DeviceId; } }
public void EmitOrder(WebOrder webOrder) { _webOrdersToDeliver.Add(webOrder); }
public void AddWebOrder(WebOrder webOrder) { _webOrders.Add(webOrder); }
/// <summary> /// /// </summary> /// <param name="inOrder"></param> void removeIncompleteOrder(WebOrder inOrder) { inOrder.Remove(); }
public void SendNewClickNCollect(WebOrder webOrder) { _observer.AddWebOrder(webOrder); }
public void SendNewClickNCollect(WebOrder webOrder) { Proxy.SendNewClickNCollect(webOrder); }
public void ReceiptWebOrder(WebOrder webOrder) { RestoreBracket(webOrder.Bracket); }
public static WebOrder GetWebOrderByNumber(int number) { try { return(null); if (number < 0) { return(null); } WebResponse res = null; try { //Web request WebRequest request = WebRequest.Create("http://.../" + number); res = request.GetResponse(); } catch (WebException webEx) { return(null); //No order for that number. } var stream = res.GetResponseStream(); if (stream == null) { return(null); } byte[] buffer = new byte[res.ContentLength]; stream.Read(buffer, 0, (int)res.ContentLength); res.Close(); stream.Close(); string response = Encoding.UTF8.GetString(buffer); //var json = JValue.Parse(response); var json = JsonConvert.DeserializeObject <JObject>(response); //Map object WebOrder order = new WebOrder { Name = json.GetValue("name").ToSafeString(), ApartmentOrUnit = json.GetValue("apartament").ToSafeString(), City = json.GetValue("city").ToSafeString(), Country = json.GetValue("country").ToSafeString(), CreatedTime = json.GetValue("createdDate").ToSafeTime(), EMail = json.GetValue("email").ToSafeString(), Id = number, IsPaid = "Paid".Equals(json.GetValue("statusString").ToSafeString()), PaypalTransactionId = json.GetValue("transactionId").ToSafeString(), RegionOrState = json.GetValue("state").ToSafeString(), Street = json.GetValue("sreet").ToSafeString(), ZipCode = json.GetValue("zipCode").ToSafeString() }; //Return return(order); } catch (Exception ex) { return(null); } }
/// <summary> /// /// </summary> /// <param name="inOrder"></param> public void CommitOrder(WebOrder inOrder) { UInt32 webKey = saveToWebOrderTable(inOrder); }
private UInt32 saveToWebOrderTable(WebOrder inOrder) { return(1); }