Пример #1
0
        public async void BuscarAppointmentsAsync()
        {
            Meetings = new ObservableCollection <ScheduleAppointment>();
            Intern   = await internRepository.GetAsync(Settings.UserId);

            var appointments = await appointmentRepository.GetAllByInternId(Intern.Id);

            for (int i = 0; i < appointments.Count(); i++)
            {
                ScheduleAppointment appointment = new ScheduleAppointment();
                appointment.Subject = appointments.ElementAt(i).DescricaoConsultation;

                appointment.StartTime = appointments.ElementAt(i).StartTime;
                appointment.EndTime   = appointments.ElementAt(i).EndTime;
                appointment.Notes     = appointments.ElementAt(i).Id;

                if (appointments.ElementAt(i).Repeat)
                {
                    RecurrenceProperties recurrenceProperties = new RecurrenceProperties();
                    recurrenceProperties.RecurrenceType  = RecurrenceType.Weekly;
                    recurrenceProperties.RecurrenceRange = RecurrenceRange.NoEndDate;

                    switch (appointment.StartTime.DayOfWeek)
                    {
                    case DayOfWeek.Monday:
                        recurrenceProperties.WeekDays = WeekDays.Monday;
                        break;

                    case DayOfWeek.Tuesday:
                        recurrenceProperties.WeekDays = WeekDays.Tuesday;
                        break;

                    case DayOfWeek.Wednesday:
                        recurrenceProperties.WeekDays = WeekDays.Wednesday;
                        break;

                    case DayOfWeek.Thursday:
                        recurrenceProperties.WeekDays = WeekDays.Thursday;
                        break;

                    case DayOfWeek.Friday:
                        recurrenceProperties.WeekDays = WeekDays.Friday;
                        break;
                    }
                    appointment.RecurrenceRule = DependencyService.Get <IRecurrenceBuilder>().RRuleGenerator(recurrenceProperties, appointment.StartTime, appointment.EndTime);
                }

                Meetings.Add(appointment);
            }
        }
        public async void GetInternAsync()
        {
            try
            {
                if (!IsAdmin)
                {
                    Intern = await internRepository.GetAsync(Settings.UserId);
                }
                else
                {
                    if (!String.IsNullOrEmpty(Intern.Id))
                    {
                        Intern = await internRepository.GetAsync(Intern.Id);
                    }
                }
                ResponsibleOrientador = await responsibleRepository.GetAsync(Intern.IdResponsible);

                ResponsibleCollection = await responsibleRepository.GetAllAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }