Ejemplo n.º 1
0
 public static string GetUserPasswordHashByUserName(string userName)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.UserName.Equals(userName, StringComparison.OrdinalIgnoreCase)).Select(h => h.PasswordHash).First());
     }
 }
Ejemplo n.º 2
0
 public static int GetUserTypeByUserID(int userID)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         return(Convert.ToInt16(context.Users.Where(u => u.ID == userID).Select(v => v.UserType).FirstOrDefault()));
     }
 }
Ejemplo n.º 3
0
 public static bool IsSysAdmin(int logIn)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.ID == logIn).Select(s => s.UserType).FirstOrDefault() == 1?true:false);
     }
 }
Ejemplo n.º 4
0
 public static RoadTest_DayTimeSlot GetDaySlotsFromHourSlot(int hourSlot)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.RoadTest_DayTimeSlot.Where(x => x.RoadTestID == hourSlot).FirstOrDefault());
     }
 }
Ejemplo n.º 5
0
 public static int GetInstructorByCar(int reg)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         return(Convert.ToInt16(context.Instructors.Where(v => v.Vehicle == reg).Select(i => i.ID).FirstOrDefault()));
     };
 }
Ejemplo n.º 6
0
 //Get instructor free date
 public static IEnumerable <ScheduleInstructor> GetInstructorAvailableDate(int instruktah, int dateTimeSlot)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.ScheduleInstructors.Where(i => i.InstructorID == instruktah && i.TimeSlotID == dateTimeSlot).ToList());
     }
 }
Ejemplo n.º 7
0
 public static int GetTimeSlotID(string slotTime)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.DayTimeSlots.Where(x => x.TimeSlot == slotTime).Select(i => i.ID).FirstOrDefault());
     }
 }
Ejemplo n.º 8
0
 public static IEnumerable <Customer> GetAllCustomers()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Customers.OrderBy(c => c.FirstName).ToList());
     }
 }
Ejemplo n.º 9
0
 public static IEnumerable <Customer> GetCustomersByID(int customerID)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Customers.Where(i => i.ID == customerID).ToList());
     }
 }
Ejemplo n.º 10
0
 public static IEnumerable <Instructor> GetAllInstructors()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Instructors.ToList());
     }
 }
Ejemplo n.º 11
0
 public static IEnumerable <UserType> GetUserType()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.UserTypes.ToList());
     }
 }
Ejemplo n.º 12
0
 public static IEnumerable <User> GetAllSupervisors()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.UserType == 3).ToList());
     }
 }
Ejemplo n.º 13
0
 public static IEnumerable <Maintenace> GetAllMaintenanceDetails()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Maintenaces.ToList());
     }
 }
Ejemplo n.º 14
0
 public static string GetUserPasswordHashByID(Byte userID)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.ID == userID).Select(h => h.PasswordHash).First());
     }
 }
Ejemplo n.º 15
0
 public static IEnumerable <SaleItem> GetAllSaleItems()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.SaleItems.ToList());
     }
 }
Ejemplo n.º 16
0
 public static Customer GetCustomerLastCustomer()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Customers.OrderByDescending(o => o.ID).FirstOrDefault());
     }
 }
Ejemplo n.º 17
0
 public static decimal?GetSaleSaleItem(int itemID)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.SaleItems.Where(i => i.ID == itemID).Select(p => p.Price).FirstOrDefault());
     }
 }
Ejemplo n.º 18
0
 public static Customer GetCustomersByCustomerNumber(string customerNo)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Customers.Where(i => i.CustomerNumber.Equals(customerNo, StringComparison.OrdinalIgnoreCase)).FirstOrDefault());
     }
 }
Ejemplo n.º 19
0
 public static int GetProductTypeID(int productID)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         return(Convert.ToInt32(context.SaleItems.Where(i => i.ID == productID).Select(x => x.SaleItemTypeID).FirstOrDefault()));
     }
 }
Ejemplo n.º 20
0
 public static IEnumerable <Make> GetCarMake()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Makes.ToList());
     }
 }
Ejemplo n.º 21
0
 public static IEnumerable <RoadTestTimeSlot> GetHourTimeSlots()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.RoadTestTimeSlots.ToList());
     }
 }
Ejemplo n.º 22
0
 public static IEnumerable <Colour> GetCarColor()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Colours.ToList());
     }
 }
Ejemplo n.º 23
0
 public static byte GetUserIDByUserName(string userName)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.UserName == userName).Select(i => i.ID).First());
     }
 }
Ejemplo n.º 24
0
 public static IEnumerable <Fuel> GetCarFuel()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Fuels.ToList());
     }
 }
Ejemplo n.º 25
0
 public static int?GetVehicleByInstructor(int instructor)
 {
     using (drivingSchoolDBEntities context = new drivingSchoolDBEntities())
     {
         return(Convert.ToInt16(context.Instructors.Where(i => i.ID == instructor).Select(v => v.Vehicle).FirstOrDefault()));
     };
 }
Ejemplo n.º 26
0
 public static IEnumerable <Vehicle> GetAllVehicles()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Vehicles.ToList());
     }
 }
Ejemplo n.º 27
0
 public static string GetUserNameByID(int supervisorID)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.ID == supervisorID).Select(s => s.UserName).First());
     }
 }
Ejemplo n.º 28
0
 public static IEnumerable <Unit> GetAllUnits()
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Units.ToList());
     }
 }
Ejemplo n.º 29
0
 public static string GetUserFullNameByID(int userID)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.ID == userID).Select(s => s.Name + " " + s.Surname).First());
     }
 }
Ejemplo n.º 30
0
 public static bool CheckIfUserNameIsInUse(string userName)
 {
     using (var context = new drivingSchoolDBEntities())
     {
         return(context.Users.Where(u => u.UserName.Equals(userName, StringComparison.OrdinalIgnoreCase)).Any()? true:false);
     }
 }