예제 #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> QueryRoletUserList(Entities.PageView view, int roleId, string qtext)
        {
            string where = " AND B.RoleID=" + roleId;
            if (string.IsNullOrEmpty(qtext))
            {
                where += " AND (A.UserUID like '%" + qtext + "%' or A.FullName like '%" + qtext + "%')";
            }
            StoredProcedure sp = StoredProcedures.SP_PAGESELECT(where, view.PageSize, view.PageIndex,
                                                                "UserInfos A INNER JOIN  RoleUserRelation B ON A.UserUID= B.UserUID",
                                                                "A.[UserUID],A.[FullName],A.[Password],A.[OrgCode],A.[OrgName],A.[IsManager],A.[IsSystem],A.[Sequence],A.[AccountState],A.[LastUpdateUserUID],A.[LastUpdateUserName],A.[LastUpdateTime]",
                                                                "A.[UserUID]", " Order By A.[Sequence]");
            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.IsManager          = dr.IsDBNull(5) ? false : dr.GetBoolean(5);
                    u.IsSystem           = dr.IsDBNull(6) ? false : dr.GetBoolean(6);
                    u.Sequence           = dr.GetInt32(7);
                    u.AccountState       = dr.IsDBNull(8) ? (byte)0 : dr.GetByte(8);
                    u.LastUpdateUserUID  = dr.IsDBNull(9) ? null : dr.GetString(9);
                    u.LastUpdateUserName = dr.IsDBNull(10) ? null : dr.GetString(10);
                    u.LastUpdateTime     = dr.GetDateTime(11);
                    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 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);
        }