static void Main(string[] args) { using (SecuritySystemsContext SSC = new SecuritySystemsContext()) { SSC.GetSuspicAccessHis(); Console.ReadLine(); } }
public void AddAccessMethod(SecuritySystemsContext _SSC) { AccessMethod a = new AccessMethod(); a.Name = Prompt("Name of Access Method"); string UsrMsg = Prompt("Is this proof of identity"); if (UsrMsg.Contains("yes")) { a.ProofOfIdentity = true; } else if (UsrMsg.Contains("no")) { a.ProofOfIdentity = false; } _SSC.AccessMethods.Add(a); _SSC.SaveChanges(); }
public void LogAttempt(SecuritySystemsContext _SSC, int DoorID, int EmployeeID, DateTime Date, bool Succeeded, List <AccessMethod> Methods) { AccessHistory NewAccessHistRow = new AccessHistory(); NewAccessHistRow.DoorID = DoorID; NewAccessHistRow.EmployeeID = EmployeeID; NewAccessHistRow.Date = Date; NewAccessHistRow.Succeeded = Succeeded; _SSC.AccessHistories.Add(NewAccessHistRow); _SSC.SaveChanges(); var GetAccessHistoryID = (from History in AccessHistories where History.DoorID == DoorID && History.EmployeeID == EmployeeID && History.Date == Date select History).FirstOrDefault(); foreach (var Method in Methods) { AccessHistoryAccessMethod c = new AccessHistoryAccessMethod(); c.AccessHistoryID = GetAccessHistoryID.AccessHistoryID; c.AccessMethodID = Method.AccessMethodID; _SSC.AccessHistoryAccessMethods.Add(c); _SSC.SaveChanges(); } }