public void DeleteUnit() { using (var DbContext = new HomeOfficeContext()) { DbContext.Remove(this); DbContext.SaveChanges(); } }
public List <TaskDictionary> AllTaskDictionaryToList() { using (var DbContext = new HomeOfficeContext()) { var tasksDictionary = DbContext.TaskDictionary.ToList(); return(tasksDictionary); } }
public void AddTaskDictionary() { using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); DbContext.TaskDictionary.Add(this); DbContext.SaveChanges(); } }
public List <Password> AllPasswordsToList() { using (var DbContext = new HomeOfficeContext()) { var passwords = DbContext.Passwords.ToList(); return(passwords); } }
public override void AddPassword(Password password) { using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); DbContext.Passwords.Add(password); DbContext.SaveChanges(); } }
public override void DeleteUser(User user) { DeletePasswordOfUser(user); using (var DbContext = new HomeOfficeContext()) { DbContext.Remove(user); DbContext.SaveChanges(); } }
public List <Unit> AllUnitsToList() { using (var DbContext = new HomeOfficeContext()) { var units = DbContext.Units.ToList(); return(units); } }
private void DeletePasswordOfUser(User user) { using (var DbContext = new HomeOfficeContext()) { Password password = new Password(user.ID); DbContext.Remove(password); DbContext.SaveChanges(); } }
public override List <User> AllUsersToList() { using (var DbContext = new HomeOfficeContext()) { var users = DbContext.Users.ToList(); return(users); } }
public List <Task> AllTasksToList() { using (var DbContext = new HomeOfficeContext()) { var tasks = DbContext.Tasks.ToList(); return(tasks); } }
public override void AddUser(User user) { using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); DbContext.Users.Add(user); DbContext.SaveChanges(); } }
public void AddUnit() { using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); DbContext.Units.Add(this); DbContext.SaveChanges(); } }
public override void AssignActivity(TaskDictionary task, User u) { Tasks.Task t = new Tasks.Task(u.ID, task.ID); using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); DbContext.Tasks.Add(t); DbContext.SaveChanges(); } }
public override void UnassignActivity(Tasks.Task t) { using (var DbContext = new HomeOfficeContext()) { var result = DbContext.Tasks.SingleOrDefault(b => b.Users_ID == t.Users_ID && b.TaskDictionary_ID == t.TaskDictionary_ID); if (result != null) { result.Status = true; DbContext.SaveChanges(); } } }
public void ResetPassword() { using (var DbContext = new HomeOfficeContext()) { var result = DbContext.Passwords.SingleOrDefault(p => p.ID == ID); if (result != null) { result.Password_ = Password_; DbContext.SaveChanges(); } } }
public void FromDatabase(int id) { using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); var query = DbContext.Passwords.Where(p => p.ID == id); Password password = query.FirstOrDefault <Password>(); if (password != null) { ID = password.ID; Password_ = password.Password_; } else { ID = -1; } } }
public User(long pesel) { using (var DbContext = new HomeOfficeContext()) { DbContext.Database.EnsureCreated(); var query = DbContext.Users.Where(us => us.PESEL == pesel); User u = query.FirstOrDefault <User>(); if (u != null) { ID = u.ID; Name = u.Name; Surname = u.Surname; DateOfBirth = u.DateOfBirth; UserGroup = u.UserGroup; Unit = u.Unit; PESEL = u.PESEL; } else { ID = -1; } } }