示例#1
0
        public void LoadByContactId(int ContactId)
        {
            DataSet ds = new atriumDB();

            PreRefresh();
            myA.GetAttendee().PreRefresh();

            if (myA.AtMng.AppMan.UseService)
            {
                ds = BEManager.DecompressDataSet(myA.AtMng.AppMan.AtriumX().AppointmentLoadByContactId(ContactId, myA.AtMng.AppMan.AtriumXCon), ds);
            }
            else
            {
                try
                {
                    ds = BEManager.DecompressDataSet(myDAL.LoadAllForOfficer(ContactId), ds);
                }
                catch (System.Runtime.Serialization.SerializationException x)
                {
                    RecoverDAL();
                    ds = BEManager.DecompressDataSet(myDAL.LoadAllForOfficer(ContactId), ds);
                }
            }
            Fill(ds.Tables["Appointment"]);
            myA.GetApptRecurrence().Fill(ds.Tables["ApptRecurrence"]);
            myA.GetAttendee().Fill(ds.Tables["Attendee"]);
            SetLocalDates();
            ds.Clear();
            ds.Dispose();
        }
示例#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();
            }
        }