Exemplo n.º 1
0
        void AnalyzeAndHandleCurrentOperation(DevExpress.XtraScheduler.Outlook.OutlookAppointmentSynchronizingEventArgs eventArgs)
        {
            switch (eventArgs.Operation)
            {
            case SynchronizeOperation.Create:
                eventArgs.Cancel = eventArgs.OutlookAppointment != null && deletedAppointments.Contains(eventArgs.OutlookAppointment.EntryID);
                break;

            case SynchronizeOperation.Delete:
                if (isInitialSynchronization)
                {
                    eventArgs.Cancel = true;
                }
                else
                {
                    eventArgs.Cancel = eventArgs.Appointment != null && insertedAppointments.Contains(eventArgs.Appointment);
                }
                break;

            case SynchronizeOperation.Replace:
                eventArgs.Cancel = eventArgs.Appointment != null && changedAppointments.Contains(eventArgs.Appointment);
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        void AnalyzeAndHandleCurrentOperation(DevExpress.XtraScheduler.Outlook.OutlookAppointmentSynchronizingEventArgs eventArgs, bool toScheduler)
        {
            string logInfo = "";
            string appointmentInfoScheduler = "";
            string appointmentInfoOutlook   = "";

            if (eventArgs.Appointment != null)
            {
                appointmentInfoScheduler = String.Format("Subject: {0}, Start: {1}, End: {2}, ForeignID: {3}",
                                                         eventArgs.Appointment.Subject, eventArgs.Appointment.Start.ToString(), eventArgs.Appointment.End.ToString(),
                                                         eventArgs.Appointment.GetValue(this.schedulerStorage1, OutlookEntryIDFieldName));
            }
            else
            {
                appointmentInfoScheduler = "<No information>";
            }

            if (eventArgs.OutlookAppointment != null)
            {
                appointmentInfoOutlook = String.Format("Subject: {0}, Start: {1}, End: {2}, ID:{3}",
                                                       eventArgs.OutlookAppointment.Subject, eventArgs.OutlookAppointment.Start.ToString(), eventArgs.OutlookAppointment.End.ToString(),
                                                       eventArgs.OutlookAppointment.EntryID);
            }
            else
            {
                appointmentInfoOutlook = "<No information>";
            }

            switch (eventArgs.Operation)
            {
            case SynchronizeOperation.Create:
                logInfo += (toScheduler ? "->Scheduler (Creating)" : "->Outlook (Creating)");
                logInfo += "\r\n";
                logInfo += String.Format("({0}) appointment - {1}", "Scheduler", appointmentInfoScheduler);
                logInfo += "\r\n";
                logInfo += String.Format("({0}) appointment - {1}", "Outlook   ", appointmentInfoOutlook);
                // Decide whether to perform an operation.
                if ((toScheduler && !SyncronizationOptionForm.AllowCreateAppointmentInScheduler) || (!toScheduler && !SyncronizationOptionForm.AllowCreateAppointmentInOutlook))
                {
                    eventArgs.Cancel = true;
                    logInfo         += " (Operation canceled)";
                }
                break;

            case SynchronizeOperation.Delete:
                logInfo += (toScheduler ? "->Scheduler (Deleting)" : "->Outlook (Deleting)");
                logInfo += "\r\n";
                logInfo += String.Format("({0}) appointment - {1}", "Scheduler", appointmentInfoScheduler);
                logInfo += "\r\n";
                logInfo += String.Format("({0}) appointment - {1}", "Outlook    ", appointmentInfoOutlook);
                // Decide whether to perform an operation.
                if ((toScheduler && !SyncronizationOptionForm.AllowRemoveAppointmentInScheduler) || (!toScheduler && !SyncronizationOptionForm.AllowRemoveAppointmentInOutlook))
                {
                    eventArgs.Cancel = true;
                    logInfo         += " (Operation canceled)";
                }
                break;

            case SynchronizeOperation.Replace:
                logInfo += (toScheduler ? "->Scheduler (Updating)" : "->Outlook (Updating)");
                logInfo += "\r\n";
                logInfo += String.Format("({0}) appointment - {1}", "Scheduler", appointmentInfoScheduler);
                logInfo += "\r\n";
                logInfo += String.Format("({0}) appointment - {1}", "Outlook   ", appointmentInfoOutlook);
                // Decide whether to perform an operation.
                if ((toScheduler && !SyncronizationOptionForm.AllowUpdateAppointmentInScheduler) || (!toScheduler && !SyncronizationOptionForm.AllowUpdateAppointmentInOutlook))
                {
                    eventArgs.Cancel = true;
                    logInfo         += " (Operation canceled)";
                }
                break;

            default:
                break;
            }
            memoEdit1.Text += logInfo + "\r\n";
        }