コード例 #1
0
 /// <summary>
 /// Retrieves PartnerAttribute information.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 /// <param name="AReadTransaction">Open Database Transaction.</param>
 private static void PartnerAttributesInternal(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS,
                                               TDBTransaction AReadTransaction)
 {
     /*
      * Load PartnerAttribute Information; this gets merged into the already retrieved
      * information in APartnerInfoDS (eg. 'Head' data)
      */
     APartnerInfoDS.Merge(PPartnerAttributeAccess.LoadViaPPartner(APartnerKey, AReadTransaction));
 }
コード例 #2
0
 /// <summary>
 /// Retrieves PartnerLocation information.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
 /// <param name="ALocationKey" >Location Key of the Location that the information should be
 /// retrieved for.</param>
 /// <param name="AReadTransaction">Open Database Transaction.</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 private static void PartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
                                             TDBTransaction AReadTransaction,
                                             ref PartnerInfoTDS APartnerInfoDS)
 {
     /*
      * Load PartnerLocation Information; this gets merged into the already retrieved
      * information in APartnerInfoDS (eg. 'Head' data)
      */
     APartnerInfoDS.Merge(TPPartnerAddressAggregate.LoadByPrimaryKey(
                              APartnerKey, ALocationKey.SiteKey, ALocationKey.LocationKey, AReadTransaction));
 }
コード例 #3
0
        /// <summary>
        /// Retrieves 'Rest' of Partner Information data.
        /// </summary>
        /// <param name="APartnerDR">DataRow that contains the Partner data.</param>
        /// <param name="AReadTransaction" >Open DB Transaction.</param>
        /// <param name="APartnerInfoDS" >Typed PartnerInfoTDS DataSet</param>
        private static void RestInternal(PPartnerRow APartnerDR,
            TDBTransaction AReadTransaction,
            ref PartnerInfoTDS APartnerInfoDS)
        {
            PartnerInfoTDSPartnerAdditionalInfoRow PartnerInfoDR;
            TPartnerClass PartnerClass;
            DateTime LastContactDate;
            PPersonTable PersonDT;
            PPartnerTable FamilyPartnerDT;
            Int64 PartnerKey = APartnerDR.PartnerKey;

            /*
             * Load Special Types
             */
            PPartnerTypeAccess.LoadViaPPartner(APartnerInfoDS, PartnerKey, AReadTransaction);


            /*
             * Load Subscriptions
             */
            PSubscriptionAccess.LoadViaPPartnerPartnerKey(APartnerInfoDS, PartnerKey, AReadTransaction);


            #region Populate PartnerAdditionalInfo Table

            if (APartnerInfoDS.PartnerAdditionalInfo.Rows.Count == 0)
            {
                PartnerInfoDR = APartnerInfoDS.PartnerAdditionalInfo.NewRowTyped(false);
            }
            else
            {
                PartnerInfoDR = APartnerInfoDS.PartnerAdditionalInfo[0];
            }

            if (!APartnerDR.IsCommentNull())
            {
                PartnerInfoDR.Notes = APartnerDR.Comment.Trim();
            }

            if (!APartnerDR.IsDateCreatedNull())
            {
                PartnerInfoDR.DateCreated = APartnerDR.DateCreated;
            }

            if (!APartnerDR.IsDateModifiedNull())
            {
                PartnerInfoDR.DateModified = APartnerDR.DateModified;
            }

            if (!APartnerDR.IsLanguageCodeNull())
            {
                PartnerInfoDR.MainLanguages = APartnerDR.LanguageCode;
            }

            if (!APartnerDR.IsPreviousNameNull())
            {
                PartnerInfoDR.PreviousName = APartnerDR.PreviousName;
            }

            // Determination of Last Contact Date
            TMailroom.GetLastContactDate(PartnerKey, out LastContactDate);
            PartnerInfoDR.LastContact = LastContactDate;


            /*
             * Special Data according to Partner Class
             */
            PartnerClass = SharedTypes.PartnerClassStringToEnum(APartnerDR.PartnerClass);

            switch (PartnerClass)
            {
                case TPartnerClass.PERSON:
                    PersonDT = PPersonAccess.LoadByPrimaryKey(APartnerDR.PartnerKey, AReadTransaction);

                    if (PersonDT != null)
                    {
                        if (!PersonDT[0].IsDateOfBirthNull())
                        {
                            PartnerInfoDR.DateOfBirth = PersonDT[0].DateOfBirth;
                        }

                        // Get Family Members info
                        APartnerInfoDS.Merge(GetFamilyMembers(PersonDT[0].FamilyKey, AReadTransaction));


                        // Get Family Partner info
                        FamilyPartnerDT = PPartnerAccess.LoadByPrimaryKey(PersonDT[0].FamilyKey, AReadTransaction);

                        if (FamilyPartnerDT != null)
                        {
                            PartnerInfoDR.Family = FamilyPartnerDT[0].PartnerShortName;
                            PartnerInfoDR.FamilyKey = FamilyPartnerDT[0].PartnerKey;
                        }

                        // Get the Languages of a Person from Personnel
                        PartnerInfoDR.AdditionalLanguages = GetPersonLanguagesFromPersonnel(
                            APartnerDR.PartnerKey, PartnerInfoDR.MainLanguages, AReadTransaction);
                    }

                    break;

                case TPartnerClass.FAMILY:

                    // Get Family Members info
                    APartnerInfoDS.Merge(GetFamilyMembers(PartnerKey, AReadTransaction));
                    break;

                case TPartnerClass.UNIT:

                    // Get Unit structure info
                    APartnerInfoDS.Merge(GetUnitStructure(PartnerKey, AReadTransaction));

                    break;
            }

            // Get Partners' PartnerAttributes
            PartnerAttributesInternal(PartnerKey, ref APartnerInfoDS, false);
            // TODO: Apply Contact Details Security

            if (APartnerInfoDS.PartnerAdditionalInfo.Rows.Count == 0)
            {
                APartnerInfoDS.PartnerAdditionalInfo.Rows.Add(PartnerInfoDR);
            }

            #endregion
        }
