Пример #1
0
        public List <Enrollment> DeleteEnrollment(Enrollment enrollment)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Enrollments.Attach(enrollment);
                _context.Enrollments.Remove(enrollment);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Enrollments.ToList());
        }
Пример #2
0
        public List <Contract> DeleteContract(Contract contract)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Contracts.Attach(contract);
                _context.Contracts.Remove(contract);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Contracts.ToList());
        }
Пример #3
0
        public List <Schedule> DeleteSchedule(Schedule schedule)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Schedules.Attach(schedule);
                _context.Schedules.Remove(schedule);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Schedules.ToList());
        }
Пример #4
0
        public List <Part> DeletePart(Part part)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Parts.Attach(part);
                _context.Parts.Remove(part);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Parts.ToList());
        }
Пример #5
0
        public List <Advisory> DeleteAdvisory(Advisory advisory)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Advisories.Attach(advisory);
                _context.Advisories.Remove(advisory);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Advisories.ToList());
        }
Пример #6
0
        public List <Section> DeleteSection(Section section)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            try
            {
                _context.Sections.Attach(section);
                _context.Sections.Remove(section);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                // ignored
            }

            return(_context.Sections.ToList());
        }
Пример #7
0
        public List <Employee> GetEmployees(string query)
        {
            var stringProperties = typeof(Employee).GetProperties().Where(prop =>
                                                                          prop.PropertyType == typeof(string) ||
                                                                          prop.PropertyType == typeof(int) ||
                                                                          prop.PropertyType == typeof(int?)
                                                                          );

            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Employees.Where(
                       delegate(Employee x)
            {
                return stringProperties.Any(prop => (prop.PropertyType == typeof(int) && prop.GetValue(x)?.ToString() == query) ||
                                            (prop.PropertyType == typeof(int?) && prop.GetValue(x)?.ToString() == query) ||
                                            (prop.PropertyType == typeof(string) && EF.Functions.Like(prop.GetValue(x)?.ToString(), $"%{query}%")));
            }
                       ).ToList());
        }
Пример #8
0
        public List <PartUsage> GetPartUsages()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.PartUsages.ToList());
        }
Пример #9
0
        public List <Part> GetPartUsagePart(int partUsagePartId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Parts.Where(x => x.PartId == partUsagePartId).ToList());
        }
Пример #10
0
        public List <Professor> GetProfessorContractProfessor(int professorContractProfessorId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Professors.Where(x => x.ProfessorId == professorContractProfessorId).ToList());
        }
Пример #11
0
        public List <Contract> GetContractContractContract(int professorContractContractId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Contracts.Where(x => x.ContractId == professorContractContractId).ToList());
        }
Пример #12
0
 public List <Employee> GetEmployees()
 {
     using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);
     return(_context.Employees.ToList());
 }
Пример #13
0
        public List <School> GetSchools()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Schools.ToList());
        }
Пример #14
0
        public List <ReservationForm> GetEmployeeReservationForms(int employeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.ReservationForms.Where(x => x.EmployeeId == employeeId).ToList());
        }
        public List <Reservation> GetReservationFormReservation(int reservationFormReservationId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Reservations.Where(x => x.ReservationId == reservationFormReservationId).ToList());
        }
Пример #16
0
        public List <Employee> GetMaintenanceReleasingMechanic(int maintenanceEmployeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Employees.Where(x => x.EmployeeId == maintenanceEmployeeId).ToList());
        }
Пример #17
0
        public List <Vehicle> GetMaintenanceVehicle(int maintenanceVehicleId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Vehicles.Where(x => x.VehicleId == maintenanceVehicleId).ToList());
        }
Пример #18
0
        public List <Maintenance> GetMaintenances()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Maintenances.ToList());
        }
Пример #19
0
        public List <Department> GetSchoolDepartments(int schoolId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Departments.Where(x => x.SchoolId == schoolId).ToList());
        }
Пример #20
0
        public List <Professor> GetSchoolDean(int schoolProfessorId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Professors.Where(x => x.ProfessorId == schoolProfessorId).ToList());
        }
Пример #21
0
        public List <MaintenanceDetail> GetPartUsageMaintenanceDetail(int partUsageMaintenanceDetailId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.MaintenanceDetails.Where(x => x.MaintenanceDetailId == partUsageMaintenanceDetailId).ToList());
        }
Пример #22
0
        public List <Tenure> GetTenures()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Tenures.ToList());
        }
        public List <ReservationForm> GetReservationForms()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.ReservationForms.ToList());
        }
Пример #24
0
        public List <Vehicle> GetReservationVehicle(int reservationVehicleId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Vehicles.Where(x => x.VehicleId == reservationVehicleId).ToList());
        }
        public List <Employee> GetReservationFormEmployee(int reservationFormEmployeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Employees.Where(x => x.EmployeeId == reservationFormEmployeeId).ToList());
        }
Пример #26
0
        public List <ProfessorContract> GetProfessorContracts()
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.ProfessorContracts.ToList());
        }
Пример #27
0
        public List <Report> GetMaintenanceReport(int maintenanceReportId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Reports.Where(x => x.ReportId == maintenanceReportId).ToList());
        }
Пример #28
0
        public List <Department> GetTenureDepartment(int tenureDepartmentId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Departments.Where(x => x.DepartmentId == tenureDepartmentId).ToList());
        }
Пример #29
0
        public List <MaintenanceDetail> GetEmployeeMaintenanceDetails(int employeeId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.MaintenanceDetails.Where(x => x.EmployeeId == employeeId).ToList());
        }
Пример #30
0
        public List <Department> GetProfessorshipDepartment(int professorshipDepartmentId)
        {
            using TinyCollegeContext _context = new TinyCollegeContext(_builder.Options);

            return(_context.Departments.Where(x => x.DepartmentId == professorshipDepartmentId).ToList());
        }