Example #1
0
        protected override void BeforeUpdate(DataRow dr)
        {
            BeforeChange("Subject", dr);

            atriumDB.AppointmentRow apptRow = (atriumDB.AppointmentRow)dr;

            if (!apptRow.IsIntervalNull())
            {
                officeDB.OfficerRow workingas = myA.AtMng.WorkingAsOfficer;
                foreach (atriumDB.AttendeeRow att in apptRow.GetAttendeeRows())
                {
                    if (att.ContactId == workingas.OfficerId || att.RowState == DataRowState.Added)
                    {
                        att.Interval            = apptRow.Interval;
                        att.NotificationDismiss = false;
                    }
                }
            }

            //if (!apptRow.IsApptRecurrenceIdNull() && apptRow.OriginalRecurrence == true)
            //{
            //    apptRow.ApptRecurrenceRow.updateDate = DateTime.Now;
            //}
            if (!apptRow.IsApptRecurrenceIdNull())
            {
                if (apptRow.ApptRecurrenceRow.RecurrenceRemoved)
                {
                    apptRow.ApptRecurrenceRow.Delete();
                    apptRow.SetApptRecurrenceIdNull();
                    myA.DB.ApptRecurrence.AcceptChanges();
                }
            }
        }
Example #2
0
        private void CreateRecurrenceAppointments(atriumDB.AppointmentRow apptRow)
        {
            originalApptRow = apptRow;

            originalAttRows = originalApptRow.GetAttendeeRows();
            trackDate       = originalApptRow.StartDateLocal;

            DateTime tmpDateTime = apptRow.ApptRecurrenceRow.EndRangeDate.DateTime;

            tmpDateTime         = tmpDateTime.AddHours(trackDate.TimeOfDay.Hours);
            recurrenceEndDate   = tmpDateTime;
            occursEvery         = apptRow.ApptRecurrenceRow.OccursEvery;
            tsAppointmentLength = originalApptRow.EndDateLocal - originalApptRow.StartDateLocal;

            switch (originalApptRow.ApptRecurrenceRow.ApptRecurrenceTypeId)
            {
            case 0:
                AddRecurrenceAppointmentDaily();
                break;

            case 1:
                AddRecurrenceAppointmentWeekly();
                break;

            case 2:
                AddRecurrenceAppointmentMonthly();
                break;

            default:
                // do nothing
                break;
            }
        }
Example #3
0
 /// <summary>
 /// This method is used to sync bf records between datasets
 /// It only works after the bf has been saved and committed
 /// </summary>
 /// <param name="abfr"></param>
 public void SyncAppointment(atriumDB.AppointmentRow apptRow, bool forDelete)
 {
     //see if bf is loaded
     atriumDB.AppointmentRow apptRowToSync = DB.Appointment.FindByApptId(apptRow.ApptId);
     if (apptRowToSync != null)
     {
         if (apptRowToSync.RowState == DataRowState.Unchanged)
         {
             if (forDelete)
             {
                 try
                 {
                     apptRowToSync.Delete();
                 }
                 catch (Exception x)
                 {
                     apptRowToSync.RowError = "";
                 }
                 apptRowToSync.AcceptChanges();
             }
             else
             {
                 //if it is sync it
                 GetAppointment().Load(apptRow.ApptId);
                 if (IsVirtualFM && apptRowToSync.GetAttendeeRows().Length > apptRow.GetAttendeeRows().Length)
                 {
                     //an attendee must have been deleted
                     foreach (atriumDB.AttendeeRow atrd in apptRowToSync.GetAttendeeRows())
                     {
                         atrd.Delete();
                     }
                     DB.Attendee.AcceptChanges();
                 }
                 GetAttendee().LoadByApptId(apptRow.ApptId);
                 if (apptRow.OriginalRecurrence)
                 {
                     GetApptRecurrence().Load(apptRow.ApptRecurrenceId);
                 }
             }
         }
     }
     else
     {
         //load it
         atriumDB.AppointmentRow appr = (atriumDB.AppointmentRow)GetAppointment().Load(apptRow.ApptId);
         GetAttendee().LoadByApptId(appr.ApptId);
         if (appr.OriginalRecurrence)
         {
             GetApptRecurrence().Load(appr.ApptRecurrenceId);
         }
         //check to see if bflistofficer is an attendee
         atriumDB.AttendeeRow[] attrs = (atriumDB.AttendeeRow[])DB.Attendee.Select("ApptId=" + appr.ApptId.ToString() + " and ContactId=" + BfListOfficerId.ToString());
         if (attrs.Length > 0)
         {
             //ok 2 keep
         }
         else
         {
             try
             {
                 appr.Delete();
             }
             catch (Exception x)
             {
                 //do nothing
                 appr.RowError = "";
             }
             appr.AcceptChanges();
         }
     }
 }