Exemple #1
0
 /// <summary>
 /// Saves the appointment.
 /// </summary>
 /// <param name="distributorID">The distributor ID.</param>
 /// <param name="appointment">The appointment.</param>
 /// <param name="isNew">if set to <c>true</c> [is new].</param>
 /// <param name="saveDatesOnly">if set to <c>true</c> [save dates only].</param>
 /// <returns></returns>
 public static int SaveAppointment(string distributorID, Appointment_V01 appointment, bool isNew, bool saveDatesOnly)
 {
     using (var proxy = ServiceClientProvider.GetDistributorCRMServiceProxy())
     {
         try
         {
             var request01 = new SaveAppointmentRequest_V01()
             {
                 DistributorID   = distributorID,
                 Appointment     = appointment,
                 IsNew           = isNew,
                 UpdateDatesOnly = saveDatesOnly
             };
             SaveAppointmentResponse_V01 responseV01 =
                 proxy.SaveAppointment(new SaveAppointmentRequest1(request01)).SaveAppointmentResult as SaveAppointmentResponse_V01;
             //todo: validate response, handle errors.
             return(responseV01.AppointmentID);
         }
         catch (Exception ex)
         {
             Log(ex, proxy);
             throw ex;
         }
     }
 }
Exemple #2
0
        //todo: return true/false to indicate if it failed/succeeded.
        private void SaveAppointment(int appointmentContactID)
        {
            if (string.IsNullOrEmpty(SubjectTextBox.Text))
            {
                return;
            }

            Appointment_V01 appointmnet = new Appointment_V01()
            {
                Attendees        = GetAttendees(appointmentContactID),
                Category         = GetCategory(),
                StartTime        = GetStartTime(),
                EndTime          = GetEndTime(),
                Subject          = SubjectTextBox.Text,
                Notes            = NotesTextBox.Text,
                RecurrenceType   = AppointmentRecurrenceType.NOTREC,
                Location         = LocationBox.Text,
                RecurringPattern = ""
            };

            //todo: error handling
            SchedulerDataProvider.SaveAppointment(DistributorID, appointmnet, true, false);
        }