/// <summary> /// Initializes a new instance of the <see cref="ListCurrentOrdersParameterWriter"/> class. /// </summary> /// <param name="betIds"></param> /// <param name="marketIds"></param> /// <param name="orderProjection"></param> public ListCurrentOrdersParameterWriter(ISet<string> betIds, ISet<string> marketIds, OrderProjection orderProjection = OrderProjection.ALL) { this.betIds = betIds; this.marketIds = marketIds; this.orderProjection = orderProjection; this.parameterWriter = new ParameterWriter(); }
public MarketBookParameterWriter(IList<string> marketIds, PriceProjection priceProjection, OrderProjection orderProjection, MatchProjection matchProjection) { this.marketIds = marketIds; this.priceProjection = priceProjection; this.orderProjection = orderProjection; this.matchProjection = matchProjection; this.parameterWriter = new ParameterWriter(); }
public static void GetAllRiderInfo(ref List <Runner> runners, ref List <RunnerDescription> runnerDescription, ref List <MarketProfitAndLoss> runnerPNL, ref CurrentOrderSummaryReport orders) { PriceData pricedata1 = PriceData.EX_ALL_OFFERS; PriceData pricedata2 = PriceData.EX_TRADED; PriceData pricedata3 = PriceData.EX_BEST_OFFERS; HashSet <PriceData> prijsdata = new HashSet <PriceData>(); prijsdata.Add(pricedata1); prijsdata.Add(pricedata2); prijsdata.Add(pricedata3); PriceProjection priceprojection = new PriceProjection(); OrderProjection orderprojection = new OrderProjection(); MatchProjection matchprojection = new MatchProjection(); orderprojection = OrderProjection.ALL; matchprojection = MatchProjection.ROLLED_UP_BY_AVG_PRICE; priceprojection.PriceData = prijsdata; MarketFilter marketFilter = new MarketFilter(); ISet <string> set = new HashSet <string>(); set.Add(BackEnd.marketID); marketFilter.MarketIds = set; var marketSort = MarketSort.FIRST_TO_START; ISet <MarketProjection> marketProjections = new HashSet <MarketProjection>(); marketProjections.Add(MarketProjection.RUNNER_DESCRIPTION); List <string> marketIds = new List <string>(); marketIds.Add(BackEnd.marketID); try { runners = apiClient.listMarketBook(marketIds, priceprojection, orderprojection, matchprojection)[0].Runners; } catch { } try { runnerDescription = apiClient.listMarketCatalogue(marketFilter, marketProjections, marketSort)[0].Runners; } catch { } try { runnerPNL = apiClient.listMarketProfitAndLoss(marketIds, true, true, true).ToList <MarketProfitAndLoss>(); } catch { } try { orders = apiClient.listCurrentOrders(); } catch { } }
private void BuildSendMailContent(string title, StringBuilder builder, OrderProjection orderDetail) { builder.AppendFormat("{0}", title); builder.Append("<br/>"); builder.AppendFormat("Khách hàng: {0}", orderDetail.Name); builder.Append("<br/>"); builder.AppendFormat("Địa chỉ: {0}", orderDetail.Address); builder.Append("<br/>"); builder.AppendFormat("Số điện thoại: {0}", orderDetail.PhoneNumber); builder.Append("<br/>"); builder.Append("<br/>"); builder.Append("<table style='width: 100 %' cellpadding='5' border='1'>"); builder.Append("<thead>"); builder.Append("<tr>"); builder.Append("<th style='width: 40 %; '>Tên sản phẩm</th>"); builder.Append("<th style'width: 30 %; '>Số lượng</th>"); builder.Append("<th style='width: 30 %; '>Đơn giá</th>"); builder.Append("</tr>"); builder.Append("</thead>"); builder.Append("<tbody>"); int[] ArrQuantity = orderDetail.Quantities.ToArray(); decimal[] ArrPrice = orderDetail.Prices.ToArray(); int i = 0; foreach (var item in orderDetail.Products) { if (i == orderDetail.Products.Count()) { break; } builder.Append("<tr>"); builder.AppendFormat("<td class='text - left'>{0}</td>", item.Name); builder.AppendFormat("<td class='font-weight: initial'>{0}</td>", ArrQuantity[i]); builder.AppendFormat("<td class='text - left'>{0}</td>", ArrPrice[i].ToString("N0") + " đ"); builder.Append("</tr>"); i++; } builder.Append("</tbody>"); builder.Append("</table>"); builder.Append("<br/>"); builder.AppendFormat("Tổng tiền: {0}", orderDetail.Amount.ToString("N0") + " đ"); }
public OrderProjection GetDetailOrderByOrderId(int orderId) { var orders = this.orderRepositories.GetAll(); var orderDetail = this.orderDetailRepositories.GetAll(); var orderViewModel = new OrderProjection(); if (orders != null && orderDetail != null) { orderViewModel = (from o in orders join od in orderDetail on o.Id equals od.OrderId where o.Id == orderId where od.OrderId == orderId group od by o.Id into gLine select new OrderProjection() { OrderId = gLine.Key, Amount = gLine.Sum(x => x.Price * x.Quantity), Name = gLine.Select(g => g.Order.Name).FirstOrDefault(), Address = gLine.Select(g => g.Order.Address).FirstOrDefault(), Email = gLine.Select(g => g.Order.Email).FirstOrDefault(), PhoneNumber = gLine.Select(g => g.Order.PhoneNumber).FirstOrDefault(), OrderDate = gLine.Select(g => g.Order.OrderDate).FirstOrDefault(), ShipDate = gLine.Select(g => g.Order.ShipDate).FirstOrDefault(), PaymentStatus = gLine.Select(g => g.Order.PaymentStatus).FirstOrDefault(), ShipStatus = gLine.Select(g => g.Order.ShipStatus).FirstOrDefault(), Status = gLine.Select(g => g.Order.Status).FirstOrDefault(), Products = gLine.Select(g => g.Product).Select(p => new ProductOrderProjection { Id = p.Id, Name = p.Name, Image = p.Image }), Quantities = gLine.Select(g => g.Quantity), Prices = gLine.Select(g => g.Price) }).FirstOrDefault(); } return(orderViewModel); }
public BetfairServerResponse<List<MarketBook>> ListMarketBook( IEnumerable<string> marketIds, PriceProjection priceProjection = null, OrderProjection? orderProjection = null, MatchProjection? matchProjection = null) { return client.ListMarketBook( marketIds, priceProjection, orderProjection, matchProjection).Result; }
public BetfairServerResponse<CurrentOrderSummaryReport> ListCurrentOrders( ISet<string> betIds = null, ISet<string> marketIds = null, OrderProjection? orderProjection = null, TimeRange placedDateRange = null, TimeRange dateRange = null, OrderBy? orderBy = null, SortDir? sortDir = null, int? fromRecord = null, int? recordCount = null) { return client.ListCurrentOrders( betIds, marketIds, orderProjection, placedDateRange, dateRange, orderBy, sortDir, fromRecord, recordCount).Result; }