Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Data.Entity;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.Web.Mvc;
- using System.Web.Script.Serialization;
- namespace Timetable.Models
- {
- public class TimetableDb : DbContext
- {
- public DbSet<Allocation> Allocations { get; set; }
- public DbSet<Building> Buildings { get; set; }
- public DbSet<Module> Modules { get; set; }
- public DbSet<Request> Requests { get; set; }
- public DbSet<Room> Rooms { get; set; }
- public DbSet<Round> Rounds { get; set; }
- public DbSet<Park> Parks { get; set; }
- public DbSet<Department> Departments { get; set; }
- public DbSet<Lecturer> Lecturers { get; set; }
- public DbSet<Status> Statuses { get; set; }
- public DbSet<RoomType> RoomTypes { get; set; }
- public DbSet<Facility> Facilities { get; set; }
- public DbSet<Week> Weeks { get; set; }
- public DbSet<History> History { get; set; }
- }
- public class Allocation
- {
- public int AllocationId { get; set; }
- public int Period { get; set; }
- public virtual Request Request { get; set; }
- public virtual Room Room { get; set; }
- }
- public class Building
- {
- public int BuildingId { get; set; }
- public string Name { get; set; }
- public string Code { get; set; }
- public virtual Park Park { get; set; }
- public Object getAsObject()
- {
- return new
- {
- Name = this.Name,
- Code = this.Code,
- Park = this.Park
- };
- }
- }
- public class Module
- {
- public int ModuleId { get; set; }
- public string Name { get; set; }
- public string Code { get; set; }
- public virtual Department Department { get; set; }
- public virtual ICollection<Lecturer> Lecturers { get; set; }
- public Object getAsObject()
- {
- return new
- {
- ModuleId = this.ModuleId,
- Name = this.Name,
- Code = this.Code,
- Department = this.Department,
- Lecturers = from l in this.Lecturers
- select new
- {
- LecturerId = l.LecturerId,
- Name = l.Name
- }
- };
- }
- }
- public class Request
- {
- public int RequestId { get; set; }
- public int Day { get; set; }
- public int Length { get; set; }
- public int NumStudents { get; set; }
- public int NumRooms { get; set; }
- public int Period { get; set; }
- public bool Priority { get; set; }
- public string SpecReq { get; set; }
- public virtual RoomType RoomType { get; set; }
- public virtual Module Module { get; set; }
- public virtual Status Status { get; set; }
- public virtual Round Round { get; set; }
- public virtual ICollection<Room> Rooms { get; set; }
- public virtual ICollection<Facility> Facilities { get; set; }
- public virtual Park Park { get; set; }
- public virtual ICollection<Week> Weeks { get; set; }
- public virtual ICollection<Allocation> Allocations { get; set; }
- }
- public class Room
- {
- public int RoomId { get; set; }
- public string Code { get; set; }
- public int Capacity { get; set; }
- public virtual Building Building { get; set; }
- public virtual RoomType RoomType { get; set; }
- public virtual ICollection<Facility> Facilities { get; set; }
- public virtual ICollection<Request> Requests { get; set; }
- public Object getAsObject()
- {
- return new
- {
- RoomId = RoomId,
- Code = Code,
- Capacity = Capacity,
- Building = Building.getAsObject(),
- RoomType = RoomType,
- Facilities = Facilities.Select(x => x.getAsObject())
- };
- }
- }
- public class Round
- {
- public int RoundId { get; set; }
- public string Name { get; set; }
- public DateTime StartDate { get; set; }
- public DateTime EndDate { get; set; }
- public bool Active { get; set; }
- public int Semester { get; set; }
- public int Year { get; set; }
- }
- public class Park
- {
- public int ParkId { get; set; }
- public string Name { get; set; }
- }
- public class Department
- {
- public int DepartmentId { get; set; }
- public string Name { get; set; }
- public string Password { get; set; }
- }
- public class Lecturer
- {
- public int LecturerId { get; set; }
- public string Name { get; set; }
- public virtual ICollection<Module> Modules { get; set; }
- }
- public class Status
- {
- public int StatusId { get; set; }
- public string Name { get; set; }
- }
- public class RoomType
- {
- public int RoomTypeId { get; set; }
- public string Name { get; set; }
- }
- public class Facility
- {
- public int FacilityId { get; set; }
- public string Name { get; set; }
- public virtual ICollection<Request> Requests { get; set; }
- public virtual ICollection<Room> Rooms { get; set; }
- public Object getAsObject()
- {
- return new
- {
- FacilityId = this.FacilityId,
- Name = this.Name
- };
- }
- }
- public class Week
- {
- public int WeekId { get; set; }
- public int Num { get; set; }
- public virtual ICollection<Request> Requests { get; set; }
- }
- public class History
- {
- public int HistoryId { get; set; }
- public DateTime Date { get; set; }
- public string Action { get; set; }
- public string Message { get; set; }
- public virtual Department Department { get; set; }
- }
- }
Add Comment
Please, Sign In to add comment