public string GetSoldProducts(DateTime?start_modified, DateTime?end_modified, string approve_status, string q, string order_by, int page_no, int page_size) { string format = "{{\"products_get_response\":{{\"total_results\":\"{0}\",\"items\":{1}}}}}"; ProductQuery query = new ProductQuery { SortBy = "DisplaySequence", SortOrder = SortAction.Asc, PageIndex = 1, PageSize = 40, SaleStatus = ProductSaleStatus.All }; if (start_modified.HasValue) { query.StartDate = start_modified; } if (end_modified.HasValue) { query.EndDate = end_modified; } if (!string.IsNullOrEmpty(q)) { query.Keywords = DataHelper.CleanSearchString(q); } if (!string.IsNullOrEmpty(approve_status)) { ProductSaleStatus all = ProductSaleStatus.All; EnumDescription.GetEnumValue <ProductSaleStatus>(approve_status, ref all); query.SaleStatus = all; } DbQueryResult productsForApi = ProductHelper.GetProductsForApi(query); return(string.Format(format, productsForApi.TotalRecords, this.ConvertProductSold((DataTable)productsForApi.Data))); }
public string GetSoldTrades(System.DateTime?start_created, System.DateTime?end_created, string status, string buyer_uname, int page_no, int page_size) { string format = "{{\"trades_sold_get_response\":{{\"total_results\":\"{0}\",\"has_next\":\"{1}\",\"trades\":{2}}}}}"; OrderQuery orderQuery = new OrderQuery { PageSize = 40, PageIndex = 1, Status = OrderStatus.All, UserName = buyer_uname, SortBy = "OrderDate", SortOrder = SortAction.Desc }; if (start_created.HasValue) { orderQuery.StartDate = start_created; } if (end_created.HasValue) { orderQuery.EndDate = end_created; } OrderStatus status2 = OrderStatus.All; if (!string.IsNullOrEmpty(status)) { EnumDescription.GetEnumValue <OrderStatus>(status, ref status2); } orderQuery.Status = status2; if (page_no > 0) { orderQuery.PageIndex = page_no; } if (page_size > 0) { orderQuery.PageSize = page_size; } Globals.EntityCoding(orderQuery, true); int num = 0; System.Data.DataSet tradeOrders = OrderHelper.GetTradeOrders(orderQuery, out num); string arg = this.ConvertTrades(tradeOrders); bool flag = this.CheckHasNext(num, orderQuery.PageSize, orderQuery.PageIndex); return(string.Format(format, num, flag, arg)); }
public string GetIncrementSoldTrades(DateTime start_modified, DateTime end_modified, string status, string buyer_uname, int page_no, int page_size) { string format = "{{\"trades_sold_get_response\":{{\"total_results\":\"{0}\",\"has_next\":\"{1}\",\"trades\":{2}}}}}"; OrderQuery entity = new OrderQuery { PageSize = 40, PageIndex = 1, Status = OrderStatus.All, UserName = buyer_uname, SortBy = "UpdateDate", SortOrder = SortAction.Desc, StartDate = new DateTime?(start_modified), EndDate = new DateTime?(end_modified) }; OrderStatus all = OrderStatus.All; if (!string.IsNullOrEmpty(status)) { EnumDescription.GetEnumValue <OrderStatus>(status, ref all); } entity.Status = all; if (page_no > 0) { entity.PageIndex = page_no; } if (page_size > 0) { entity.PageSize = page_size; } Globals.EntityCoding(entity, true); int records = 0; DataSet tradeOrders = OrderHelper.GetTradeOrders(entity, out records); string str2 = this.ConvertTrades(tradeOrders); bool flag = this.CheckHasNext(records, entity.PageSize, entity.PageIndex); return(string.Format(format, records, flag, str2)); }