Ejemplo n.º 1
0
        public static Boolean GetConferenceApplications(ref ConferenceApplicationTDS AMainDS, Int64 AConferenceKey)
        {
            // make sure outreach codes are up to date in case it has changed in Unit record
            TAttendeeManagement.RefreshOutreachCode(AConferenceKey);

            TDataBase      db = DBAccess.Connect("GetConferenceApplications");
            TDBTransaction ReadTransaction = db.BeginTransaction(IsolationLevel.ReadCommitted);

            PcConferenceTable ConferenceTable = PcConferenceAccess.LoadByPrimaryKey(AConferenceKey, ReadTransaction);

            if (ConferenceTable.Count == 0)
            {
                ReadTransaction.Rollback();
                throw new Exception("Cannot find conference " + AConferenceKey.ToString("0000000000"));
            }

            string OutreachPrefix = ConferenceTable[0].OutreachPrefix;

            // load application data for all conference attendees from db
            TApplicationManagement.GetApplications(ref AMainDS, AConferenceKey, OutreachPrefix, "all", -1, true, null, false);

            // obtain PPartner records for all the home offices
            foreach (PcAttendeeRow AttendeeRow in AMainDS.PcAttendee.Rows)
            {
                if (AMainDS.PPartner.Rows.Find(new object[] { AttendeeRow.HomeOfficeKey }) == null)
                {
                    PPartnerAccess.LoadByPrimaryKey(AMainDS, AttendeeRow.HomeOfficeKey, ReadTransaction);
                }
            }

            ReadTransaction.Rollback();

            return(true);
        }
        public static Boolean GetConferenceApplications(ref ConferenceApplicationTDS AMainDS, Int64 AConferenceKey)
        {
            Boolean NewTransaction;

            // make sure outreach codes are up to date in case it has changed in Unit record
            TAttendeeManagement.RefreshOutreachCode(AConferenceKey);

            TDBTransaction ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(
                IsolationLevel.ReadCommitted,
                TEnforceIsolationLevel.eilMinimum,
                out NewTransaction);

            try
            {
                PcConferenceTable ConferenceTable = PcConferenceAccess.LoadByPrimaryKey(AConferenceKey, ReadTransaction);

                if (ConferenceTable.Count == 0)
                {
                    throw new Exception("Cannot find conference " + AConferenceKey.ToString());
                }

                string OutreachPrefix = ConferenceTable[0].OutreachPrefix;

                // load application data for all conference attendees from db
                TApplicationManagement.GetApplications(ref AMainDS, AConferenceKey, OutreachPrefix, "all", -1, true, null, false);

                // obtain PPartner records for all the home offices
                foreach (PcAttendeeRow AttendeeRow in AMainDS.PcAttendee.Rows)
                {
                    if (AMainDS.PPartner.Rows.Find(new object[] { AttendeeRow.HomeOfficeKey }) == null)
                    {
                        PPartnerAccess.LoadByPrimaryKey(AMainDS, AttendeeRow.HomeOfficeKey, ReadTransaction);
                    }
                }
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TConferenceDataReaderWebConnector.GetConferenceApplications: commit own transaction.");
                }
            }

            return(true);
        }