private HiPOSDetailsListListModel GetDataList(string StoreName, DateTime startDate, DateTime endDate) { decimal num = default(decimal); HiPOSDetailsListListModel hiPOSDetailsListListModel = new HiPOSDetailsListListModel(); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); HiPOSHelper hiPOSHelper = new HiPOSHelper(); string format = "yyyyMMdd"; TradesResult hishopTrades = hiPOSHelper.GetHishopTrades(masterSettings.HiPOSAppId, masterSettings.HiPOSMerchantId, StoreName, startDate.ToString(format), endDate.ToString(format), base.CurrentPageIndex, base.CurrentPageSize); if (hishopTrades.error == null) { List <StoreResponse> list = hishopTrades.merchant_trades_response.detail.ToList(); num = list.Sum((StoreResponse r) => r.count); hiPOSDetailsListListModel.rows = new List <Dictionary <string, object> >(); foreach (StoreResponse item in list) { string systemStoreId = this.GetSystemStoreId(item.name); Dictionary <string, object> dictionary = item.ToDictionary(); dictionary["total"] = dictionary["total"].ToDecimal(0).F2ToString("f2"); dictionary.Add("systemStoreId", systemStoreId); dictionary.Add("DeviceCount", item.devices.Count()); foreach (DeviceResponse device in item.devices) { device.total = device.total.F2ToString("f2").ToDecimal(0); } hiPOSDetailsListListModel.rows.Add(dictionary); } } hiPOSDetailsListListModel.sum_amount = hishopTrades.merchant_trades_response.total.F2ToString("f2").ToDecimal(0); hiPOSDetailsListListModel.total = num.ToInt(0); hiPOSDetailsListListModel.recordcount = hishopTrades.merchant_trades_response.items_count; return(hiPOSDetailsListListModel); }
private void GetList(HttpContext context) { string parameter = base.GetParameter(context, "storeId", true); string parameter2 = base.GetParameter(context, "deviceId", true); string parameter3 = base.GetParameter(context, "orderId", true); bool value = base.GetBoolParam(context, "isSystemOrder", false).Value; DateTime?dateTimeParam = base.GetDateTimeParam(context, "startDate"); DateTime?dateTimeParam2 = base.GetDateTimeParam(context, "endDate"); DateTime from = dateTimeParam.HasValue ? dateTimeParam.Value : DateTime.MinValue; DateTime dateTime; DateTime dateTime2; if (!dateTimeParam2.HasValue) { dateTime = DateTime.Now; dateTime2 = dateTime.AddDays(1.0); } else { dateTime = dateTimeParam2.Value; dateTime2 = dateTime.AddDays(1.0); } DateTime to = dateTime2; HiPOSDetailsListListModel dataList = this.GetDataList(parameter, parameter2, parameter3, from, to, value, base.CurrentPageIndex, base.CurrentPageSize); string s = base.SerializeObjectToJson(dataList); context.Response.Write(s); context.Response.End(); }
private void GetList(HttpContext context) { string parameter = base.GetParameter(context, "StoreName", true); DateTime?dateTimeParam = base.GetDateTimeParam(context, "startDate"); DateTime?dateTimeParam2 = base.GetDateTimeParam(context, "endDate"); DateTime startDate = dateTimeParam.HasValue ? dateTimeParam.Value : DateTime.MinValue; DateTime dateTime; DateTime dateTime2; if (!dateTimeParam2.HasValue) { dateTime = DateTime.Now; dateTime2 = dateTime.AddDays(1.0); } else { dateTime = dateTimeParam2.Value; dateTime2 = dateTime.AddDays(1.0); } DateTime endDate = dateTime2; HiPOSDetailsListListModel dataList = this.GetDataList(parameter, startDate, endDate); string s = base.SerializeObjectToJson(dataList); context.Response.Write(s); context.Response.End(); }
private HiPOSDetailsListListModel GetDataList(string storeId, string deviceId, string orderId, DateTime from, DateTime to, bool isSystemOrder, int page, int pagesize) { HiPOSDetailsListListModel hiPOSDetailsListListModel = new HiPOSDetailsListListModel(); hiPOSDetailsListListModel.rows = new List <Dictionary <string, object> >(); SiteSettings currentSiteSetting = base.CurrentSiteSetting; string format = "yyyyMMdd"; string code = ""; if (!string.IsNullOrWhiteSpace(orderId)) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(orderId); string text = (orderInfo == null) ? orderId : orderInfo.TakeCode; code = (string.IsNullOrEmpty(text) ? string.Empty : (Globals.HIPOSTAKECODEPREFIX + text)); } HiPOSHelper hiPOSHelper = new HiPOSHelper(); if (!string.IsNullOrEmpty(deviceId)) { deviceId = (deviceId.Equals("0") ? string.Empty : deviceId); } DetailResult hishopTradesDetail = hiPOSHelper.GetHishopTradesDetail(currentSiteSetting.HiPOSAppId, currentSiteSetting.HiPOSMerchantId, storeId, deviceId, code, isSystemOrder, from.ToString(format), to.ToString(format), page, pagesize); if (hishopTradesDetail.error == null) { foreach (HiPOSResponse item in hishopTradesDetail.merchant_trades_detail_response.detail) { Dictionary <string, object> dictionary = item.ToDictionary(); DateTime dateTime = default(DateTime); if (!string.IsNullOrWhiteSpace(item.paid_at) && DateTime.TryParse(item.paid_at, out dateTime)) { dictionary["paid_at"] = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); } dictionary.Add("OrderId", this.GetOrderId(item.code)); dictionary.Add("Alias", this.GetAlias(item.device_id)); hiPOSDetailsListListModel.rows.Add(dictionary); } hiPOSDetailsListListModel.sum_amount = hishopTradesDetail.merchant_trades_detail_response.detail.Sum((HiPOSResponse c) => c.amount); hiPOSDetailsListListModel.total = hishopTradesDetail.merchant_trades_detail_response.items_count; } return(hiPOSDetailsListListModel); }