private void InitializeManualCode()
        {
            if (!FMainDS.Tables.Contains(PartnerEditTDSPPartnerInterestTable.GetTableName()))
            {
                FMainDS.Tables.Add(new PartnerEditTDSPPartnerInterestTable());
            }

            FMainDS.InitVars();
        }
Esempio n. 2
0
        private PartnerEditTDSPPartnerInterestTable GetPartnerInterestsInternal(out Int32 ACount, Boolean ACountOnly)
        {
            TDBTransaction ReadTransaction;
            Boolean NewTransaction = false;
            PartnerEditTDSPPartnerInterestTable PartnerInterestDT;
            PInterestTable InterestDT;
            DataRow InterestRow;
            int ItemsCountInterests;

            PartnerInterestDT = new PartnerEditTDSPPartnerInterestTable();
            try
            {
                ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead,
                    TEnforceIsolationLevel.eilMinimum,
                    out NewTransaction);

                if (ACountOnly)
                {
                    ACount = PPartnerInterestAccess.CountViaPPartner(FPartnerKey, ReadTransaction);
                }
                else
                {
//                  TLogging.LogAtLevel(7, "TPartnerEditUIConnector.GetPartnerInterestsInternal: loading Interests for Partner " + FPartnerKey.ToString() + "...");
                    try
                    {
                        PartnerInterestDT.Merge(PPartnerInterestAccess.LoadViaPPartner(FPartnerKey, ReadTransaction));
                        InterestDT = GetInterestsInternal(out ItemsCountInterests, false);

                        // fill field for interest category in PartnerInterest table in dataset
                        foreach (PartnerEditTDSPPartnerInterestRow row in PartnerInterestDT.Rows)
                        {
                            InterestRow = InterestDT.Rows.Find(new object[] { row.Interest });

                            if (InterestRow != null)
                            {
                                row.InterestCategory = ((PInterestRow)InterestRow).Category;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    ACount = PartnerInterestDT.Rows.Count;
                }
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TPartnerEditUIConnector.GetPartnerInterestsInternal: committed own transaction.");
                }
            }
            return PartnerInterestDT;
        }