int Id
getstring Username
get/setstring Password
get/setstring FullName
get/setstring Email
get/setstring PhoneNo
get/setstring Ic
get/setRoles Role
get/setDateTime? DateOfBirth
get/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.
User
when a user is found.null
when no user is found.
User.GetById(int id)
To retrieve a user from database by userId.
User
when a user is found.null
when no user is found.
User.GetByEmail(string email)
To retrieve user from database by email from database.
User
when a user is found.null
when 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[] services
public 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.
Service
object.
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
CompleteService
null
when 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