Example #1
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() ^
            Description.GetHashCode() ^
            Day.GetHashCode() ^
            StartTime.GetHashCode() ^
            EndTime.GetHashCode() ^
            TherapyPlace.GetHashCode());
 }
Example #2
0
        private static void WriteTherapyPlace(XmlWriter writer, TherapyPlace therapyPlace)
        {
            writer.WriteStartElement(TherapyPlace);

            writer.WriteAttributeString(IdAttribute, therapyPlace.Id.ToString());
            writer.WriteAttributeString(NameAttribute, therapyPlace.Name);
            writer.WriteAttributeString(TherapyPlaceTypeAttribute, therapyPlace.TypeId.ToString());

            writer.WriteEndElement();
        }
 public static string ForDividedReplacedEvent(Patient patient,
                                              Date currentDate, Date lastDate,
                                              Time currentStartTime, Time lastStartTime,
                                              Time currentEndTime, Time lastEndTime,
                                              TherapyPlace currentTherapyPlace, TherapyPlace lastTherapyPlace)
 {
     return("Wollen Sie den Termin\n" +
            $"des Patienten {patient.Name}\n" +
            $"vom {lastDate.GetDisplayStringWithDayOfWeek(CultureInfo)} [{lastStartTime} bis {lastEndTime}; Therapieplatz {lastTherapyPlace.Name}]\n" +
            $"zum {currentDate.GetDisplayStringWithDayOfWeek(CultureInfo)} [{currentStartTime} bis {currentEndTime}; Therapieplatz {currentTherapyPlace.Name}]\n" +
            "verschieben?");
 }
 public static string ForDividedReplacedEvent(Patient patient,
                                              Date currentDate, Date nextDate,
                                              Time currentStartTime, Time nextStartTime,
                                              Time currentEndTime, Time nextEndTime,
                                              TherapyPlace currentTherapyPlace, TherapyPlace nextTherapyPlace)
 {
     return("Wollen Sie den, durch UNDO verschobenen Termin\n" +
            $"des Patienten {patient.Name}\n" +
            $"vom {currentDate} [{currentStartTime} bis {currentEndTime}; Therapieplatz {currentTherapyPlace.Name}]\n" +
            $"zum {nextDate} [{nextStartTime} bis {nextEndTime}; Therapieplatz {nextTherapyPlace.Name}]\n" +
            "zurückverschieben?");
 }
Example #5
0
 public ReplacedAction(ICommandService commandService,
                       ReplaceAppointment replaceAppointmentCommand,
                       Patient patient,
                       TherapyPlace originalTherapyPlace,
                       TherapyPlace newTherapyPlace)
 {
     this.commandService            = commandService;
     this.replaceAppointmentCommand = replaceAppointmentCommand;
     this.patient = patient;
     this.originalTherapyPlace = originalTherapyPlace;
     this.newTherapyPlace      = newTherapyPlace;
 }
