Beispiel #1
0
 public static ScheduleInfo[] GetScheduleFromAuditorium(AuditoriumInfo aud, PeriodInfo period)
 {
     return((from s in Db.Schedule
             where (s.ID_Auditorium == aud.ID_Auditorium) &&
             (s.ID_Period == period.ID_Period)
             select new ScheduleInfo(s)).ToArray());
 }
 public AddParaAuditorium(AuditoriumInfo auditoriumInfo, IEnumerable<ScheduleInfo> scheduleInfos, int para, int dayWeek, int idPeriod, string text, bool edit)
 {
     InitializeComponent();
     Text = text;
     IDAud = auditoriumInfo.ID_Auditorium;
     Para = para;
     DayWeek = dayWeek;
     IDPeriod = idPeriod;
     if (IDPeriod != 1 && IDPeriod != 2)
     {
         checkBox2.Visible = false;
         Size = new Size(431, 238);
     }
     Sched = edit ? new List<ScheduleInfo>(scheduleInfos) : new List<ScheduleInfo>();
     if (edit)
     {
         var teacher = Model.GetFreeTeachersAndCurrent(IDPeriod, Para, DayWeek, Sched[0].ID_Teacher);
         Teacher.Items.AddRange(teacher);
         var t = teacher.Single(q => q.ID_Teacher == Sched[0].ID_Teacher);
         Teacher.SelectedItem = t;
         Disp.Items.Clear();
         var dispAll = Model.GetDisciplinesFromTeacher((TeacherInfo)Teacher.SelectedItem);
         var d = dispAll.Single(q => q.ID_Discipline == Sched[0].ID_Discipline);
         Disp.Items.AddRange(dispAll);
         Disp.SelectedItem = d;
         var facAll = Model.GetAll.Fuculty();
         var fac = facAll.Single(a => a.ID_Faculty == Sched.First().ID_Faculty);
         Faculty.Items.AddRange(facAll);
         Faculty.SelectedItem = fac;
         try
         {
             var temp = Sched.First().GroupName.Substring(Sched.First().GroupName.Length - 2, 1);
             Curs.SelectedIndex = Convert.ToInt32(temp) - 1;
         }
         catch (Exception)
         {
         }
         for (int i = 0; i < List.Items.Count; i++)
             foreach (var list in Sched)
                 if (((GroupInfo)List.Items[i]).ID_Group == list.ID_Group)
                     List.SetItemChecked(i, true);
         groupBox3.Enabled = true;
     }
     else
     {
         var teachers = Model.GetFreeTeachers(IDPeriod, Para, DayWeek);
         Teacher.Items.AddRange(teachers);
         if (teachers.Count() == 1)
             Teacher.SelectedItem = teachers[0];
         var faculty = Model.GetAll.Fuculty();
         Faculty.Items.AddRange(faculty);
         if (faculty.Count() == 1)
             Faculty.SelectedItem = faculty[0];
     }
 }
Beispiel #3
0
            public static void Auditorium(AuditoriumInfo aud, string number, int capacity, int comp,
                                          string quality, string projector)
            {
                var temp = Db.Auditoriums.Single(a => a.ID_Auditorium == aud.ID_Auditorium);

                temp.Number                = number;
                temp.Capacity              = capacity;
                temp.NumbComp              = comp;
                temp.QualityComp           = quality;
                temp.AvailabilityProjector = projector;
                Db.AcceptChanges();
            }
Beispiel #4
0
 public static void Auditorium(AuditoriumInfo aud)
 {
     foreach (var row in Db.Schedule.Where(a => a.AuditoriumsRow.ID_Auditorium == aud.ID_Auditorium).ToArray())
     {
         Db.Schedule.RemoveScheduleRow(row);
     }
     foreach (var row in Db.ScheduleException.Where(a => a.AuditoriumsRow.ID_Auditorium == aud.ID_Auditorium).ToArray())
     {
         Db.ScheduleException.RemoveScheduleExceptionRow(row);
     }
     Db.Auditoriums.RemoveAuditoriumsRow(Db.Auditoriums.Single(a => a.ID_Auditorium == aud.ID_Auditorium));
     Db.AcceptChanges();
 }
Beispiel #5
0
 public AddParaAuditorium(AuditoriumInfo auditoriumInfo, IEnumerable <ScheduleInfo> scheduleInfos, int para, int dayWeek, int idPeriod, string text, bool edit)
 {
     InitializeComponent();
     Text     = text;
     IDAud    = auditoriumInfo.ID_Auditorium;
     Para     = para;
     DayWeek  = dayWeek;
     IDPeriod = idPeriod;
     if (IDPeriod != 1 && IDPeriod != 2)
     {
         checkBox2.Visible = false;
         Size = new Size(431, 238);
     }
     Sched = edit ? new List <ScheduleInfo>(scheduleInfos) : new List <ScheduleInfo>();
     if (edit)
     {
         var teacher = Model.GetFreeTeachersAndCurrent(IDPeriod, Para, DayWeek, Sched[0].ID_Teacher);
         Teacher.Items.AddRange(teacher);
         var t = teacher.Single(q => q.ID_Teacher == Sched[0].ID_Teacher);
         Teacher.SelectedItem = t;
         Disp.Items.Clear();
         var dispAll = Model.GetDisciplinesFromTeacher((TeacherInfo)Teacher.SelectedItem);
         var d       = dispAll.Single(q => q.ID_Discipline == Sched[0].ID_Discipline);
         Disp.Items.AddRange(dispAll);
         Disp.SelectedItem = d;
         var facAll = Model.GetAll.Fuculty();
         var fac    = facAll.Single(a => a.ID_Faculty == Sched.First().ID_Faculty);
         Faculty.Items.AddRange(facAll);
         Faculty.SelectedItem = fac;
         try
         {
             var temp = Sched.First().GroupName.Substring(Sched.First().GroupName.Length - 2, 1);
             Curs.SelectedIndex = Convert.ToInt32(temp) - 1;
         }
         catch (Exception)
         {
         }
         for (int i = 0; i < List.Items.Count; i++)
         {
             foreach (var list in Sched)
             {
                 if (((GroupInfo)List.Items[i]).ID_Group == list.ID_Group)
                 {
                     List.SetItemChecked(i, true);
                 }
             }
         }
         groupBox3.Enabled = true;
     }
     else
     {
         var teachers = Model.GetFreeTeachers(IDPeriod, Para, DayWeek);
         Teacher.Items.AddRange(teachers);
         if (teachers.Count() == 1)
         {
             Teacher.SelectedItem = teachers[0];
         }
         var faculty = Model.GetAll.Fuculty();
         Faculty.Items.AddRange(faculty);
         if (faculty.Count() == 1)
         {
             Faculty.SelectedItem = faculty[0];
         }
     }
 }
Beispiel #6
0
 public int Compare(AuditoriumInfo a, AuditoriumInfo b)
 {
     return(a.Number.CompareTo(b.Number));
 }