private static bool GetReceivingFieldsForOneConference(long AConferenceKey, ref DataTable AFieldsTable) { TDBTransaction ReadTransaction; Boolean NewTransaction = false; TLogging.LogAtLevel(9, "TConferenceOptions.GetReceivingFieldsForOneConference called!"); TDataBase db = DBAccess.Connect("GetReceivingFieldsForOneConference"); ReadTransaction = db.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead, out NewTransaction); try { String PartnerKeyDBName = PcAttendeeTable.GetPartnerKeyDBName(); PcAttendeeTable AttendeeTable; StringCollection FieldList = new StringCollection(); FieldList.Add(PartnerKeyDBName); AttendeeTable = PcAttendeeAccess.LoadViaPcConference(AConferenceKey, FieldList, ReadTransaction); foreach (DataRow Row in AttendeeTable.Rows) { long PartnerKey = (long)Row[PartnerKeyDBName]; GetReceivingFieldFromGiftDestination(PartnerKey, ref AFieldsTable); GetReceivingFieldFromShortTermTable(PartnerKey, ref AFieldsTable); } } finally { if (NewTransaction) { ReadTransaction.Commit(); TLogging.LogAtLevel(7, "TConferenceOptions.GetReceivingFieldsForOneConference: committed own transaction."); } } return(true); }
/// <summary> /// return a list of all applicants for a given event, /// but if AConferenceOrganisingOffice is false, /// consider only the registration office that the user has permissions for, ie. Module REG-00xx0000000 /// </summary> /// <param name="AMainDS"></param> /// <param name="AEventPartnerKey">The ConferenceKey</param> /// <param name="AEventCode">The OutreachPrefix</param> /// <param name="AApplicationStatus"></param> /// <param name="ARegistrationOffice">if -1, then show all offices that the user has permission for</param> /// <param name="AConferenceOrganisingOffice">if true, all offices are considered</param> /// <param name="ARole"></param> /// <param name="AClearJSONData"></param> /// <returns></returns> public static bool GetApplications( ref ConferenceApplicationTDS AMainDS, Int64 AEventPartnerKey, string AEventCode, string AApplicationStatus, Int64 ARegistrationOffice, bool AConferenceOrganisingOffice, string ARole, bool AClearJSONData) { TDBTransaction Transaction = null; ConferenceApplicationTDS MainDS = new ConferenceApplicationTDS(); DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction( IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { // load all attendees of this conference. // only load once: GetApplications might be called for several application stati if (MainDS.PcAttendee.Rows.Count == 0) { PcAttendeeRow templateAttendeeRow = MainDS.PcAttendee.NewRowTyped(false); templateAttendeeRow.ConferenceKey = AEventPartnerKey; PcAttendeeAccess.LoadUsingTemplate(MainDS, templateAttendeeRow, Transaction); MainDS.PcAttendee.DefaultView.Sort = PcAttendeeTable.GetPartnerKeyDBName(); } if (AConferenceOrganisingOffice && (ARegistrationOffice == -1)) { // avoid duplicates, who are registered by one office, but charged to another office GetApplications(ref MainDS, AEventCode, -1, AApplicationStatus, ARole, AClearJSONData, Transaction); } else { List <Int64> AllowedRegistrationOffices = GetRegistrationOfficeKeysOfUser(Transaction); foreach (Int64 RegistrationOffice in AllowedRegistrationOffices) { if ((ARegistrationOffice == RegistrationOffice) || (ARegistrationOffice == -1)) { GetApplications(ref MainDS, AEventCode, RegistrationOffice, AApplicationStatus, ARole, AClearJSONData, Transaction); } } } // required for DefaultView.Find MainDS.PmShortTermApplication.DefaultView.Sort = PmShortTermApplicationTable.GetStConfirmedOptionDBName() + "," + PmShortTermApplicationTable.GetPartnerKeyDBName(); MainDS.PmGeneralApplication.DefaultView.Sort = PmGeneralApplicationTable.GetPartnerKeyDBName() + "," + PmGeneralApplicationTable.GetApplicationKeyDBName() + "," + PmGeneralApplicationTable.GetRegistrationOfficeDBName(); MainDS.PDataLabelValuePartner.DefaultView.Sort = PDataLabelValuePartnerTable.GetDataLabelKeyDBName() + "," + PDataLabelValuePartnerTable.GetPartnerKeyDBName(); MainDS.PDataLabel.DefaultView.Sort = PDataLabelTable.GetTextDBName(); }); AMainDS = MainDS; if (AMainDS.HasChanges()) { AMainDS.EnforceConstraints = false; AMainDS.AcceptChanges(); } return(true); }
private long GetPartnerKeySelected() { return(Convert.ToInt64(((DataRowView)grdAttendees.SelectedDataRows[0]).Row[PcAttendeeTable.GetPartnerKeyDBName()])); }