public ResultConfigLog GetConfigLog() { var inputValue = HttpContext.Current.Request.Form["Inputs"]; var StartTime = HttpContext.Current.Request.Form["StartTime"]; var endTime = HttpContext.Current.Request.Form["EndTime"]; var areaId = HttpContext.Current.Request.Form["AreaID"]; QueryConfigLog model = Newtonsoft.Json.JsonConvert.DeserializeObject <QueryConfigLog>(inputValue); if (model == null) { return(null); } if (!string.IsNullOrEmpty(StartTime)) { DateTime dt = DateTime.Parse(StartTime.ToString()); model.StartTime = dt; } if (!string.IsNullOrEmpty(endTime)) { DateTime dt = DateTime.Parse(endTime.ToString()); model.EndTime = dt; } if (!string.IsNullOrEmpty(areaId)) { model.AreaID = int.Parse(areaId.ToString()); } ResultConfigLog result = new AlloctionBLL().GetConfigLog(model); System.Web.Caching.Cache c = new System.Web.Caching.Cache(); CacheHelper.SetCache("ConfigLog", result); return(result); }
public ResultConfigLog GetConfigLog(QueryConfigLog query) { #region 返回类型 ResultConfigLog resultLog = new ResultConfigLog(); resultLog.LogList = new List <BaseConfigLog>(); resultLog.Page = new Padding(); #endregion #region 查询条件 string where = string.Empty; if (query.StartTime != null) { if (!string.IsNullOrEmpty(query.StartTime.ToString())) { where += " and convert(varchar(10),h.OPTIONTIME,120)>='" + query.StartTime.Value.ToString("yyyy-MM-dd") + "' "; } } if (query.EndTime != null) { if (!string.IsNullOrEmpty(query.EndTime.ToString())) { where += " and convert(varchar(10),h.OPTIONTIME,120)<='" + query.EndTime.Value.ToString("yyyy-MM-dd") + "' "; } } if (query.AreaID != 0) { where += " and h.CFGOBJECT=" + query.AreaID; } string orderBy = " order by h.optionTime desc"; #endregion #region 组织数据 var list = _dal.GetConfigLogList(where, orderBy); int total = list.Count(); resultLog.Page.Total = total; resultLog.Page.Current = query.PageCurrent; resultLog.LogList = list.Select(p => new BaseConfigLog { SysNo = p.ID, CFGDATE = p.CFGDATE.ToString("yyyy-MM-dd"), CFGDEC = p.CFGDEC, CFGOBJECT = p.CFGOBJECT, OPTIONUSER = p.OPTIONUSER, OPTIONTIME = p.OPTIONTIME.ToString("yyyy-MM-dd HH:mm:ss"), CNAME = p.CNAME }).Skip((query.PageCurrent - 1) * query.PageSize).Take(query.PageSize).ToList(); #endregion return(resultLog); }