static void Main(string[] args) { var events = new DoorEventsLog(); //Sets console window to a fixed width for better display Console.SetWindowSize(130, 30); //Creates a new Database if it doesn't exists //Else asks if user wants to update database CreateDatabaseOnStartup(); var byDoor = events.FindEntriesByDoor("LGH0101")?.Rows; OutputData("Search by door", byDoor); var byEvent = events.FindEntriesByEvent("DÖIN")?.Rows; OutputData("Search by event", byEvent); var byLocation = events.FindEntriesByLocation("0202")?.Rows; OutputData("Search by location", byLocation); var byTag = events.FindEntriesByTag("0302A")?.Rows; OutputData("Search by tag", byTag); var byTenant = events.FindEntriesByTenant("William")?.Rows; OutputData("Search by tenant", byTenant); var tenants = events.ListTenantsAt("0201")?.Rows; OutputTenants(tenants); }
public static void GenerateTestData() { //Creates new object of StaticData and Random StaticData data = new StaticData(); Random rand = new Random(); DoorEventsLog log = new DoorEventsLog(); //Sets random number int hour = rand.Next(10, 13); int min = rand.Next(0, 59); int sec = rand.Next(0, 59); //Randomizes a new time within 4 hours for test purposes string date = $"2020-10-31 {hour}:{min:00}:{sec:00}"; //Sets random numbers for array-index string tag = data.TagArray[rand.Next(0, data.TagArray.Length)]; string eventCode = data.EventArray[rand.Next(0, data.EventArray.Length)]; string door = data.DoorArray[rand.Next(0, data.DoorArray.Length)]; //Sends log info to LogEntry table log.LogEntry(date, door, eventCode, tag); }