/// <summary> /// Create a new user object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="personId">Initial value of the PersonId property.</param> /// <param name="login">Initial value of the Login property.</param> /// <param name="password">Initial value of the Password property.</param> public static user Createuser(global::System.Int64 id, global::System.Int64 personId, global::System.String login, global::System.String password) { user user = new user(); user.Id = id; user.PersonId = personId; user.Login = login; user.Password = password; return user; }
/// <summary> /// Deprecated Method for adding a new object to the users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTousers(user user) { base.AddObject("users", user); }
public student AddStudent(user usr, studentsgroup sg, person p, DateTime dateIn, DateTime? dateOut = null) { CheckConnection(); try { lock (locker) { EditPerson(usr.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo); student std = student.Createstudent(0, usr.person.Id, sg.Id, dateIn); std.DateOut = dateOut; db.students.AddObject(std); db.SaveChanges(); return std; } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public void DeleteUser(user usr, bool isNewUserDelete) { if (isNewUserDelete) { CheckConnection(); try { lock (locker) { db.persons.DeleteObject(usr.person); db.SaveChanges(); db.users.DeleteObject(usr); db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } } else DeletePerson(usr.person); }
public void EditUser(user usr, string login, string password) { CheckConnection(); try { lock (locker) { usr.Login = login; usr.Password = password; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public librarian AddLibrarian(user usr, person p) { CheckConnection(); try { lock (locker) { EditPerson(usr.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo); librarian l = librarian.Createlibrarian(0, usr.person.Id); db.librarians.AddObject(l); db.SaveChanges(); return l; } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public manager AddManager(user usr, person p) { CheckConnection(); try { lock (locker) { EditPerson(usr.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo); manager m = manager.Createmanager(0, usr.person.Id); db.managers.AddObject(m); db.SaveChanges(); return m; } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }