public static PartnerEditTDS CreateNewPartner( string APartnerClass, out List <string> ASubscriptions, out List <string> APartnerTypes, out string ADefaultEmailAddress, out string ADefaultPhoneMobile, out string ADefaultPhoneLandline) { TPartnerEditUIConnector partneredit = new TPartnerEditUIConnector(); string TmpSiteCountryCode; Int64 SiteKey = DomainManager.GSiteKey; PartnerEditTDS MainDS = partneredit.GetDataNewPartner( SiteKey, NewPartnerKey(), SharedTypes.PartnerClassStringToEnum(APartnerClass), String.Empty, String.Empty, false, -1, -1, -1, out TmpSiteCountryCode); MainDS.PPartner[0].ReceiptLetterFrequency = "Annual"; PLocationRow location = MainDS.PLocation.NewRowTyped(); location.SiteKey = SiteKey; // TODO: read country code from SystemDefaults table location.CountryCode = "DE"; location.LocationKey = -1; MainDS.PLocation.Rows.Add(location); TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction(ref Transaction, delegate { PCountryAccess.LoadAll(MainDS, Transaction); PPublicationAccess.LoadAll(MainDS, Transaction); PPartnerStatusAccess.LoadAll(MainDS, Transaction); PTypeRow templateRow = MainDS.PType.NewRowTyped(); templateRow.SystemType = false; templateRow.SetTypeDeletableNull(); templateRow.SetDateCreatedNull(); PTypeAccess.LoadUsingTemplate(MainDS, templateRow, Transaction); }); APartnerTypes = new List <string>(); ASubscriptions = new List <string>(); ADefaultEmailAddress = String.Empty; ADefaultPhoneMobile = String.Empty; ADefaultPhoneLandline = String.Empty; return(MainDS); }
/// <summary> /// link the fields in the current ledger /// </summary> /// <param name="AFieldCSVFile"></param> public static void GenerateFieldsFinanceOnly(string AFieldCSVFile) { XmlDocument doc = TCsv2Xml.ParseCSV2Xml(AFieldCSVFile, ","); XmlNode RecordNode = doc.FirstChild.NextSibling.FirstChild; GLSetupTDS GLSetupDS = new GLSetupTDS(); PCountryTable CountryTable = null; TDBTransaction Transaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { CountryTable = PCountryAccess.LoadAll(Transaction); }); while (RecordNode != null) { long id = 100 + Convert.ToInt64(TXMLParser.GetAttribute(RecordNode, "id")); string CountryCode = TXMLParser.GetAttribute(RecordNode, "Name"); string UnitName = ((PCountryRow)CountryTable.Rows.Find(CountryCode)).CountryName; Int64 PartnerKey = id * 1000000; // create cost centre ACostCentreRow CostCentreRow = GLSetupDS.ACostCentre.NewRowTyped(); CostCentreRow.LedgerNumber = FLedgerNumber; CostCentreRow.CostCentreCode = (id * 100).ToString("0000"); CostCentreRow.CostCentreName = UnitName; CostCentreRow.CostCentreToReportTo = MFinanceConstants.INTER_LEDGER_HEADING; CostCentreRow.CostCentreType = MFinanceConstants.FOREIGN_CC_TYPE; GLSetupDS.ACostCentre.Rows.Add(CostCentreRow); // create foreign ledger, cost centre link validledgernumber AValidLedgerNumberRow ValidLedgerNumber = GLSetupDS.AValidLedgerNumber.NewRowTyped(); ValidLedgerNumber.LedgerNumber = FLedgerNumber; ValidLedgerNumber.PartnerKey = PartnerKey; ValidLedgerNumber.CostCentreCode = CostCentreRow.CostCentreCode; ValidLedgerNumber.IltProcessingCentre = Convert.ToInt64(MFinanceConstants.ICH_COST_CENTRE) * 10000; GLSetupDS.AValidLedgerNumber.Rows.Add(ValidLedgerNumber); RecordNode = RecordNode.NextSibling; } GLSetupTDSAccess.SubmitChanges(GLSetupDS); }
public static void GetData(string ATablename, TSearchCriteria[] ASearchCriteria, out TTypedDataTable AResultTable, TDBTransaction AReadTransaction) { AResultTable = null; string context = string.Format("GetData {0}", SharedConstants.MODULE_ACCESS_MANAGER); // check access permissions for the current user TModuleAccessManager.CheckUserPermissionsForTable(ATablename, TTablePermissionEnum.eCanRead); // TODO: auto generate if (ATablename == AApSupplierTable.GetTableDBName()) { AResultTable = AApSupplierAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == AApDocumentTable.GetTableDBName()) { AResultTable = AApDocumentAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == ATransactionTypeTable.GetTableDBName()) { AResultTable = ATransactionTypeAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == ACurrencyTable.GetTableDBName()) { AResultTable = ACurrencyAccess.LoadAll(AReadTransaction); } else if (ATablename == ADailyExchangeRateTable.GetTableDBName()) { AResultTable = ADailyExchangeRateAccess.LoadAll(AReadTransaction); } else if (ATablename == ACorporateExchangeRateTable.GetTableDBName()) { AResultTable = ACorporateExchangeRateAccess.LoadAll(AReadTransaction); } else if (ATablename == ACurrencyLanguageTable.GetTableDBName()) { AResultTable = ACurrencyLanguageAccess.LoadAll(AReadTransaction); } else if (ATablename == AFeesPayableTable.GetTableDBName()) { AResultTable = AFeesPayableAccess.LoadAll(AReadTransaction); } else if (ATablename == AFeesReceivableTable.GetTableDBName()) { AResultTable = AFeesReceivableAccess.LoadAll(AReadTransaction); } else if (ATablename == AAnalysisTypeTable.GetTableDBName()) { AResultTable = AAnalysisTypeAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == AGiftBatchTable.GetTableDBName()) { AResultTable = AGiftBatchAccess.LoadAll(AReadTransaction); } else if (ATablename == AJournalTable.GetTableDBName()) { AResultTable = AJournalAccess.LoadAll(AReadTransaction); } else if (ATablename == ALedgerTable.GetTableDBName()) { AResultTable = ALedgerAccess.LoadAll(AReadTransaction); } else if (ATablename == MExtractMasterTable.GetTableDBName()) { if (ASearchCriteria == null) { AResultTable = MExtractMasterAccess.LoadAll(AReadTransaction); } else { AResultTable = MExtractMasterAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } } else if (ATablename == MExtractTable.GetTableDBName()) { // it does not make sense to load ALL extract rows for all extract masters so search criteria needs to be set if (ASearchCriteria != null) { AResultTable = MExtractAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } } else if (ATablename == PcAttendeeTable.GetTableDBName()) { AResultTable = PcAttendeeAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcConferenceCostTable.GetTableDBName()) { AResultTable = PcConferenceCostAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcEarlyLateTable.GetTableDBName()) { AResultTable = PcEarlyLateAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcSupplementTable.GetTableDBName()) { AResultTable = PcSupplementAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PcDiscountTable.GetTableDBName()) { AResultTable = PcDiscountAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PCountryTable.GetTableDBName()) { AResultTable = PCountryAccess.LoadAll(AReadTransaction); } else if (ATablename == PFormTable.GetTableDBName()) { string[] columns = TTypedDataTable.GetColumnStringList(PFormTable.TableId); StringCollection fieldList = new StringCollection(); for (int i = 0; i < columns.Length; i++) { // Do not load the template document - we don't display it and it is big! if (columns[i] != PFormTable.GetTemplateDocumentDBName()) { fieldList.Add(columns[i]); } } AResultTable = PFormAccess.LoadAll(fieldList, AReadTransaction); } else if (ATablename == PInternationalPostalTypeTable.GetTableDBName()) { AResultTable = PInternationalPostalTypeAccess.LoadAll(AReadTransaction); } else if (ATablename == PtApplicationTypeTable.GetTableDBName()) { AResultTable = PtApplicationTypeAccess.LoadAll(AReadTransaction); } else if (ATablename == PFormalityTable.GetTableDBName()) { AResultTable = PFormalityAccess.LoadAll(AReadTransaction); } else if (ATablename == PMailingTable.GetTableDBName()) { AResultTable = PMailingAccess.LoadAll(AReadTransaction); } else if (ATablename == PPartnerGiftDestinationTable.GetTableDBName()) { AResultTable = PPartnerGiftDestinationAccess.LoadUsingTemplate(ASearchCriteria, AReadTransaction); } else if (ATablename == PmDocumentTypeTable.GetTableDBName()) { AResultTable = PmDocumentTypeAccess.LoadAll(AReadTransaction); } else if (ATablename == SGroupTable.GetTableDBName()) { TSecurityChecks.CheckUserModulePermissions(SharedConstants.PETRAMODULE_SYSADMIN, context); AResultTable = SGroupAccess.LoadAll(AReadTransaction); } else if (ATablename == SSystemDefaultsTable.GetTableDBName()) { TSecurityChecks.CheckUserModulePermissions(SharedConstants.PETRAMODULE_SYSADMIN, context); AResultTable = SSystemDefaultsAccess.LoadAll(AReadTransaction); } else if (ATablename == SSystemDefaultsGuiTable.GetTableDBName()) { AResultTable = SSystemDefaultsGuiAccess.LoadAll(AReadTransaction); } else { throw new Exception("TCommonDataReader.GetData: unknown table " + ATablename); } // Accept row changes here so that the Client gets 'unmodified' rows AResultTable.AcceptChanges(); }
/// <summary> /// generate the units /// </summary> /// <param name="AFieldCSVFile"></param> public static void GenerateFields(string AFieldCSVFile) { XmlDocument doc = TCsv2Xml.ParseCSVFile2Xml(AFieldCSVFile, ","); XmlNode RecordNode = doc.FirstChild.NextSibling.FirstChild; PartnerImportExportTDS PartnerDS = new PartnerImportExportTDS(); GLSetupTDS GLSetupDS = new GLSetupTDS(); PCountryTable CountryTable = null; TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction( ref Transaction, delegate { CountryTable = PCountryAccess.LoadAll(Transaction); }); while (RecordNode != null) { PUnitRow UnitRow = PartnerDS.PUnit.NewRowTyped(); long id = 100 + Convert.ToInt64(TXMLParser.GetAttribute(RecordNode, "id")); UnitRow.PartnerKey = id * 1000000; string CountryCode = TXMLParser.GetAttribute(RecordNode, "Name"); UnitRow.UnitName = ((PCountryRow)CountryTable.Rows.Find(CountryCode)).CountryName; UnitRow.UnitTypeCode = "F"; PartnerDS.PUnit.Rows.Add(UnitRow); PPartnerRow PartnerRow = PartnerDS.PPartner.NewRowTyped(); PartnerRow.PartnerKey = UnitRow.PartnerKey; PartnerRow.PartnerShortName = UnitRow.UnitName; PartnerRow.PartnerClass = MPartnerConstants.PARTNERCLASS_UNIT; PartnerRow.StatusCode = MPartnerConstants.PARTNERSTATUS_ACTIVE; PartnerDS.PPartner.Rows.Add(PartnerRow); // add empty location so that the partner can be found in the Partner Find screen PPartnerLocationRow PartnerLocationRow = PartnerDS.PPartnerLocation.NewRowTyped(); PartnerLocationRow.PartnerKey = UnitRow.PartnerKey; PartnerLocationRow.LocationKey = 0; PartnerLocationRow.SiteKey = 0; PartnerDS.PPartnerLocation.Rows.Add(PartnerLocationRow); // create unit hierarchy UmUnitStructureRow UnitStructureRow = PartnerDS.UmUnitStructure.NewRowTyped(); UnitStructureRow.ParentUnitKey = 1000000; UnitStructureRow.ChildUnitKey = UnitRow.PartnerKey; PartnerDS.UmUnitStructure.Rows.Add(UnitStructureRow); // create special type PPartnerTypeRow PartnerTypeRow = PartnerDS.PPartnerType.NewRowTyped(); PartnerTypeRow.PartnerKey = UnitRow.PartnerKey; PartnerTypeRow.TypeCode = MPartnerConstants.PARTNERTYPE_LEDGER; PartnerDS.PPartnerType.Rows.Add(PartnerTypeRow); // create cost centre ACostCentreRow CostCentreRow = GLSetupDS.ACostCentre.NewRowTyped(); CostCentreRow.LedgerNumber = FLedgerNumber; CostCentreRow.CostCentreCode = (id * 100).ToString("0000"); CostCentreRow.CostCentreName = UnitRow.UnitName; CostCentreRow.CostCentreToReportTo = MFinanceConstants.INTER_LEDGER_HEADING; CostCentreRow.CostCentreType = MFinanceConstants.FOREIGN_CC_TYPE; GLSetupDS.ACostCentre.Rows.Add(CostCentreRow); // create foreign ledger, cost centre link validledgernumber AValidLedgerNumberRow ValidLedgerNumber = GLSetupDS.AValidLedgerNumber.NewRowTyped(); ValidLedgerNumber.LedgerNumber = FLedgerNumber; ValidLedgerNumber.PartnerKey = UnitRow.PartnerKey; ValidLedgerNumber.CostCentreCode = CostCentreRow.CostCentreCode; ValidLedgerNumber.IltProcessingCentre = Convert.ToInt64(MFinanceConstants.ICH_COST_CENTRE) * 10000; GLSetupDS.AValidLedgerNumber.Rows.Add(ValidLedgerNumber); RecordNode = RecordNode.NextSibling; } PartnerImportExportTDSAccess.SubmitChanges(PartnerDS); GLSetupTDSAccess.SubmitChanges(GLSetupDS); }
public static PartnerEditTDS GetPartnerDetails(Int64 APartnerKey, out List <string> ASubscriptions, out List <string> APartnerTypes, out string ADefaultEmailAddress, out string ADefaultPhoneMobile, out string ADefaultPhoneLandline) { PartnerEditTDS MainDS = new PartnerEditTDS(); List <string> Subscriptions = new List <string>(); List <string> PartnerTypes = new List <string>(); string DefaultEmailAddress = String.Empty; string DefaultPhoneMobile = String.Empty; string DefaultPhoneLandline = String.Empty; TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction(ref Transaction, delegate { PPartnerAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); if (MainDS.PPartner.Rows.Count > 0) { switch (MainDS.PPartner[0].PartnerClass) { case MPartnerConstants.PARTNERCLASS_FAMILY: PFamilyAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_PERSON: PPersonAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_CHURCH: PChurchAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_ORGANISATION: POrganisationAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_BANK: PBankAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_UNIT: PUnitAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; } if (true) { PPartnerLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); } if (true) { PPartnerRelationshipAccess.LoadViaPPartnerPartnerKey(MainDS, APartnerKey, Transaction); } if (true) { PCountryAccess.LoadAll(MainDS, Transaction); } if (true) { PPublicationAccess.LoadAll(MainDS, Transaction); PSubscriptionAccess.LoadViaPPartnerPartnerKey(MainDS, APartnerKey, Transaction); foreach (PSubscriptionRow subscription in MainDS.PSubscription.Rows) { Subscriptions.Add(subscription.PublicationCode); } } PPartnerStatusAccess.LoadAll(MainDS, Transaction); PTypeAccess.LoadAll(MainDS, Transaction); PPartnerTypeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); foreach (PPartnerTypeRow partnertype in MainDS.PPartnerType.Rows) { PartnerTypes.Add(partnertype.TypeCode); } PPartnerAttributeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); foreach (PPartnerAttributeRow partnerattr in MainDS.PPartnerAttribute.Rows) { if (partnerattr.AttributeType == MPartnerConstants.ATTR_TYPE_EMAIL) { DefaultEmailAddress = partnerattr.Value; } else if (partnerattr.AttributeType == MPartnerConstants.ATTR_TYPE_PHONE) { DefaultPhoneLandline = partnerattr.Value; } else if (partnerattr.AttributeType == MPartnerConstants.ATTR_TYPE_MOBILE_PHONE) { DefaultPhoneMobile = partnerattr.Value; } } } }); APartnerTypes = PartnerTypes; ASubscriptions = Subscriptions; ADefaultEmailAddress = DefaultEmailAddress; ADefaultPhoneMobile = DefaultPhoneMobile; ADefaultPhoneLandline = DefaultPhoneLandline; return(MainDS); }
public static PartnerEditTDS GetPartnerDetails(Int64 APartnerKey, out List <string> ASubscriptions, out List <string> APartnerTypes, out string ADefaultEmailAddress, out string ADefaultPhoneMobile, out string ADefaultPhoneLandline) { PartnerEditTDS MainDS = new PartnerEditTDS(); List <string> Subscriptions = new List <string>(); List <string> PartnerTypes = new List <string>(); string DefaultEmailAddress = String.Empty; string DefaultPhoneMobile = String.Empty; string DefaultPhoneLandline = String.Empty; TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction(ref Transaction, delegate { PPartnerAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); if (MainDS.PPartner.Rows.Count > 0) { switch (MainDS.PPartner[0].PartnerClass) { case MPartnerConstants.PARTNERCLASS_FAMILY: PFamilyAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_PERSON: PPersonAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_CHURCH: PChurchAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_ORGANISATION: POrganisationAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_BANK: PBankAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; case MPartnerConstants.PARTNERCLASS_UNIT: PUnitAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); break; } if (true) { PPartnerLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); } if (true) { PPartnerRelationshipAccess.LoadViaPPartnerPartnerKey(MainDS, APartnerKey, Transaction); } if (true) { PCountryAccess.LoadAll(MainDS, Transaction); } if (true) { PPublicationAccess.LoadAll(MainDS, Transaction); PSubscriptionAccess.LoadViaPPartnerPartnerKey(MainDS, APartnerKey, Transaction); foreach (PSubscriptionRow subscription in MainDS.PSubscription.Rows) { Subscriptions.Add(subscription.PublicationCode); } } if (true) { PBankingDetailsAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerBankingDetailsAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PBankingDetailsUsageAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); foreach (PartnerEditTDSPBankingDetailsRow banking in MainDS.PBankingDetails.Rows) { PBankAccess.LoadByPrimaryKey(MainDS, banking.BankKey, Transaction); banking.Bic = MainDS.PBank[0].Bic; banking.BranchName = MainDS.PBank[0].BranchName; banking.Iban = FormatIBAN(banking.Iban); MainDS.PBank.Rows.Clear(); } foreach (PartnerEditTDSPBankingDetailsRow bd in MainDS.PBankingDetails.Rows) { bd.MainAccount = (MainDS.PBankingDetailsUsage.Rows.Find( new object[] { APartnerKey, bd.BankingDetailsKey, MPartnerConstants.BANKINGUSAGETYPE_MAIN }) != null); } MainDS.PBankingDetailsUsage.Rows.Clear(); } PPartnerStatusAccess.LoadAll(MainDS, Transaction); PTypeRow templateRow = MainDS.PType.NewRowTyped(); templateRow.SystemType = false; templateRow.SetTypeDeletableNull(); templateRow.SetDateCreatedNull(); PTypeAccess.LoadUsingTemplate(MainDS, templateRow, Transaction); PPartnerTypeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); foreach (PPartnerTypeRow partnertype in MainDS.PPartnerType.Rows) { PartnerTypes.Add(partnertype.TypeCode); } PPartnerAttributeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); foreach (PPartnerAttributeRow partnerattr in MainDS.PPartnerAttribute.Rows) { if (partnerattr.AttributeType == MPartnerConstants.ATTR_TYPE_EMAIL) { DefaultEmailAddress = partnerattr.Value; } else if (partnerattr.AttributeType == MPartnerConstants.ATTR_TYPE_PHONE) { DefaultPhoneLandline = partnerattr.Value; } else if (partnerattr.AttributeType == MPartnerConstants.ATTR_TYPE_MOBILE_PHONE) { DefaultPhoneMobile = partnerattr.Value; } } } }); APartnerTypes = PartnerTypes; ASubscriptions = Subscriptions; ADefaultEmailAddress = DefaultEmailAddress; ADefaultPhoneMobile = DefaultPhoneMobile; ADefaultPhoneLandline = DefaultPhoneLandline; return(MainDS); }
/// <summary> /// Parses certain p_partner_location data columns' content into a data structure that is p_parnter_attribute /// representation. /// </summary> /// <remarks>Similar to code found in \csharp\ICT\BuildTools\DataDumpPetra2\FixData.cs, Method 'FixData', /// in the code section that starts with the comment 'Process p_partner_location records and migrate certain values /// of p_partner_location records to 'Contact Detail' records'.</remarks> /// <param name="AMainDS">Typed DataSet that holds the p_partner_location records that are to be parsed.</param> /// <param name="ATransaction">Instantiated DB Transaction.</param> public static void ParsePartnerLocationsForContactDetails(PartnerImportExportTDS AMainDS, TDBTransaction ATransaction) { DataTable PartnerLocationsDT; DataRow NewPartnerLocationDR; string TelephoneNumber = String.Empty; string FaxNumber = String.Empty; string PhoneExtension; string FaxExtension; // collect the partner classes foreach (PPartnerRow PartnerDR in AMainDS.PPartner.Rows) { TPartnerContactDetails.PartnerClassInformation[PartnerDR.PartnerKey] = PartnerDR.PartnerClass; } SortedList <long, DataTable> PartnerLocationsTables = new SortedList <long, DataTable>(); for (int counter = 0; counter < TPartnerContactDetails.NumberOfTables; counter++) { PartnerLocationsTables[counter] = TPartnerContactDetails.BestAddressHelper.GetNewPPartnerLocationTableInstance(); } TPartnerContactDetails.PartnerLocationRecords = PartnerLocationsTables; foreach (PPartnerLocationRow PartnerLocationDR in AMainDS.PPartnerLocation.Rows) { PartnerLocationsDT = PartnerLocationsTables[Math.Abs(PartnerLocationDR.PartnerKey) % TPartnerContactDetails.NumberOfTables]; DataRow LocationDR = AMainDS.PLocation.Rows.Find(new object[] { PartnerLocationDR.SiteKey, PartnerLocationDR.LocationKey }); // Phone Extension: Ignore if value in the dumped data is either null or 0 if (PartnerLocationDR.IsExtensionNull()) { PhoneExtension = String.Empty; } PhoneExtension = PartnerLocationDR.Extension.ToString(); if (PhoneExtension == "0") { PhoneExtension = String.Empty; } // Fax Extension: Ignore if value in the dumped data is either null or 0 if (PartnerLocationDR.IsFaxExtensionNull()) { FaxExtension = String.Empty; } FaxExtension = PartnerLocationDR.FaxExtension.ToString(); if (FaxExtension == "0") { FaxExtension = String.Empty; } if (!PartnerLocationDR.IsTelephoneNumberNull()) { // Concatenate Phone Number and Phone Extension ONLY if both of them aren't null and Phone Extension isn't 0 either. TelephoneNumber = PartnerLocationDR.TelephoneNumber + PhoneExtension; } if (!PartnerLocationDR.IsFaxNumberNull()) { // Concatenate Fax Number and Fax Extension ONLY if both of them aren't null and Fax Extension isn't 0 either. FaxNumber = PartnerLocationDR.FaxNumber + FaxExtension; } // Create representation of key data of the p_partner_location row and add it to the TPartnerContactDetails.PartnerLocationRecords Data Structure NewPartnerLocationDR = PartnerLocationsDT.NewRow(); NewPartnerLocationDR["p_partner_key_n"] = PartnerLocationDR.PartnerKey; NewPartnerLocationDR["p_site_key_n"] = PartnerLocationDR.SiteKey; NewPartnerLocationDR["p_location_key_i"] = PartnerLocationDR.LocationKey; if (!PartnerLocationDR.IsDateEffectiveNull()) { NewPartnerLocationDR["p_date_effective_d"] = PartnerLocationDR.DateEffective; } else { PartnerLocationDR.SetDateEffectiveNull(); } if (!PartnerLocationDR.IsDateGoodUntilNull()) { NewPartnerLocationDR["p_date_good_until_d"] = PartnerLocationDR.DateGoodUntil; } else { PartnerLocationDR.SetDateGoodUntilNull(); } NewPartnerLocationDR["p_location_type_c"] = PartnerLocationDR.LocationType; NewPartnerLocationDR["p_send_mail_l"] = PartnerLocationDR.SendMail; NewPartnerLocationDR["p_telephone_number_c"] = TelephoneNumber; NewPartnerLocationDR["p_fax_number_c"] = FaxNumber; NewPartnerLocationDR["p_mobile_number_c"] = PartnerLocationDR.MobileNumber; NewPartnerLocationDR["p_alternate_telephone_c"] = PartnerLocationDR.AlternateTelephone; NewPartnerLocationDR["p_email_address_c"] = PartnerLocationDR.EmailAddress; NewPartnerLocationDR["p_url_c"] = PartnerLocationDR.Url; NewPartnerLocationDR["p_value_country_c"] = LocationDR["p_country_code_c"]; PartnerLocationsDT.Rows.Add(NewPartnerLocationDR); } // get data for entire country table PCountryTable CountryTable = PCountryAccess.LoadAll(ATransaction); string InternatAccessCode = null; string SiteCountryCode = TAddressTools.GetCountryCodeFromSiteLedger(ATransaction); DataRow SiteCountryRow = CountryTable.Rows.Find(SiteCountryCode); // get InternatAccessCode for site country if (SiteCountryRow != null) { InternatAccessCode = SiteCountryRow[PCountryTable.GetInternatAccessCodeDBName()].ToString(); } TPartnerContactDetails.CreateContactDetailsRow = CreatePartnerContactDetailRecord; TPartnerContactDetails.EmptyStringIndicator = String.Empty; TPartnerContactDetails.PartnerAttributeHoldingDataSet = AMainDS; TPartnerContactDetails.CountryTable = CountryTable; TPartnerContactDetails.SiteCountryCode = SiteCountryCode; TPartnerContactDetails.SiteInternatAccessCode = InternatAccessCode; TPartnerContactDetails.PopulatePPartnerAttribute(); Ict.Petra.Shared.MPartner.Calculations.DeterminePartnerContactDetailAttributes(AMainDS.PPartnerAttribute); }