/// <summary> /// 获取Ecom订单的记录,原先由视图获取,但是视图无法按照条件过滤,所以这里改用StoreProcedure来过滤 /// 如果在服务器适应符合HightCharts格式的数据,需要双循环,所以服务器给出基础数据,由客户端自己去格式化.......2013年12月18日12:06:39 /// CreateDate:2013年12月17日16:52:42 /// </summary> /// <param name="channelList"></param> /// <param name="sTime">开始时间</param> /// <param name="eTime">结束时间</param> /// <returns></returns> public List <Ecom_Order_SP_Model> GetEcomOrder(Int32[] channelList, String sTime, String eTime) { var list = new List <Ecom_Order_SP_Model>(); using (var db = new PermaisuriCMSEntities()) { ////var ecomOrder = db.Ecom_Order_SP(arrChannel.TrimEnd(','), sTime, eTime).ToList(); 加了in语句反而变慢了很多,所以取消掉 在EF内存里面做过滤 2013年12月20日10:05:17 //var orderCache = CacheHelper.Get<List<Ecom_Order_SP_Model>>(orderCacheKey); //if (orderCache==null) //{ // CacheHelper.Insert(orderCacheKey, db.Ecom_Order_SP("2001-01-01", "2015-12-31").AsEnumerable(), null); // CacheHelper.SaveTime = 30; // orderCache = CacheHelper.Get<List<Ecom_Order_SP_Model>>(orderCacheKey); //} ////var ecomOrder = db.Ecom_Order_SP(sTime, eTime).ToList(); //var ecomOrder = orderCache.Where(r=>r.); //var ecomOrder = db.Ecom_Order_SP(arrChannel.TrimEnd(','), sTime, eTime).ToList(); 加了in语句反而变慢了很多,所以取消掉 在EF内存里面做过滤 2013年12月20日10:05:17 var ecomOrder = db.Ecom_Order_SP(sTime, eTime).ToList(); if (channelList.Length > 0) { ecomOrder = ecomOrder.Where(o => channelList.Contains(o.ChannelID)).ToList(); } list.AddRange(ecomOrder.Select(po => new Ecom_Order_SP_Model { name = po.MerchantID, //x = (new DateTime(po.OrderYear, po.OrderMonth, 1).ToUniversalTime().Ticks-DatetimeMinTimeTicks)/1000, x = new DateTime(po.OrderYear, po.OrderMonth, 1), y = po.Orders.ConvertToNotNull() })); } return(list); }