int Idgetstring Usernameget/setstring Passwordget/setstring FullNameget/setstring Emailget/setstring PhoneNoget/setstring Icget/setRoles Roleget/setDateTime? DateOfBirthget/set
Customer= 0Administrator= 1Receptionist= 2Technician= 3
User myUser = User.GetById(0)
myUser.FullName = "James"
myUser.Update();To update a user to dataabse.
Returns
void
User.Save(string username, string fullName, string email, string password, string phoneNo, Roles role)To create a user object and save it to database.
Returns
User
User.GetByUsername(string username)To retrive a user from database by username.
Userwhen a user is found.nullwhen no user is found.
User.GetById(int id)To retrieve a user from database by userId.
Userwhen a user is found.nullwhen no user is found.
User.GetByEmail(string email)To retrieve user from database by email from database.
Userwhen a user is found.nullwhen no user is found.
User.GetByRole(Roles role)To retrieve user from database by email from database.
User[]an array of users, empty when nothing is found.
private static Service[] servicespublic int Id { get; }public string Name { get; }public double Price { get; }public double UrgentPrice { get; }
Service.GetService()
Service.GetService(int id)To get service by service id.
Serviceobject.
public User User { get; }public Service Service { get; set; }public bool Urgent { get; set; }public DateTime DateTimeCreated { get; set; }
IncompleteService s = IncompleteService.Save(myUser, service, false);
s.Service = Service.GetService(5);
s.Update();To update the database.
void
IncompleteService s = IncompleteService.Save(myUser, service, false);
s.Delete();To delete a row from database.
void
IncompleteService[] services = IncompleteService.GetAll();To get all the incomplete services from database.
IncompleteService[]
IncompleteService s = GetByUser(User.GetById(5));To get all the incomplete services from database.
IncompleteService[]
public int Id { get; }public User User { get; }public User CompletedBy { get; }public Service Service { get; }public bool Urgent { get; }public string Description { get; }public bool HasPaid { get; set;}public DateTime DateTimeCreated { get; }public DateTime DateTimeCompleted { get; }
completedService.Update();To update the database with new data.
Since only HasPaid is changeable, only hasPaid will be updated to the database.
void
CompletedService compService = CompletedService.Save(incompleteService, User.GetById(5), "Warranty 2 years");To create a CompletedService from IncompleteService
CompleteService
CompletedService compService = CompletedService.GetById(1);To create a CompletedService from IncompleteService
CompleteServicenullwhen not found
CompletedService compService = CompletedService.GetByUser(User.GetById(3));To create a get user's completed services from database.
CompleteService[]
CompletedService compService = CompletedService.GetByUser(User.GetById(3));To get the number of completed services of a user where payment hasn't been made.
int