public AuditoriumEvent(string name, Calendar calendar, Ring ring, Auditorium auditorium)
 {
     Name = name;
     Calendar = calendar;
     Ring = ring;
     Auditorium = auditorium;
 }
Esempio n. 2
0
        private void forceDeleteWithReplace_Click(object sender, EventArgs e)
        {
            if (RingListView.SelectedCells.Count > 0)
            {
                var ringView = ((List<RingView>)RingListView.DataSource)[RingListView.SelectedCells[0].RowIndex];

                var replaceRing = _repo.FindRing(newRing.Value);

                if (replaceRing == null)
                {
                    replaceRing = new Ring { Time = newRing.Value };
                    _repo.AddRing(replaceRing);
                }

                var ringLessons = _repo.GetFiltredLessons(l => l.Ring.RingId == ringView.RingId);

                if (ringLessons.Count > 0)
                {
                    foreach (var lesson in ringLessons)
                    {
                        lesson.Ring = replaceRing;
                        _repo.UpdateLesson(lesson);
                    }
                }

                _repo.RemoveRing(ringView.RingId);

                RefreshView();
            }
        }
Esempio n. 3
0
        public EditLesson(ScheduleRepository repo, int groupId, int dow, string time)
        {
            InitializeComponent();

            _repo = repo;
            _dow = dow;
            _ring = _repo.FindRing(DateTime.ParseExact(time, "H:mm", CultureInfo.InvariantCulture));

            var sStarts = _repo.GetSemesterStarts();

            var gl = _repo.GetGroupedGroupLessons(groupId, sStarts);

            _curLessons = new Dictionary<int, Tuple<string, List<Lesson>>>();
            if (gl.ContainsKey(dow + " " + time))
            {
                _curLessons = gl[dow + " " + time];
                _curTFDIndex = 0;
            }
            else
            {
                _curTFDIndex = -1;
                tfdIndex.Text = "Пусто тут барин!";
            }

            DisplayTFD(_curTFDIndex);
        }
Esempio n. 4
0
 public TeacherWish(Teacher teacher, Calendar calendar, Ring ring, int wish)
 {
     Teacher = teacher;
     Calendar = calendar;
     Ring = ring;
     Wish = wish;
 }
Esempio n. 5
0
        public EditLesson(ScheduleRepository repo, int groupId, int dow, string time, bool putProposedLessons)
        {
            InitializeComponent();

            _repo = repo;
            _groupId = groupId;
            _dow = dow;
            _time = time;
            _ring = _repo.Rings.FindRing(DateTime.ParseExact(_time, "H:mm", CultureInfo.InvariantCulture));
            _putProposedLesson = putProposedLessons;
        }
Esempio n. 6
0
        private void add_Click(object sender, EventArgs e)
        {
            if (_repo.FindRing(RingTime.Value) != null)
            {
                MessageBox.Show("Такое время уже есть.");
                return;
            }

            var newRing = new Ring { Time = RingTime.Value.Subtract(new TimeSpan(0, 0, 0, RingTime.Value.Second, RingTime.Value.Millisecond))};
            _repo.AddRing(newRing);

            RefreshView();
        }
Esempio n. 7
0
 public RingView(Ring ring)
 {
     RingId = ring.RingId;
     Time = ring.Time.ToString("H:mm");
 }
Esempio n. 8
0
 public MySQLRing(Ring ring)
 {
     RingId = ring.RingId;
     Time = ring.Time.ToString("H:mm:00");
 }
        public Ring AddRing(Ring ring)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                ring.RingId = 0;

                context.Rings.Add(ring);
                context.SaveChanges();

                return ring;
            }
        }
        public void UpdateRing(Ring ring)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                var curRing = context.Rings.FirstOrDefault(r => r.RingId == ring.RingId);

                curRing.Time = ring.Time;

                context.SaveChanges();
            }
        }
        public List<Auditorium> GetFreeAuditoriumAtTime(Calendar calendar, Ring ring)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                var occupiedAudIds = context.Lessons
                    .Where(l =>
                        ((l.Calendar.CalendarId == calendar.CalendarId) &&
                         (l.Ring.RingId == ring.RingId)))
                     .Select(l => l.Auditorium.AuditoriumId)
                     .Distinct()
                     .ToList();

                var result = context.Auditoriums.Where(a => !occupiedAudIds.Contains(a.AuditoriumId)).ToList();

                return result;
            }
        }
Esempio n. 12
0
 public ShiftRing(Shift shift, Ring ring)
 {
     Shift = shift;
     Ring = ring;
 }