Example #6
0
        public TherapyPlaceRowViewModel(IViewModelCommunication viewModelCommunication,
                                        IClientTherapyPlaceTypeRepository therapyPlaceTypeRepository,
                                        TherapyPlace therapyPlace,
                                        Color roomDisplayColor,
                                        TherapyPlaceRowIdentifier identifier,
                                        AdornerControl adornerControl,
                                        Time timeSlotBegin,
                                        Time timeSlotEnd,
                                        ISharedStateReadOnly <AppointmentModifications> appointmentModificationsVariable,
                                        Width initialGridWidth,
                                        Action <string> errorCallback)
        {
            this.viewModelCommunication     = viewModelCommunication;
            this.therapyPlaceTypeRepository = therapyPlaceTypeRepository;
            this.therapyPlace = therapyPlace;
            this.appointmentModificationsVariable = appointmentModificationsVariable;

            therapyPlaceTypeRepository.UpdatedTherapyPlaceTypeAvailable += OnUpdatedTherapyPlaceTypeAvailable;

            IsVisible             = true;
            RoomColor             = roomDisplayColor;
            Identifier            = identifier;
            TherapyPlaceName      = therapyPlace.Name;
            AppointmentViewModels = new ObservableCollection <IAppointmentViewModel>();

            viewModelCommunication.RegisterViewModelAtCollection <ITherapyPlaceRowViewModel, TherapyPlaceRowIdentifier>(
                Constants.ViewModelCollections.TherapyPlaceRowViewModelCollection,
                this
                );

            appointmentModificationsVariable.StateChanged += OnAppointmentModificationsChanged;
            OnAppointmentModificationsChanged(appointmentModificationsVariable.Value);

            TimeSlotBegin = timeSlotBegin;
            TimeSlotEnd   = timeSlotEnd;

            AdornerControl = adornerControl;

            GridWidth = initialGridWidth;

            therapyPlaceTypeRepository.RequestTherapyPlaceTypes(
                placeType =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    PlaceTypeIcon = GetIconForTherapyPlaceType(placeType.IconType);
                });
            },
                therapyPlace.TypeId,
                errorCallback
                );
        }
        public static string ForReplacedEvent(Patient patient, Date day,
                                              Time currentStartTime, Time currentEndTime, TherapyPlace currentTherapyPlace,
                                              Time lastStartTime, Time lastEndTime, TherapyPlace lastTherapyPlaceType)
        {
            if (currentTherapyPlace == lastTherapyPlaceType && currentStartTime == lastStartTime)
            {
                return("Wollen Sie das Terminende\n" +
                       $"des Patienten {patient.Name}\n" +
                       $"am {day.GetDisplayStringWithDayOfWeek(CultureInfo)}\n" +
                       $"von {currentEndTime}\n" +
                       $"nach {lastEndTime}\n" +
                       "verschieben?");
            }

            if (currentTherapyPlace == lastTherapyPlaceType && currentEndTime == lastEndTime)
            {
                return("Wollen Sie den Terminbegin\n" +
                       $"des Patienten {patient.Name}\n" +
                       $"am {day.GetDisplayStringWithDayOfWeek(CultureInfo)}\n" +
                       $"von {currentStartTime}\n" +
                       $"nach {lastStartTime}\n" +
                       "verschieben?");
            }

            var fromExtension = "";
            var toExtension   = "";

            if (currentTherapyPlace != lastTherapyPlaceType)
            {
                fromExtension = $"\t[Therapieplatz {currentTherapyPlace.Name}]";
                toExtension   = $"\t[Therapieplatz {lastTherapyPlaceType.Name}]";
            }

            if (new Duration(currentStartTime, currentEndTime) == new Duration(lastStartTime, lastEndTime))
            {
                return("Wollen Sie den Termin\n" +
                       $"des Patienten {patient.Name}\n" +
                       $"am {day.GetDisplayStringWithDayOfWeek(CultureInfo)}\n" +
                       $"von {currentStartTime} " + fromExtension + "\n" +
                       $"nach {lastStartTime}" + toExtension + "\n" +
                       "verschieben?");
            }

            return("Wollen Sie den Termin\n" +
                   $"des Patienten {patient.Name}\n" +
                   $"am {day.GetDisplayStringWithDayOfWeek(CultureInfo)}\n" +
                   $"von {currentStartTime} bis {currentEndTime} " + fromExtension + "\n" +
                   $"nach {lastStartTime} bis {lastEndTime} " + toExtension + "\n" +
                   "verschieben?");
        }
        public static string ForReplacedEvent(Patient patient, Date day,
                                              Time currentStartTime, Time currentEndTime, TherapyPlace currentTherapyPlace,
                                              Time nextStartTime, Time nextEndTime, TherapyPlace nextTherapyPlace)
        {
            if (currentTherapyPlace == nextTherapyPlace && currentStartTime == nextStartTime)
            {
                return("Wollen Sie das, durch UNDO verschobenes Terminende\n" +
                       $"des Patienten {patient.Name}\n" +
                       $"am {day}\n" +
                       $"von {currentEndTime}\n" +
                       $"nach {nextEndTime}\n" +
                       "zurückverschieben?");
            }

            if (currentTherapyPlace == nextTherapyPlace && currentEndTime == nextEndTime)
            {
                return("Wollen Sie den, durch UNDO verschobenen Terminbegin\n" +
                       $"des Patienten {patient.Name}\n" +
                       $"am {day}\n" +
                       $"von {currentStartTime}\n" +
                       $"nach {nextStartTime}\n" +
                       "zurückverschieben?");
            }

            var fromExtension = "";
            var toExtension   = "";

            if (currentTherapyPlace != nextTherapyPlace)
            {
                fromExtension = $"\t[Therapieplatz {currentTherapyPlace.Name}]";
                toExtension   = $"\t[Therapieplatz {nextTherapyPlace.Name}]";
            }

            if (new Duration(currentStartTime, currentEndTime) == new Duration(nextStartTime, nextEndTime))
            {
                return("Wollen Sie den, durch UNDO verschobenen Termin\n" +
                       $"des Patienten {patient.Name}\n" +
                       $"am {day}\n" +
                       $"von {currentStartTime} " + fromExtension + "\n" +
                       $"nach {nextStartTime}" + toExtension + "\n" +
                       "zurückverschieben?");
            }

            return("Wollen Sie den, durch UNDO verschobenen Termin\n" +
                   $"des Patienten {patient.Name}\n" +
                   $"am {day}\n" +
                   $"von {currentStartTime} bis {currentEndTime} " + fromExtension + "\n" +
                   $"nach {nextStartTime} bis {nextEndTime} " + toExtension + "\n" +
                   "zurückverschieben?");
        }
