public PersonControl() { InitializeComponent(); curPerson = new person(); newPerson = new person(); Check(); }
public void EditLibrarian(long id, person newPerson) { librarian l = Model.FindLibrarian(id); if (l == null) throw new DBException(ErrorTypes.LibrarianNotFound); Model.EditLibrarian(l, newPerson); }
public librarian AddLibrarian(string user, person p) { user usr = Model.FindUser(user); if (usr == null) throw new DBException(ErrorTypes.AccountNotFound); return Model.AddLibrarian(usr, p); }
public void EditManager(long id, person newPerson) { manager m = Model.FindManager(id); if (m == null) throw new DBException(ErrorTypes.ManagerNotFound); Model.EditManager(m, newPerson); }
public void EditStudent(long id, string grName, person newPerson, DateTime dateIn, DateTime? dateOut = null) { student s = Model.FindStudent(id); if (s == null) throw new DBException(ErrorTypes.StudentNotFound); studentsgroup gr = Model.FindStudentGroup(grName); if (gr == null) throw new DBException(ErrorTypes.GroupNotFound); Model.EditStudent(s, gr, newPerson, dateIn, dateOut); }
public student AddStudent(string user, string grName, person p, DateTime dateIn, DateTime? dateOut = null) { user usr = Model.FindUser(user); if (usr == null) throw new DBException(ErrorTypes.AccountNotFound); studentsgroup gr = Model.FindStudentGroup(grName); if (gr == null) throw new DBException(ErrorTypes.GroupNotFound); return Model.AddStudent(usr, gr, p, dateIn, dateOut); }
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 void EditStudent(student std, studentsgroup sg, person p, DateTime dateIn, DateTime? dateOut = null) { CheckConnection(); try { lock (locker) { EditPerson(std.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); std.GroupId = sg.Id; std.DateIn = dateIn; std.DateOut = dateOut; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public ProfileViewWindow(person p) { InitializeComponent(); this.pv.Person = p; }
void DeletePerson(person p) { CheckConnection(); try { lock (locker) { p.IsDeleted = true; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
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); } }
void EditPerson(person p, string firstname, string lastname, string middlename, DateTime? birthday = null, string hphone = "", string mphone = "", string addr = "", string email = "", string info = "", string photo = "") { CheckConnection(); try { lock (locker) { p.First_Name = firstname; p.Last_Name = lastname; p.Middle_Name = middlename; p.Birthday = birthday; p.H_Phone = hphone; p.M_Phone = mphone; p.Address = addr; p.Email = email; p.SomeInformation = info; p.Photo = photo; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public user AddUser(string login, string password) { CheckConnection(); try { lock (locker) { person p = new person(); db.persons.AddObject(p); try { db.SaveChanges(); } catch (Exception ex) { db.persons.DeleteObject(p); throw new DBException(ErrorTypes.UnexpectedException, ex); } user usr = user.Createuser(0, p.Id, login, password); db.users.AddObject(usr); try { db.SaveChanges(); } catch (Exception ex) { db.users.DeleteObject(usr); db.persons.DeleteObject(p); db.SaveChanges(); throw new DBException(ErrorTypes.UnexpectedException, ex); } return usr; } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public void EditLibrarian(librarian l, person p) { CheckConnection(); try { lock (locker) { EditPerson(l.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); db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public teacher AddTeacher(string user, person p) { user usr = Model.FindUser(user); if (usr == null) throw new DBException(ErrorTypes.AccountNotFound); return Model.AddTeacher(usr, p); }
/// <summary> /// Create a new person object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static person Createperson(global::System.Int64 id, global::System.Boolean isDeleted) { person person = new person(); person.Id = id; person.IsDeleted = isDeleted; return person; }
public void EditTeacher(long id, person newPerson) { teacher t = Model.FindTeacher(id); if (t == null) throw new DBException(ErrorTypes.ManagerNotFound); Model.EditTeacher(t, newPerson); }
/// <summary> /// Deprecated Method for adding a new object to the persons EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTopersons(person person) { base.AddObject("persons", person); }
public void SetPerson(person p) { IsEdit = true; curPerson = p; InitFields(); }
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); } }