コード例 #4
0
 /// <summary>
 /// Retrieves PartnerAttribute information.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
 /// <param name="AReadTransaction">Open Database Transaction.</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 private static void PartnerAttributesInternal(Int64 APartnerKey, TDBTransaction AReadTransaction,
     ref PartnerInfoTDS APartnerInfoDS)
 {
     /*
      * Load PartnerAttribute Information; this gets merged into the already retrieved
      * information in APartnerInfoDS (eg. 'Head' data)
      */
     APartnerInfoDS.Merge(PPartnerAttributeAccess.LoadViaPPartner(APartnerKey, AReadTransaction));
 }
コード例 #5
0
 /// <summary>
 /// Retrieves PartnerLocation information.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
 /// <param name="ALocationKey" >Location Key of the Location that the information should be
 /// retrieved for.</param>
 /// <param name="AReadTransaction">Open Database Transaction.</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 private static void PartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
     TDBTransaction AReadTransaction,
     ref PartnerInfoTDS APartnerInfoDS)
 {
     /*
      * Load PartnerLocation Information; this gets merged into the already retrieved
      * information in APartnerInfoDS (eg. 'Head' data)
      */
     APartnerInfoDS.Merge(TPPartnerAddressAggregate.LoadByPrimaryKey(
             APartnerKey, ALocationKey.SiteKey, ALocationKey.LocationKey, AReadTransaction));
 }
