using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using HR.BusinessLogic.Control; using HR.BusinessLogic.Report; using BMSP.DBAccesser.DBScript; using System.Runtime.Caching; using HR.Model.Customer; using System.Data; namespace HR.UI.Reports { public partial class TmallMan : SysBasePage { public List<string> tps = new List<string>(); public string BeginDate = DateTime.Now.ToString("yyyy-01-01"); public string EndDate = DateTime.Now.ToString("yyyy-01-31"); public string NowDate = DateTime.Now.AddMonths(-1).ToString("yyyyMM"); protected void Page_Load(object sender, EventArgs e) { top1.mRoleId = SysUser.ROLE_ID; TmallAction vAction = new TmallAction(); tps = vAction.GetTypes(); ObjectCache oc = MemoryCache.Default; if (!oc.Contains("products")) { List<ProductModel> list = new List<ProductModel>(); DBManager vDBManager = new DBManager(); vDBManager.ConnectionOpen(); try { string sql = @"SELECT PRODUCTID,PRODUCTNAME FROM (select PRODUCTID,PRODUCTNAME from XXX GROUP BY PRODUCTID,PRODUCTNAME UNION ALL select PRODUCTID,PRODUCTNAME from XXX GROUP BY PRODUCTID,PRODUCTNAME) v GROUP BY PRODUCTID,PRODUCTNAME"; DataTable dt = vDBManager.Query(sql).Tables[0]; int num = 0; if (dt != null) { num = dt.Rows.Count; foreach (DataRow dr in dt.Rows) { ProductModel vModel = new ProductModel(); vModel.ProductId = dr["PRODUCTID"].ToString(); vModel.ProductName = dr["PRODUCTNAME"].ToString(); list.Add(vModel); } dt.Dispose(); } string isql = "insert into cache_log (ldate,luser,lnum) values (sysdate,:luser,:lnum)"; vDBManager.AddParameter(":luser", SysUser.USER_ID); vDBManager.AddParameter(":lnum", num); vDBManager.ExecuteSql(isql); } catch (Exception ex) { } finally { vDBManager.ConnectionClose(); } CacheItemPolicy cp = new CacheItemPolicy(); oc.Set("products", list, cp); } } } }