示例#1
0
        public PagedList<Log> QueryOperLog(PageView view, string qtext, string optype, LogType logtype)
        {
            string where = "";

            if (logtype != LogType.None)
            {
                where += " and LogType=" + logtype.GetHashCode();
            }
            if (!string.IsNullOrEmpty(optype))
            {
                where += " and OperateCode='" + optype + "'";
            }
            if (!string.IsNullOrEmpty(qtext))
            {
                where += " and [Content] like '%" + qtext + "%'";
            }
            StoredProcedure sp = StoredProcedures.SP_PAGESELECT(where, view.PageSize, view.PageIndex
              , "[Logs]", "[Id],[Content],[OperateCode],[LogType],[OperateUID],[OperateName],[IPAddress],[OperateTime]", "[Id]",
              "Order By Id DESC");
            var pl = new PagedList<Log>();
            pl.DataList = new List<Log>();
            using (IDataReader dr = base.SPExecuteDataReader(sp))
            {
                while (dr.Read())
                {
                    Log log = new Log();
                    log.Id = dr.GetInt32(0);

                    log.Content = dr.IsDBNull(1) ? "" : dr.GetString(1);
                    log.OperateCode = dr.GetString(2);
                    log.LogType = dr.GetByte(3);
                    log.OperateUID = dr.GetString(4);
                    log.OperateName = dr.GetString(5);
                    log.IPAddress = dr.GetString(6);
                    log.OperateTime = dr.GetDateTime(7);

                    log.IsNew = false;
                    pl.DataList.Add(log);
                }
            }

            if (view.PageIndex == 0)
            {
                pl.Total = Convert.ToInt32(sp.GetParameterValue(sp.ParamsCount - 1));
            }
            pl.PageIndex = view.PageIndex;

            return pl;
        }
示例#2
0
        public PagedList<UserInfo> QueryOrgUserList(PageView view, string orgCode)
        {
            string where = " AND OrgCode='" + orgCode + "'";
            StoredProcedure sp = StoredProcedures.SP_PAGESELECT(where, view.PageSize, view.PageIndex
             , "UserInfos", "[UserUID],[FullName],[Password],[OrgCode],[OrgName],[Sequence],[AccountState],[LastUpdateUserUID],[LastUpdateUserName],[LastUpdateTime]"
             , "[UserUID]", "");
            var pl = new PagedList<UserInfo>();
            pl.DataList = new List<UserInfo>();
            using (IDataReader dr = base.SPExecuteDataReader(sp))
            {
                while (dr.Read())
                {
                    UserInfo u = new UserInfo();
                    u.UserUID = dr.IsDBNull(0) ? null : dr.GetString(0);
                    u.FullName = dr.IsDBNull(1) ? null : dr.GetString(1);
                    u.Password = dr.IsDBNull(2) ? null : dr.GetString(2);
                    u.OrgCode =  dr.IsDBNull(3) ? null : dr.GetString(3);
                    u.OrgName = dr.IsDBNull(4) ? null : dr.GetString(4);
                    u.Sequence = dr.GetInt32(5);
                    u.AccountState = dr.GetByte(6);
                    u.LastUpdateUserUID = dr.IsDBNull(7) ? null : dr.GetString(7);
                    u.LastUpdateUserName = dr.IsDBNull(8) ? null : dr.GetString(8);
                    u.LastUpdateTime = dr.IsDBNull(9) ? DateTime.MinValue : dr.GetDateTime(9);
                    u.IsNew = false;
                    pl.DataList.Add(u);
                }
            }

            if (view.PageIndex == 0)
            {
                pl.Total = Convert.ToInt32(sp.GetParameterValue(sp.ParamsCount - 1));
            }
            pl.PageIndex = view.PageIndex;

            return pl;
        }
示例#3
0
        public JsonResult RoleUserRelationList(FormCollection form)
        {
            string colkey = form["colkey"];
            string colsinfo = form["colsinfo"];
            int roleId = Convert.ToInt32(form["RoleID"]);
            //TODO:验证是否能管理这个角色
            string qtext = form["qtext"];
            if (string.IsNullOrEmpty(colkey))
            {
                throw new ArgumentNullException("colkey", "主键表示没有传递,请在前台js中配置");
            }
            if (string.IsNullOrEmpty(colsinfo))
            {
                throw new ArgumentNullException("colsinfo", "列信息不能为空,请在前台js中配置");
            }
            int pageIndex = Convert.ToInt32(form["page"]);
            int pageSize = Convert.ToInt32(form["rp"]);
            PageView view = new PageView();
            view.PageIndex = pageIndex - 1;
            view.PageSize = pageSize;

            PagedList<UserInfo> pageList = sysManageService.QueryRoletUserList(view, roleId, qtext);
            var data = JsonFlexiGridData.ConvertFromPagedList(pageList, colkey, colsinfo.Split(','));
            return Json(data);
        }
示例#4
0
        public JsonResult OrgUserList(string OrgCode, FormCollection form)
        {
            string colkey = form["colkey"];
            string colsinfo = form["colsinfo"];
            if (string.IsNullOrEmpty(colkey))
            {
                throw new ArgumentNullException("colkey", "主键表示没有传递,请在前台js中配置");
            }
            if (string.IsNullOrEmpty(colsinfo))
            {
                throw new ArgumentNullException("colsinfo", "列信息不能为空,请在前台js中配置");
            }
            int pageIndex = Convert.ToInt32(form["page"]);
            int pageSize = Convert.ToInt32(form["rp"]);
            PageView view = new PageView();
            view.PageIndex = pageIndex - 1;
            view.PageSize = pageSize;

            PagedList<UserInfo> pageList = sysManageService.QueryOrgUserList(view, OrgCode);
            var data = JsonFlexiGridData.ConvertFromPagedList(pageList, colkey, colsinfo.Split(','));
            return Json(data);
        }
示例#5
0
        public JsonResult LogList(FormCollection form)
        {
            int pageIndex = Convert.ToInt32(form["page"]);
            int pageSize = Convert.ToInt32(form["rp"]);
            PageView view = new PageView();
            view.PageIndex = pageIndex - 1;
            view.PageSize = pageSize;
            string colkey = form["colkey"];
            string colsinfo = form["colsinfo"];
            string qtext = form["QText"];
            string optype = form["OperateCode"];
            LogType logtype = LogType.None;
            switch (form["LogType"])
            {
                case "0":
                    logtype = LogType.Debug;
                    break;
                case "1":
                    logtype = LogType.Trace;
                    break;
                case "2":
                    logtype = LogType.Error;
                    break;

            }
            ILogService service = ObjectFactory.GetInstance<ILogService>();
            PagedList<Log> plist = service.QueryOperLog(view, qtext, optype, logtype);
            JsonFlexiGridData fdata = JsonFlexiGridData.ConvertFromPagedList<Log>(plist, colkey, colsinfo.Split(','));
            return Json(fdata);
        }
示例#6
0
 /// <summary>
 /// 查询操作日志
 /// </summary>
 /// <param name="view">分页信息</param>
 /// <param name="qtext">查询日志内容</param>
 /// <param name="optype">操作类别</param>
 /// <param name="logtyp">日志类别</param>
 /// <returns></returns>
 public PagedList<Log> QueryOperLog(PageView view, string qtext, string optype, LogType logtype)
 {
     // 过滤字符
     qtext = Utility.ClearSafeStringParma(qtext);
     optype = Utility.ClearSafeStringParma(optype);
     return logRepository.QueryOperLog(view, qtext, optype, logtype);
 }