コード例 #6
0
        /// <summary>
        /// Retrieves Location and PartnerLocation information and the rest of the PartnerInfo data,
        /// but not the 'Head' data.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
        /// <param name="ALocationKey">Location Key of the Location that the information should be
        /// retrieved for.</param>
        /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
        /// <param name="AIncludeRest">Include 'Rest' data as well</param>
        private static bool LocationPartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
            ref PartnerInfoTDS APartnerInfoDS,
            bool AIncludeRest)
        {
            bool ReturnValue = false;
            TDBTransaction ReadTransaction;
            Boolean NewTransaction = false;
            PPartnerRow PartnerDR;
            PLocationTable LocationDT;
            PPartnerLocationTable PartnerLocationDT;


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

            try
            {
                /*
                 * Check for existance of Partner
                 */
                PartnerDR = MCommonMain.CheckPartnerExists2(APartnerKey, true);

                if (PartnerDR != null)
                {
                    /*
                     * Perform security checks; these throw ESecurityPartnerAccessDeniedException
                     * in case access isn't granted.
                     */
                    TSecurity.CanAccessPartnerExc(PartnerDR);

                    /*
                     * Load Partner Location data and rest of data first
                     */
                    PartnerLocationInternal(APartnerKey, ALocationKey, ReadTransaction, ref APartnerInfoDS);

                    /*
                     * Load Location Information; this gets merged into the already retrieved
                     * information in APartnerInfoDS (eg. Partner Location data and rest of data)
                     */
                    APartnerInfoDS.Merge(TPPartnerAddressAggregate.LoadByPrimaryKey(
                            ALocationKey.SiteKey, ALocationKey.LocationKey, ReadTransaction));

                    // Apply Address Security
                    LocationDT = APartnerInfoDS.PLocation;
                    PartnerLocationDT = APartnerInfoDS.PPartnerLocation;
                    TPPartnerAddressAggregate.ApplySecurity(ref PartnerLocationDT,
                        ref LocationDT);

                    if (AIncludeRest)
                    {
                        RestInternal(PartnerDR, ReadTransaction, ref APartnerInfoDS);
                    }

                    ReturnValue = true;
                }
            }
            catch (ESecurityPartnerAccessDeniedException)
            {
                // don't log this Exception - this is thrown on purpose here and the Client knows how to deal with it.
                throw;
            }
            catch (EDBAccessLackingCoordinationException)
            {
                // don't log this Exception - the Client knows how to deal with it.
                throw;
            }
            catch (Exception Exp)
            {
                TLogging.Log("TServerLookups_PartnerInfo.PartnerLocationInternal exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TServerLookups_PartnerInfo.LocationPartnerLocationAndRestOnly: committed own transaction.");
                }
            }

            return ReturnValue;
        }
