Пример #1
0
        public DataTable GetLogStat()
        {
            DataTable dtTotal = new DataTable("LogTotal");

            DataColumn dc = new DataColumn("Desc");

            dtTotal.Columns.Add(dc);
            dc = new DataColumn("Total");
            dtTotal.Columns.Add(dc);

            string    sql = "select * from " + DBHelperProxy.FormatFunction("gettables");
            DataTable dt  = DBHelperProxy.GetDataTable(sql);

            DataRow drr;

            foreach (DataRow dr in dt.Rows)
            {
                drr          = dtTotal.NewRow();
                drr["Desc"]  = dr["table_name"];
                drr["Total"] = DBHelperProxy.ExecuteScalar(string.Format("select count(*)  as total from " + DBHelperProxy.FormatTable("{0}"), dr["Name"].ToString()));
                dtTotal.Rows.Add(drr);
            }

            return(dtTotal);
        }
Пример #2
0
        public DataTable GetLoginLogs(string year, string month, string deptid, string username)
        {
            string sql = "Select LoginTime,UserID,U.LoginName,L.IP,U.UserName,U.DeptName From LoginLog L  Inner Join " + DBHelperProxy.FormatTable("User") + " U On L.UserID=U.ID Where 1=1";

            if (!string.IsNullOrEmpty(year))
            {
                sql += " and " + DBHelperProxy.FormatFunction("getyear", "LoginTime") + " =" + year;
            }

            if (!string.IsNullOrEmpty(month))
            {
                sql += " and " + DBHelperProxy.FormatFunction("getmonth", "LoginTime") + " =" + month;
            }

            if (!string.IsNullOrEmpty(deptid))
            {
                sql += " and U.DeptID=" + deptid;
            }

            if (!string.IsNullOrEmpty(username))
            {
                sql += " and U.UserName='******'";
            }

            sql += " Order By L.ID Desc";
            return(DBHelperProxy.GetDataTable(sql));
        }
Пример #3
0
        public DataTable GetOperateLogs(string tablename, string oType, string year, string month)
        {
            string sql = "Select  ID,UnitID,OperateType,UserID,UserName,TableBind,OperateTime,OperateContent From " + DBHelperProxy.FormatTable("OperateLog") + " Where 1=1 ";

            if (!string.IsNullOrEmpty(tablename))
            {
                sql += "  and TableBind='" + tablename + "'";
            }

            if (!string.IsNullOrEmpty(oType))
            {
                sql += "  and OperateType=" + oType;
            }

            if (!string.IsNullOrEmpty(year))
            {
                sql += " and " + DBHelperProxy.FormatFunction("getyear", "OperateTime") + " =" + year;
            }

            if (!string.IsNullOrEmpty(month))
            {
                sql += " and " + DBHelperProxy.FormatFunction("getmonth", "OperateTime") + " =" + month;
            }

            sql += " Order By ID Desc";

            return(DBHelperProxy.GetDataTable(sql));
        }
Пример #4
0
        public DataTable GetLoginStat(string year, string month, string deptid)
        {
            string sql = "Select Count(*) as Total,U.LoginName,U.UserName,U.DeptName from LoginLog L Inner Join " + DBHelperProxy.FormatTable("User") + " U On L.UserID=U.ID Where 1=1";

            if (!string.IsNullOrEmpty(year))
            {
                sql += " and " + DBHelperProxy.FormatFunction("getyear", "LoginTime") + " =" + year;
            }

            if (!string.IsNullOrEmpty(month))
            {
                sql += " and " + DBHelperProxy.FormatFunction("getmonth", "LoginTime") + " =" + month;
            }

            if (!string.IsNullOrEmpty(deptid))
            {
                sql += " and U.DeptID=" + deptid;
            }

            sql += " Group by L.UserID,U.LoginName,U.Username,U.DeptName  Order by Total desc";

            return(DBHelperProxy.GetDataTable(sql));
        }