private void DeleteEmail(Service.Email email)
        {
            this.Emails.Remove(email);

            MailRepository.Context.DeleteObject(email);
        }
        private void MoveToDeletedItemsFolder(Service.Email email)
        {
            email.Folder = MailRepository.DeletedItemsFolder;
            email.FolderID = MailRepository.DeletedItemsFolder.FolderID;

            MailRepository.Update(email);
            this.Emails.Remove(email);
        }
        public bool IsMessageValid(Service.Email email)
        {
            var isRecipientAddressValid = IsEmailValid(email.RecipientAddress);
            var isSubjectEmpty = string.IsNullOrEmpty(email.Subject);

            if (!isRecipientAddressValid)
            {
                this.DisplayAlert("Please make sure you enter at least one correct recipient address.");
            }
            else if (isSubjectEmpty)
            {
                this.DisplayAlert("This message must have a subject.");
            }
            return isRecipientAddressValid && !isSubjectEmpty;
        }
 private static void SetCategory(Service.Email email, Service.Category category)
 {
     email.Category = category;
     email.CategoryID = category != null ? (int?)category.CategoryID : null;
 }
        private void SetTimeMarkerToOccurrence(ref Service.Appointment appointment, Service.TimeMarker newTimeMarker, ref ScheduleView.IExceptionOccurrence exceptionToEdit)
        {
            appointment = (this.SelectedAppointment as ScheduleView.Occurrence).Master as Service.Appointment;
            if (appointment != null && appointment.RecurrenceRule != null)
            {
                exceptionToEdit = appointment.RecurrenceRule.Exceptions.SingleOrDefault(e => (e.Appointment as ScheduleView.IOccurrence) == ((ScheduleView.Occurrence)(this.SelectedAppointment)).Appointment);
                if (exceptionToEdit != null)
                {
                    appointment.RecurrenceRule.Exceptions.Remove(exceptionToEdit);
                    SetTimeMarker(exceptionToEdit.Appointment as Service.Appointment, newTimeMarker);

                    appointment.RecurrenceRule.Exceptions.Add(exceptionToEdit);
                }

                SetTimeMarker(appointment, newTimeMarker);

                this.ReplaceItem(appointment);
            }
        }
 private void SetTimeMarkerToAppointment(Service.Appointment appointment, Service.TimeMarker newTimeMarker)
 {
     var appointmentToEdit = (from app in this.Appointments where app.Equals(appointment) select app).FirstOrDefault();
     if (appointmentToEdit != null)
     {
         SetTimeMarker(appointmentToEdit, newTimeMarker);
         this.ReplaceItem(appointmentToEdit);
     }
 }
        private void ReplaceItem(Service.Appointment appointmentToEdit)
        {
            if (appointmentToEdit != null)
            {
                this.shouldProcessCollectionChanged = false;

                var index = this.Appointments.IndexOf(appointmentToEdit);
                this.Appointments.Remove(appointmentToEdit);
                this.Appointments.Insert(index, appointmentToEdit);

                this.shouldProcessCollectionChanged = true;
            }
        }
 private static void SetTimeMarker(Service.Appointment appointment, Service.TimeMarker newTimeMarker)
 {
     appointment.TimeMarker = newTimeMarker;
     appointment.TimeMarkerID = newTimeMarker.TimeMarkerID;
 }
 private static void SetCategory(Service.Appointment appointment, Service.Category category)
 {
     appointment.Category = category;
     appointment.CategoryID = category.CategoryID;
 }