Example #9
0
        private void UpdateTherapyPlace(TherapyPlace updatedTherapyPlace)
        {
            var placeListItem = TherapyPlaces.First(listItem => listItem.PlaceId == updatedTherapyPlace.Id);
            var placeType     = dataCenter.GetTherapyPlaceType(updatedTherapyPlace.TypeId);

            placeListItem.Name     = updatedTherapyPlace.Name;
            placeListItem.TypeIcon = GetIconForTherapyPlaceType(placeType.IconType);
            placeListItem.TypeName = placeType.Name;

            SelectedTherapyPlaceObject = updatedTherapyPlace;

            var updatedRoom = SelectedRoomObject.UpdateTherapyPlace(updatedTherapyPlace);

            UpdateRoom(updatedRoom);
        }
Example #10
0
        public Appointment(Patient patient, string description, TherapyPlace therapyPlace,
                           Date day, Time startTime, Time endTime, Guid id, Label label)
        {
            Guard.ArgumentNotNull(patient);
            Guard.ArgumentNotNull(description);
            Guard.ArgumentNotNull(therapyPlace);

            Patient      = patient;
            TherapyPlace = therapyPlace;
            Day          = day;
            StartTime    = startTime;
            EndTime      = endTime;
            Description  = description;
            Id           = id;
            Label        = label;
        }
Example #11
0
        private static IReadOnlyList <TherapyPlace> AcceptTherapyPlace(XmlReader reader, int placeCount)
        {
            IList <TherapyPlace> therapyPlaces = new List <TherapyPlace>();

            var i = 0;

            while (i < placeCount)
            {
                reader.Read();

                if (reader.NodeType != XmlNodeType.Element || reader.Name != TherapyPlace)
                {
                    continue;
                }
                i++;

                var id     = new Guid();
                var typeId = new Guid();
                var name   = string.Empty;

                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        if (reader.Name == IdAttribute)
                        {
                            id = Guid.Parse(reader.Value);
                        }
                        if (reader.Name == TherapyPlaceTypeAttribute)
                        {
                            typeId = Guid.Parse(reader.Value);
                        }
                        if (reader.Name == NameAttribute)
                        {
                            name = reader.Value;
                        }
                    }
                }

                var therapyPlace = new TherapyPlace(id, typeId, name);
                therapyPlaces.Add(therapyPlace);
            }

            return(therapyPlaces.ToList());
        }
 public TherapyPlaceSerializationDouble(TherapyPlace therapyPlace)
 {
     Id     = therapyPlace.Id;
     Name   = therapyPlace.Name;
     TypeId = therapyPlace.TypeId;
 }
Example #13
0
 public ReplacedAction BuildReplacedAction(ReplaceAppointment command, Patient patient, TherapyPlace originalTherapyPlace, TherapyPlace newTherapyPlace)
 {
     return(new ReplacedAction(commandService, command, patient, originalTherapyPlace, newTherapyPlace));
 }