コード例 #7
0
        /// <summary>
        /// Retrieves 'Rest' of Partner Information data.
        /// </summary>
        /// <param name="APartnerDR">DataRow that contains the Partner data.</param>
        /// <param name="APartnerInfoDS" >Typed PartnerInfoTDS DataSet</param>
        /// <param name="AReadTransaction" >Open DB Transaction.</param>
        private static void RestInternal(PPartnerRow APartnerDR,
                                         ref PartnerInfoTDS APartnerInfoDS,
                                         TDBTransaction AReadTransaction)
        {
            PartnerInfoTDSPartnerAdditionalInfoRow PartnerInfoDR;
            TPartnerClass PartnerClass;
            DateTime      LastContactDate;
            PPersonTable  PersonDT;
            PPartnerTable FamilyPartnerDT;
            Int64         PartnerKey = APartnerDR.PartnerKey;

            /*
             * Load Special Types
             */
            PPartnerTypeAccess.LoadViaPPartner(APartnerInfoDS, PartnerKey, AReadTransaction);


            /*
             * Load Subscriptions
             */
            PSubscriptionAccess.LoadViaPPartnerPartnerKey(APartnerInfoDS, PartnerKey, AReadTransaction);


            #region Populate PartnerAdditionalInfo Table

            if (APartnerInfoDS.PartnerAdditionalInfo.Rows.Count == 0)
            {
                PartnerInfoDR = APartnerInfoDS.PartnerAdditionalInfo.NewRowTyped(false);
            }
            else
            {
                PartnerInfoDR = APartnerInfoDS.PartnerAdditionalInfo[0];
            }

            if (!APartnerDR.IsCommentNull())
            {
                PartnerInfoDR.Notes = APartnerDR.Comment.Trim();
            }

            if (!APartnerDR.IsDateCreatedNull())
            {
                PartnerInfoDR.DateCreated = APartnerDR.DateCreated;
            }

            if (!APartnerDR.IsDateModifiedNull())
            {
                PartnerInfoDR.DateModified = APartnerDR.DateModified;
            }

            if (!APartnerDR.IsLanguageCodeNull())
            {
                PartnerInfoDR.MainLanguages = APartnerDR.LanguageCode;
            }

            if (!APartnerDR.IsPreviousNameNull())
            {
                PartnerInfoDR.PreviousName = APartnerDR.PreviousName;
            }

            // Determination of Last Contact Date
            TMailroom.GetLastContactDate(PartnerKey, out LastContactDate, AReadTransaction.DataBaseObj);
            PartnerInfoDR.LastContact = LastContactDate;


            /*
             * Special Data according to Partner Class
             */
            PartnerClass = SharedTypes.PartnerClassStringToEnum(APartnerDR.PartnerClass);

            switch (PartnerClass)
            {
            case TPartnerClass.PERSON:
                PersonDT = PPersonAccess.LoadByPrimaryKey(APartnerDR.PartnerKey, AReadTransaction);

                if (PersonDT != null)
                {
                    if (!PersonDT[0].IsDateOfBirthNull())
                    {
                        PartnerInfoDR.DateOfBirth = PersonDT[0].DateOfBirth;
                    }

                    // Get Family Members info
                    APartnerInfoDS.Merge(GetFamilyMembers(PersonDT[0].FamilyKey, AReadTransaction));


                    // Get Family Partner info
                    FamilyPartnerDT = PPartnerAccess.LoadByPrimaryKey(PersonDT[0].FamilyKey, AReadTransaction);

                    if (FamilyPartnerDT != null)
                    {
                        PartnerInfoDR.Family    = FamilyPartnerDT[0].PartnerShortName;
                        PartnerInfoDR.FamilyKey = FamilyPartnerDT[0].PartnerKey;
                    }

                    // Get the Languages of a Person from Personnel
                    PartnerInfoDR.AdditionalLanguages = GetPersonLanguagesFromPersonnel(
                        APartnerDR.PartnerKey, PartnerInfoDR.MainLanguages, AReadTransaction);
                }

                break;

            case TPartnerClass.FAMILY:

                // Get Family Members info
                APartnerInfoDS.Merge(GetFamilyMembers(PartnerKey, AReadTransaction));
                break;

            case TPartnerClass.UNIT:

                // Get Unit structure info
                APartnerInfoDS.Merge(GetUnitStructure(PartnerKey, AReadTransaction));

                break;
            }

            // Get Partners' PartnerAttributes
            PartnerAttributesInternal(PartnerKey, ref APartnerInfoDS, false, AReadTransaction);
            // TODO: Apply Contact Details Security

            if (APartnerInfoDS.PartnerAdditionalInfo.Rows.Count == 0)
            {
                APartnerInfoDS.PartnerAdditionalInfo.Rows.Add(PartnerInfoDR);
            }

            #endregion
        }
コード例 #8
0
        /// <summary>
        /// Retrieves Location and PartnerLocation information and the rest of the PartnerInfo data,
        /// but not the 'Head' data.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
        /// <param name="ALocationKey">Location Key of the Location that the information should be
        /// retrieved for.</param>
        /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
        /// <param name="AIncludeRest">Include 'Rest' data as well</param>
        /// <param name="AReadTransaction" >Open DB Transaction.</param>
        private static bool LocationPartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
                                                            ref PartnerInfoTDS APartnerInfoDS,
                                                            bool AIncludeRest, TDBTransaction AReadTransaction)
        {
            bool                  ReturnValue = false;
            PPartnerRow           PartnerDR;
            PLocationTable        LocationDT;
            PPartnerLocationTable PartnerLocationDT;

            try
            {
                /*
                 * Check for existance of Partner
                 */
                PartnerDR = MCommonMain.CheckPartnerExists2(APartnerKey, true, AReadTransaction.DataBaseObj);

                if (PartnerDR != null)
                {
                    /*
                     * Perform security checks; these throw ESecurityPartnerAccessDeniedException
                     * in case access isn't granted.
                     */
                    TSecurity.CanAccessPartnerExc(PartnerDR, AReadTransaction.DataBaseObj);

                    /*
                     * Load Partner Location data and rest of data first
                     */
                    PartnerLocationInternal(APartnerKey, ALocationKey, AReadTransaction, ref APartnerInfoDS);

                    /*
                     * Load Location Information; this gets merged into the already retrieved
                     * information in APartnerInfoDS (eg. Partner Location data and rest of data)
                     */
                    APartnerInfoDS.Merge(TPPartnerAddressAggregate.LoadByPrimaryKey(
                                             ALocationKey.SiteKey, ALocationKey.LocationKey, AReadTransaction));

                    // Apply Address Security
                    LocationDT        = APartnerInfoDS.PLocation;
                    PartnerLocationDT = APartnerInfoDS.PPartnerLocation;

                    TPPartnerAddressAggregate.ApplySecurity(ref PartnerLocationDT,
                                                            ref LocationDT);

                    if (AIncludeRest)
                    {
                        RestInternal(PartnerDR, ref APartnerInfoDS, AReadTransaction);
                    }

                    ReturnValue = true;
                }
            }
            catch (ESecurityPartnerAccessDeniedException)
            {
                // don't log this Exception - this is thrown on purpose here and the Client knows how to deal with it.
                throw;
            }
            catch (EDBAccessLackingCoordinationException)
            {
                // don't log this Exception - the Client knows how to deal with it.
                throw;
            }
            catch (Exception Exp)
            {
                TLogging.Log("TServerLookups_PartnerInfo.PartnerLocationInternal exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);

                throw;
            }

            return(ReturnValue);
        }
コード例 #9
0
        /// <summary>
        /// Retrieves Location and PartnerLocation information and the rest of the PartnerInfo data,
        /// but not the 'Head' data.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of Partner to find the short name for</param>
        /// <param name="ALocationKey">Location Key of the Location that the information should be
        /// retrieved for.</param>
        /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
        /// <param name="AIncludeRest">Include 'Rest' data as well</param>
        private static bool LocationPartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
                                                            ref PartnerInfoTDS APartnerInfoDS,
                                                            bool AIncludeRest)
        {
            bool                  ReturnValue = false;
            TDBTransaction        ReadTransaction;
            Boolean               NewTransaction = false;
            PPartnerRow           PartnerDR;
            PLocationTable        LocationDT;
            PPartnerLocationTable PartnerLocationDT;


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

            try
            {
                /*
                 * Check for existance of Partner
                 */
                PartnerDR = MCommonMain.CheckPartnerExists2(APartnerKey, true);

                if (PartnerDR != null)
                {
                    /*
                     * Perform security checks; these throw ESecurityPartnerAccessDeniedException
                     * in case access isn't granted.
                     */
                    TSecurity.CanAccessPartnerExc(PartnerDR);

                    /*
                     * Load Partner Location data and rest of data first
                     */
                    PartnerLocationInternal(APartnerKey, ALocationKey, ReadTransaction, ref APartnerInfoDS);

                    /*
                     * Load Location Information; this gets merged into the already retrieved
                     * information in APartnerInfoDS (eg. Partner Location data and rest of data)
                     */
                    APartnerInfoDS.Merge(TPPartnerAddressAggregate.LoadByPrimaryKey(
                                             ALocationKey.SiteKey, ALocationKey.LocationKey, ReadTransaction));

                    // Apply Address Security
                    LocationDT        = APartnerInfoDS.PLocation;
                    PartnerLocationDT = APartnerInfoDS.PPartnerLocation;
                    TPPartnerAddressAggregate.ApplySecurity(ref PartnerLocationDT,
                                                            ref LocationDT);

                    if (AIncludeRest)
                    {
                        RestInternal(PartnerDR, ReadTransaction, ref APartnerInfoDS);
                    }

                    ReturnValue = true;
                }
            }
            catch (ESecurityPartnerAccessDeniedException)
            {
                // don't log this exception  this is thrown on purpose here and the Client needs to deal with it.
                throw;
            }
            catch (Exception Exp)
            {
                TLogging.Log("TServerLookups_PartnerInfo.PartnerLocationInternal exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TServerLookups_PartnerInfo.LocationPartnerLocationAndRestOnly: committed own transaction.");
                }
            }

            return(ReturnValue);
        }