Beispiel #1
0
        public LogonEvent Next()
        {
            LogonEvent record = new LogonEvent();

            record.EventID = reader.GetInt32(reader.GetOrdinal("ID"));
            if (!reader.IsDBNull(reader.GetOrdinal("Username")))
            {
                record.Username = reader.GetString(reader.GetOrdinal("Username")).Trim();
            }
            if (!reader.IsDBNull(reader.GetOrdinal("Domain")))
            {
                record.Domain = reader.GetString(reader.GetOrdinal("Domain")).Trim();
            }
            if (!reader.IsDBNull(reader.GetOrdinal("HwAddress")))
            {
                record.HwAddress = reader.GetString(reader.GetOrdinal("HwAddress")).Trim();
            }
            if (!reader.IsDBNull(reader.GetOrdinal("IpAddress")))
            {
                record.IpAddress = reader.GetString(reader.GetOrdinal("IpAddress")).Trim();
            }
            if (!reader.IsDBNull(reader.GetOrdinal("Hostname")))
            {
                record.Hostname = reader.GetString(reader.GetOrdinal("Hostname")).Trim();
            }
            if (!reader.IsDBNull(reader.GetOrdinal("Workstation")))
            {
                record.Workstation = reader.GetString(reader.GetOrdinal("Workstation")).Trim();
            }
            if (!reader.IsDBNull(reader.GetOrdinal("StartTime")))
            {
                record.StartTime = reader.GetDateTime(reader.GetOrdinal("StartTime"));
            }
            if (!reader.IsDBNull(reader.GetOrdinal("EndTime")))
            {
                record.EndTime = reader.GetDateTime(reader.GetOrdinal("EndTime"));
            }

            return(record);
        }
        public List <LogonEvent> FindLogonEvents(LogonEvent filter, LogonEventMatch match)
        {
            using (Database db = new Database(Database.ConnectionStringName))
            {
                using (SqlConnection connection = db.Connection)
                {
                    using (SqlCommand command = connection.CreateCommand())
                    {
                        QueryBuilder query = new QueryBuilder(filter, match);

                        command.CommandType = CommandType.Text;
                        command.CommandText = query.Build();

                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            QueryResult       result = new QueryResult(reader);
                            List <LogonEvent> list   = result.Fill();
                            return(list);
                        }
                    }
                }
            }
        }
Beispiel #3
0
 public void SetFilter(LogonEvent filter)
 {
     this.filter = filter;
 }
Beispiel #4
0
 public QueryBuilder(LogonEvent filter, LogonEventMatch match)
 {
     this.filter = filter;
     this.match  = match;
 }
Beispiel #5
0
 public QueryBuilder(LogonEvent filter)
 {
     this.filter = filter;
 }
        public List <LogonEvent> FindLogonEvents(LogonEvent filter, LogonEventMatch match)
        {
            ServiceHandler handler = ServiceHandler.GetHandler(this);

            return(handler.FindLogonEvents(filter, match));
        }