Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        public string GetConfigLogDetail()
        {
            var inputValue = HttpContext.Current.Request.Form["Inputs"];
            ResultConfigLog logList = new ResultConfigLog();
            if (CacheHelper.GetCache("ConfigLog") != null)
            {
                logList = (ResultConfigLog)CacheHelper.GetCache("ConfigLog");
            }
            else
            {
                logList = new AlloctionBLL().GetConfigLog(null);
                CacheHelper.SetCache("ConfigLog", logList);
            }

            BaseConfigLog model = logList.LogList.Where(a => a.SysNo == int.Parse(inputValue.ToString())).FirstOrDefault();
            if (model != null)
            {
                return Newtonsoft.Json.JsonConvert.SerializeObject(model.CFGDEC);
            }
            return "";
        }