public AuditoriumEvent(string name, Calendar calendar, Ring ring, Auditorium auditorium)
 {
     Name = name;
     Calendar = calendar;
     Ring = ring;
     Auditorium = auditorium;
 }
Exemplo 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();
            }
        }
Exemplo 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);
        }
Exemplo n.º 4
0
 public TeacherWish(Teacher teacher, Calendar calendar, Ring ring, int wish)
 {
     Teacher = teacher;
     Calendar = calendar;
     Ring = ring;
     Wish = wish;
 }
Exemplo 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;
        }
Exemplo 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();
        }
Exemplo n.º 7
0
 public RingView(Ring ring)
 {
     RingId = ring.RingId;
     Time = ring.Time.ToString("H:mm");
 }
Exemplo 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;
            }
        }
Exemplo n.º 12
0
 public ShiftRing(Shift shift, Ring ring)
 {
     Shift = shift;
     Ring = ring;
 }