Ejemplo n.º 1
0
        private void AddRecurringAppointment()
        {
            atriumDB.AppointmentRow newApptRow;
            atriumDB.AttendeeRow    newAttRow;

            newApptRow        = (atriumDB.AppointmentRow)myA.GetAppointment().Add(null);
            newApptRow.FileId = originalApptRow.FileId;
            if (!originalApptRow.IsActivityIdNull())
            {
                newApptRow.ActivityId = originalApptRow.ActivityId;
            }
            newApptRow.StartDateLocal = trackDate;
            newApptRow.EndDateLocal   = trackDate + tsAppointmentLength;
            if (!originalApptRow.IsTypeNull())
            {
                newApptRow.Type = originalApptRow.Type;
            }
            if (!originalApptRow.IsSubjectNull())
            {
                newApptRow.Subject = originalApptRow.Subject;
            }
            newApptRow.ShowAsBusy  = originalApptRow.ShowAsBusy;
            newApptRow.AllDayEvent = originalApptRow.AllDayEvent;
            if (!originalApptRow.IsDescriptionNull())
            {
                newApptRow.Description = originalApptRow.Description;
            }
            if (!originalApptRow.IsLocationNull())
            {
                newApptRow.Location = originalApptRow.Location;
            }
            newApptRow.Tentative        = originalApptRow.Tentative;
            newApptRow.Vacation         = originalApptRow.Vacation;
            newApptRow.ApptRecurrenceId = originalApptRow.ApptRecurrenceId;

            // add attendees to new recurring appointment
            foreach (atriumDB.AttendeeRow originalAttRow in originalAttRows)
            {
                newAttRow           = (atriumDB.AttendeeRow)myA.GetAttendee().Add(newApptRow);
                newAttRow.FileId    = originalAttRow.FileId;
                newAttRow.ContactId = originalAttRow.ContactId;
                newAttRow.Accepted  = originalAttRow.Accepted;
                newAttRow.Declined  = originalAttRow.Declined;
                newAttRow.Required  = originalAttRow.Required;
                newAttRow.Tentative = originalAttRow.Tentative;
            }
        }
Ejemplo n.º 2
0
        public override void Delete()
        {
            if (schedule1.CurrentAppointment != null)
            {
                atriumBE.FileManager contextFM = FM.AtMng.GetFile(CurrentRow().FileId);
                DataRow[]            drAppt    = contextFM.DB.Appointment.Select("ApptId=" + CurrentRow().ApptId.ToString());

                atriumDB.AppointmentRow apptRow; //= (atriumDB.AppointmentRow)drAppt[0];

                if (drAppt.Length > 0)
                {
                    apptRow = (atriumDB.AppointmentRow)drAppt[0];
                }
                else
                {
                    apptRow = contextFM.GetAppointment().Load(CurrentRow().ApptId);
                }

                if (apptRow.IsApptRecurrenceIdNull())
                {
                    if (UIHelper.ConfirmDelete())
                    {
                        atriumDB.AttendeeRow[] atrs = (atriumDB.AttendeeRow[])contextFM.DB.Attendee.Select("ApptID=" + apptRow.ApptId.ToString());
                        foreach (atriumDB.AttendeeRow atr in atrs)
                        {
                            atr.Delete();
                        }
                        apptRow.Delete();
                        Save(contextFM);
                        UpdateReminders();
                    }
                }
                else
                {
                    if (UIHelper.ConfirmDelete(Properties.Resources.UIDeleteAllRecurringAppointments + " " + Properties.Resources.UIConfirmDelete, "Deleting Multiple Appointments")) //Properties.Resources.ConfirmDeleteAppRecurrence))
                    {
                        if (apptRow.ApptRecurrenceRow == null)
                        {
                            DataRow[] drRecurr = contextFM.DB.ApptRecurrence.Select("ApptRecurrenceId=" + apptRow.ApptRecurrenceId.ToString());
                            if (drRecurr.Length > 0)
                            {
                                apptRow.ApptRecurrenceRow = (atriumDB.ApptRecurrenceRow)drRecurr[0];
                            }
                            else
                            {
                                apptRow.ApptRecurrenceRow = contextFM.GetApptRecurrence().Load(apptRow.ApptRecurrenceId);
                            }
                        }
                        atriumDB.AppointmentRow[]  appdt      = apptRow.ApptRecurrenceRow.GetAppointmentRows();
                        atriumDB.ApptRecurrenceRow apptrecRow = apptRow.ApptRecurrenceRow;
                        foreach (atriumDB.AppointmentRow ar in appdt)
                        {
                            atriumDB.AttendeeRow[] attRows = ar.GetAttendeeRows();
                            foreach (atriumDB.AttendeeRow attRow in attRows)
                            {
                                attRow.Delete();
                            }
                            ar.Delete();
                        }
                        apptrecRow.Delete();
                        Save(contextFM);
                        UpdateReminders();
                    }
                }
                //AddRecurrenceSymbol();
            }
        }