/// create a new church
        public static PPartnerRow CreateNewChurchPartner(PartnerEditTDS AMainDS)
        {
            PPartnerRow PartnerRow = CreateNewPartner(AMainDS);

            // make sure denomation "UNKNOWN" exists as this is the default value
            if (!PDenominationAccess.Exists("UNKNOWN", DBAccess.GDBAccessObj.Transaction))
            {
                PDenominationTable DenominationTable = new PDenominationTable();
                PDenominationRow   DenominationRow   = DenominationTable.NewRowTyped();
                DenominationRow.DenominationCode = "UNKNOWN";
                DenominationRow.DenominationName = "Unknown";
                DenominationTable.Rows.Add(DenominationRow);
                PDenominationAccess.SubmitChanges(DenominationTable, DBAccess.GDBAccessObj.Transaction);
            }

            PartnerRow.PartnerClass     = MPartnerConstants.PARTNERCLASS_CHURCH;
            PartnerRow.PartnerShortName = PartnerRow.PartnerKey.ToString() + ", TestChurch";

            PChurchRow ChurchRow = AMainDS.PChurch.NewRowTyped();

            ChurchRow.PartnerKey       = PartnerRow.PartnerKey;
            ChurchRow.ChurchName       = "TestChurch";
            ChurchRow.DenominationCode = "UNKNOWN";
            AMainDS.PChurch.Rows.Add(ChurchRow);

            return(PartnerRow);
        }
Пример #2
0
        /// create a new church
        public static PPartnerRow CreateNewChurchPartner(PartnerEditTDS AMainDS, TDataBase ADataBase = null)
        {
            PPartnerRow    PartnerRow  = CreateNewPartner(AMainDS, ADataBase);
            TDataBase      db          = DBAccess.Connect("CreateNewChurchPartner", ADataBase);
            TDBTransaction Transaction = db.BeginTransaction(IsolationLevel.Serializable);

            // make sure denomination "UNKNOWN" exists as this is the default value
            if (!PDenominationAccess.Exists("UNKNOWN", Transaction))
            {
                PDenominationTable DenominationTable = new PDenominationTable();
                PDenominationRow   DenominationRow   = DenominationTable.NewRowTyped();
                DenominationRow.DenominationCode = "UNKNOWN";
                DenominationRow.DenominationName = "Unknown";
                DenominationTable.Rows.Add(DenominationRow);
                PDenominationAccess.SubmitChanges(DenominationTable, Transaction);
                Transaction.Commit();
            }
            else
            {
                Transaction.Rollback();
            }

            PartnerRow.PartnerClass     = MPartnerConstants.PARTNERCLASS_CHURCH;
            PartnerRow.PartnerShortName = PartnerRow.PartnerKey.ToString() + ", TestChurch";

            PChurchRow ChurchRow = AMainDS.PChurch.NewRowTyped();

            ChurchRow.PartnerKey       = PartnerRow.PartnerKey;
            ChurchRow.ChurchName       = "TestChurch";
            ChurchRow.DenominationCode = "UNKNOWN";
            AMainDS.PChurch.Rows.Add(ChurchRow);

            return(PartnerRow);
        }