コード例 #1
0
 public Reservation(Teacher teacher, IRoom room, Group group)
     : base(FindSpaceForNewReservation(teacher, room, group))
 {
     Teacher = teacher;
     Room = room;
     Group = group;
 }
コード例 #2
0
        public void Edit(string firstName, string lastName, Group group, int passedTerms, double avgOfMarks)
        {
            EditStudent(Ptr, firstName, lastName, group.Ptr, passedTerms, avgOfMarks);
            Group = App.Groups.SingleOrDefault(x => x.Ptr == GetStudentGroup(Ptr));

            OnPropertyChanged("FirstName");
            OnPropertyChanged("LastName");
            OnPropertyChanged("PassedTerms");
            OnPropertyChanged("AvgOfMarks");

            ViewModelLocator.Students.ReloadData();
            ViewModelLocator.Groups.ReloadData();
            InvokePropertyChanged();
        }
コード例 #3
0
 public Student(string firstName, string lastName, Group group, int passedTerms, double avgOfMarks)
     : base(CreateNewStudent(firstName, lastName, group.Ptr, passedTerms, avgOfMarks))
 {
     Group = group;
 }
コード例 #4
0
        private static IntPtr FindSpaceForNewReservation(Teacher teacher, IRoom room, Group group)
        {
            var start = DateTime.Now.Subtract(TimeSpan.FromMinutes(DateTime.Now.Minute)).AddHours(1);
            var end = start.AddHours(1);

            while (!CheckCollisionsBeforeAdding(start, end, teacher, room, group))
            {
                start += TimeSpan.FromHours(1);
                end += TimeSpan.FromHours(1);
            }

            return CreateNewReservation(
                "Type the name",
                start.ToUnixTimestamp(),
                end.ToUnixTimestamp(),
                teacher.Ptr,
                room.Ptr, group.Ptr);
        }
コード例 #5
0
 private static bool CheckCollisionsBeforeAdding(DateTime dateOfStart, DateTime dateOfEnd, Teacher teacher, IRoom room, Group group)
 {
     return CheckCollisions(dateOfStart.ToUnixTimestamp(), dateOfEnd.ToUnixTimestamp(), teacher.Ptr, room.Ptr, group.Ptr);
 }
コード例 #6
0
        public bool Edit(string name, DateTime dateOfStart, DateTime dateOfEnd, Teacher teacher, IRoom room, Group group)
        {
            if (EditReservation(Ptr, name, dateOfStart.ToUnixTimestamp(), dateOfEnd.ToUnixTimestamp(), teacher.Ptr, room.Ptr, group.Ptr))
            {
                Teacher = App.Teachers.SingleOrDefault(x => x.Ptr == GetReservationTeacher(Ptr));
                Room = App.Rooms.SingleOrDefault(x => x.Ptr == GetReservationRoom(Ptr));
                Group = App.Groups.SingleOrDefault(x => x.Ptr == GetReservationGroup(Ptr));

                OnPropertyChanged("Name");
                OnPropertyChanged("DateOfStart");
                OnPropertyChanged("DateOfEnd");
                InvokePropertyChanged();

                return true;
            }

            return false;
        }