private static MedicalRecordDto[] BuildRecords(IList<MedicalRecord> records, Tag tag)
        {
            var result = (from record in records
                          where record.Tag.Id == tag.Id
                          select record).ToArray();

            return Mapper.Map<MedicalRecord[], MedicalRecordDto[]>(result);
        }
Beispiel #2
0
        public void MapEntityToDto_MapTagToTagDto_MappingOccured()
        {
            var tag = new Tag()
            {
                Category = TagCategory.Appointment,
                Name = "Hello world",
                Notes = null,
            };
            var dto = Mapper.Map<Tag, TagDto>(tag);

            Assert.AreEqual(tag.Category, dto.Category);
            Assert.Null(dto.Notes);
            Assert.AreEqual(tag.Notes, dto.Notes);
        }
Beispiel #3
0
        public void MapEntityToDto_MapTagToMedicalRecord_MappingOccured()
        {
            var tag = new Tag()
            {
                Name = GetRandom.String,
                Notes = GetRandom.String,
                Category = TagCategory.Appointment,
            };

            var folder = Mapper.Map<Tag, MedicalRecordFolderDto>(tag);

            Assert.AreEqual(tag.Name, folder.Name);
            Assert.AreEqual(tag.Notes, folder.Notes);
        }
Beispiel #4
0
        internal IList<Appointment> GetAppointments(DateTime day, Tag googleTag)
        {
            try
            {
                var service = this.GetService();

                var appointments = new List<Appointment>();
                var query = new EventQuery()
                {
                    Uri = new Uri(this.CalendarUri),
                    StartTime = day.Date,
                    EndTime = day.Date.AddDays(1),
                };

                var feed = service.Query(query) as EventFeed;

                while (feed != null && feed.Entries.Count > 0)
                {
                    foreach (EventEntry entry in feed.Entries)
                    {
                        appointments.Add(new Appointment()
                        {
                            Subject = entry.Title.Text,
                            StartTime = entry.Times[0].StartTime,
                            EndTime = entry.Times[0].EndTime,
                            GoogleSynchronisationId = GetExtentedPropertyValue(entry),
                            Tag = googleTag,
                        });
                    }

                    if (feed.NextChunk != null)
                    {
                        query.Uri = new Uri(feed.NextChunk);
                        feed = service.Query(query) as EventFeed;
                    }
                    else { feed = null; }
                }

                var temp = (from a in appointments
                            where a.GoogleSynchronisationId == null
                               || a.GoogleSynchronisationId == new Guid()
                            select a).ToList();
                return temp;
            }
            catch (Exception ex) { throw new GoogleCalendarException(ex.Message, ex); }
        }