예제 #1
0
        /// <summary>
        /// debug日志分页列表
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public IList <tb_debuglog_model> GetPageList(DbConn conn, DateTime?startTime, DateTime?endTime, string mqpathid, string mqpath, string methodname, string info, int pageSize, int pageIndex, ref int count)
        {
            int tempCount = 0;
            var result    = SqlHelper.Visit((ps) =>
            {
                IList <tb_debuglog_model> list       = new List <tb_debuglog_model>();
                StringBuilder where                  = new StringBuilder();
                List <ProcedureParameter> parameters = new List <ProcedureParameter>();
                where.Append(" WHERE 1=1 ");
                if (startTime != null && endTime != null)
                {
                    parameters.Add(new ProcedureParameter("startTime", startTime.Value.ToString("yyyy-MM-dd")));
                    parameters.Add(new ProcedureParameter("endTime", endTime.Value.ToString("yyyy-MM-dd")));
                    where.Append(" AND createtime>=@startTime AND createtime<=@endTime ");
                }
                if (!string.IsNullOrWhiteSpace(mqpathid))
                {
                    parameters.Add(new ProcedureParameter("mqpathid", mqpathid));
                    where.Append(" AND mqpathid=@mqpathid ");
                }
                if (!string.IsNullOrWhiteSpace(mqpath))
                {
                    parameters.Add(new ProcedureParameter("mqpath", mqpath));
                    where.Append(" AND mqpath=@mqpath ");
                }
                if (!string.IsNullOrWhiteSpace(methodname))
                {
                    parameters.Add(new ProcedureParameter("methodname", methodname));
                    where.Append(" AND methodname like '%'+@methodname+'%' ");
                }
                if (!string.IsNullOrWhiteSpace(info))
                {
                    parameters.Add(new ProcedureParameter("info", info));
                    where.Append(" AND info like '%'+@info+'%' ");
                }
                StringBuilder sql = new StringBuilder();
                sql.Append("SELECT ROW_NUMBER() OVER(ORDER BY Id DESC) AS rownum,* FROM tb_debuglog WITH(NOLOCK)");
                string countSql = string.Concat("SELECT COUNT(1) FROM tb_debuglog WITH(NOLOCK) ", where.ToString());
                object obj      = conn.ExecuteScalar(countSql, parameters);
                if (obj != DBNull.Value && obj != null)
                {
                    tempCount = LibConvert.ObjToInt(obj);
                }
                string sqlPage = string.Concat("SELECT * FROM (", sql.ToString(), where.ToString(), ") A WHERE rownum BETWEEN ", ((pageIndex - 1) * pageSize + 1), " AND ", pageSize * pageIndex);
                DataTable dt   = conn.SqlToDataTable(sqlPage, parameters);
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        tb_debuglog_model model = CreateModel(dr);
                        list.Add(model);
                    }
                }
                return(list);
            });

            count = tempCount;
            return(result);
        }
예제 #2
0
        public virtual bool Add(DbConn PubConn, tb_debuglog_model model)
        {
            List <ProcedureParameter> Par = new List <ProcedureParameter>()
            {
                //
                new ProcedureParameter("@mqpathid", model.mqpathid),
                //
                new ProcedureParameter("@mqpath", model.mqpath),
                //
                new ProcedureParameter("@methodname", model.methodname),
                //
                new ProcedureParameter("@info", model.info),
                //
                new ProcedureParameter("@createtime", model.createtime)
            };
            int rev = PubConn.ExecuteSql(@"insert into tb_debuglog(mqpathid,mqpath,methodname,info,createtime)
										   values(@mqpathid,@mqpath,@methodname,@info,@createtime)"                                        , Par);

            return(rev == 1);
        }
예제 #3
0
        public virtual bool Edit(DbConn PubConn, tb_debuglog_model model)
        {
            List <ProcedureParameter> Par = new List <ProcedureParameter>()
            {
                //
                new ProcedureParameter("@mqpathid", model.mqpathid),
                //
                new ProcedureParameter("@mqpath", model.mqpath),
                //
                new ProcedureParameter("@methodname", model.methodname),
                //
                new ProcedureParameter("@info", model.info),
                //
                new ProcedureParameter("@createtime", model.createtime)
            };

            Par.Add(new ProcedureParameter("@id", model.id));

            int rev = PubConn.ExecuteSql("update tb_debuglog set mqpathid=@mqpathid,mqpath=@mqpath,methodname=@methodname,info=@info,createtime=@createtime where id=@id", Par);

            return(rev == 1);
        }
예제 #4
0
        public virtual tb_debuglog_model CreateModel(DataRow dr)
        {
            var o = new tb_debuglog_model();

            //
            if (dr.Table.Columns.Contains("id"))
            {
                o.id = dr["id"].Tolong();
            }
            //
            if (dr.Table.Columns.Contains("mqpathid"))
            {
                o.mqpathid = dr["mqpathid"].Toint();
            }
            //
            if (dr.Table.Columns.Contains("mqpath"))
            {
                o.mqpath = dr["mqpath"].Tostring();
            }
            //
            if (dr.Table.Columns.Contains("methodname"))
            {
                o.methodname = dr["methodname"].Tostring();
            }
            //
            if (dr.Table.Columns.Contains("info"))
            {
                o.info = dr["info"].Tostring();
            }
            //
            if (dr.Table.Columns.Contains("createtime"))
            {
                o.createtime = dr["createtime"].ToDateTime();
            }
            return(o);
        }