Beispiel #1
0
        /// <summary>
        /// 获取日志
        /// </summary>
        /// <returns></returns>
        public static List <LogEntity> GetLogs(string guid, EnumLogObjectType type, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientid)
        {
            string tablename = "";

            switch (type)
            {
            case EnumLogObjectType.Customer:
                tablename = "CustomerLog";
                break;

            case EnumLogObjectType.Orders:
                tablename = "OrdersLog";
                break;

            case EnumLogObjectType.OrderTask:
                tablename = "OrderTaskLog";
                break;
            }

            DataTable dt = CommonBusiness.GetPagerData(tablename, "*", "LogGUID='" + guid + "'", "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

            List <LogEntity> list = new List <LogEntity>();

            foreach (DataRow dr in dt.Rows)
            {
                LogEntity model = new LogEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserCacheByUserID(model.CreateUserID, clientid);

                list.Add(model);
            }
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// 获取日志
        /// </summary>
        /// <returns></returns>
        public static List <LogEntity> GetLogs(string type, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string btime = "", string etime = "")
        {
            string tablename = "UsersLog  a left join M_Users b  on a.SeeID =b.UserID ";

            string sqlwhere = " 1=1 ";

            if (!string.IsNullOrEmpty(btime))
            {
                sqlwhere += " and a.CreateTime>='" + (string.IsNullOrEmpty(btime)
                    ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss")
                    : btime) + "'";
            }
            if (!string.IsNullOrEmpty(type))
            {
                sqlwhere += " and a.Type in(" + type + ")";
            }
            if (!string.IsNullOrEmpty(etime))
            {
                sqlwhere += " and a.CreateTime<'" + etime + "'";
            }
            DataTable        dt   = CommonBusiness.GetPagerData(tablename, "a.*,b.Avatar as SeeAvatar ", sqlwhere, "a.AutoID ", pageSize, pageIndex, out totalCount, out pageCount);
            List <LogEntity> list = new List <LogEntity>();

            foreach (DataRow dr in dt.Rows)
            {
                LogEntity model = new LogEntity();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }
Beispiel #3
0
        /// <summary>
        /// 获取日志
        /// </summary>
        /// <returns></returns>
        public static List<LogEntity> GetLogs(string guid, EnumLogObjectType type, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string agentid)
        {
            string tablename = "";
            switch (type)
            {
                case EnumLogObjectType.Customer:
                    tablename = "CustomerLog";
                    break;
                case EnumLogObjectType.Orders:
                    tablename = "OrdersLog";
                    break;
            }

            DataTable dt = CommonBusiness.GetPagerData(tablename, "*", "LogGUID='" + guid + "'", "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

            List<LogEntity> list = new List<LogEntity>();
            foreach (DataRow dr in dt.Rows)
            {
                LogEntity model = new LogEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.AgentID);

                list.Add(model);
            }
            return list;
        }
        public static LogEntity GetLogsByUserID(string userID, int tops = 1)
        {
            string tablename = "select top " + tops + " a.*  from UsersLog  a left join M_Users b  on a.UserID =b.UserID ";

            string sqlwhere = " where 1=1 ";

            if (!string.IsNullOrEmpty(userID))
            {
                sqlwhere += " and a.userID='" + userID + "'";
            }
            DataTable dt    = LogDAL.GetDataTable(tablename + sqlwhere + " order by  a.AutoID  desc ");
            LogEntity model = new LogEntity();

            foreach (DataRow dr in dt.Rows)
            {
                model.FillData(dr);
            }
            return(model);
        }
        public static List <LogEntity> GetOperatLogs(int type, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string loginname = "")
        {
            string tablename = "UsersOperatLog  a left join M_Users b  on a.UserID =b.UserID ";

            string sqlwhere = " 1=1 ";

            if (!string.IsNullOrEmpty(loginname))
            {
                sqlwhere += " and b.loginname ='" + loginname + "' ";
            }
            DataTable        dt   = CommonBusiness.GetPagerData(tablename, "a.* ,b.LoginName,b.UserName ", sqlwhere, "a.AutoID ", pageSize, pageIndex, out totalCount, out pageCount);
            List <LogEntity> list = new List <LogEntity>();

            foreach (DataRow dr in dt.Rows)
            {
                LogEntity model = new LogEntity();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }