private dynamic GenerateWaitingListSearchResult(eBayItemSearchModel query, MongoPagingResult<eBayItemsData> queryResult) { return new { total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(queryResult.Count) / 10)), page = query.Page.Value, rows = (from e in queryResult.Result select new { GepImage = e.gep_info.img, GepId = e.gep_id, eBayCategory = e.dynamicData.PrimaryCategoryPath, GepName = e.gep_info.src_name, eBayName = e.dynamicData.Title, eBaySellType = e.dynamicData.ListingType, Site = e.site_name, StockQty = e.dynamicData.Quantity, eBaySellPrice = e.dynamicData.StartPrice, Delivery = e.dynamicData.ShippingService, GmktItemNo = e.gep_info.src_no, SelectionName = Util.GetSafeString(e.gep_info.sel_name, ""), GepSellPrice = e.gep_info.src_tot_price, GepInsertTA = e.gep_info.ta, UpdateTA = e.ta, UpdateDate = e.udate.ToShortDateString().Replace("0001-01-01", ""), ListingDate = e.list_sdate.ToShortDateString().Replace("0001-01-01", ""), GmktVerify = e.gep_info.src_ver_code, eBayVerify = e.ver_code, _ID = e._id.ToString() }).ToArray() }; }
private dynamic ParseSearchResult(eBayItemSearchModel query, MongoPagingResult<eBayItemsData> queryResult) { if (query.Status.Equals(eBayItemStat.Raw)) return GenerateRawListSearchResult(query, queryResult); else if (query.Status.Equals(eBayItemStat.Wait)) return GenerateWaitingListSearchResult(query, queryResult); else if (query.Status.Equals(eBayItemStat.Listing)) return GenerateLitingListSearchResult(query, queryResult); else return null; }
private dynamic GenerateLitingListSearchResult(eBayItemSearchModel query, MongoPagingResult<eBayItemsData> queryResult) { return new { total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(queryResult.Count) / 10)), page = query.Page.Value, rows = (from e in queryResult.Result select new { Image = e.img, ItemId = e.itemno, Name = e.dynamicData.Title, Category = e.dynamicData.PrimaryCategoryPath, SellType = e.dynamicData.ListingType, Site = e.site_name, SiteId = e.site, StockQty = e.dynamicData.Quantity, OrderQty = 0, Delivery = e.dynamicData.ShippingService, InsertionFee = e.ins_fee, FeatureFee = e.feat_fee, GepCode = e.gep_id, GepName = e.gep_info.src_name, GepRegDate = e.gep_info.rdate.ToShortDateString().Replace("0001-01-01", ""), GepInsertTA = e.gep_info.ta, ListingStart = e.list_sdate.ToShortDateString().Replace("0001-01-01", ""), ListingEnd = e.list_edate.ToShortDateString().Replace("0001-01-01", ""), ListingDays = e.dynamicData.ListingDuration, UpdTA = e.ta, UpdDate = e.udate.ToShortDateString().Replace("0001-01-01", ""), eBayAccount = e.ebay_acnt, Id = e._id.ToString() //e.prc != null ? e.prc.d + "." + e.prc.c : "0", }).ToArray() }; }