Exemplo n.º 1
0
        protected override void AfterAdd(DataRow row)
        {
            atriumDB.ApptRecurrenceRow dr = (atriumDB.ApptRecurrenceRow)row;
            string ObjectName             = this.myApptRecurrenceDT.TableName;

            dr.ApptRecurrenceId = myA.AtMng.PKIDGet(ObjectName, 10);
        }
Exemplo n.º 2
0
        protected override void BeforeUpdate(DataRow dr)
        {
            atriumDB.ApptRecurrenceRow drApptRecurrence = (atriumDB.ApptRecurrenceRow)dr;

            DataRow[] apptRows = myA.DB.Appointment.Select("ApptRecurrenceId=" + drApptRecurrence.ApptRecurrenceId.ToString() + " AND OriginalRecurrence='True'");
            if (apptRows.Length > 0)
            {
                originalApptRow = (atriumDB.AppointmentRow)apptRows[0];

                atriumDB.AppointmentRow[] appdt = originalApptRow.ApptRecurrenceRow.GetAppointmentRows();
                foreach (atriumDB.AppointmentRow apptRow in appdt)
                {
                    if (originalApptRow.ApptId != apptRow.ApptId)
                    {
                        atriumDB.AttendeeRow[] attRows = apptRow.GetAttendeeRows();
                        foreach (atriumDB.AttendeeRow attRow in attRows)
                        {
                            attRow.Delete();
                        }
                        apptRow.Delete();
                    }
                }
                if (drApptRecurrence.RecurrenceRemoved)
                {
                    //  originalApptRow.SetApptRecurrenceIdNull();
                    originalApptRow.OriginalRecurrence = false;
                    //drApptRecurrence.Delete();
                }
                else
                {
                    CreateRecurrenceAppointments(originalApptRow);
                }
            }
        }
Exemplo n.º 3
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();
            }
        }