Esempio n. 1
0
        /// <summary>
        /// Puts 'Head' data from a Partner DataRow into Partner Information data.
        /// </summary>
        /// <param name="APartnerDR">DataRow that contains the Partner data.</param>
        /// <param name="APartnerInfoDS" >Typed PartnerInfoTDS DataSet</param>
        private static void HeadInternal(PPartnerRow APartnerDR,
                                         ref PartnerInfoTDS APartnerInfoDS)
        {
            PartnerInfoTDSPartnerHeadInfoRow PartnerHeadInfoDR;

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

            PartnerHeadInfoDR.PartnerKey          = APartnerDR.PartnerKey;
            PartnerHeadInfoDR.PartnerShortName    = APartnerDR.PartnerShortName;
            PartnerHeadInfoDR.PartnerClass        = APartnerDR.PartnerClass;
            PartnerHeadInfoDR.StatusCode          = APartnerDR.StatusCode;
            PartnerHeadInfoDR.AcquisitionCode     = APartnerDR.AcquisitionCode;
            PartnerHeadInfoDR.PrivatePartnerOwner = APartnerDR.UserId;

            if (APartnerInfoDS.PartnerHeadInfo.Rows.Count == 0)
            {
                APartnerInfoDS.PartnerHeadInfo.Rows.Add(PartnerHeadInfoDR);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Returns miscellaneous Partner data.
 /// </summary>
 /// <remarks>Used by the Partner Info UserControl.</remarks>
 /// <param name="APartnerKey">PartnerKey of the Partner for which the data
 /// should be retrieved.</param>
 /// <param name="ALocationKey">LocationKey of the Location for which data
 /// for the Partner specified should be retrieved.</param>
 /// <param name="APartnerInfoScope">Scope of data that should be loaded and
 /// returned by the PetraServer.</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested Partner data.</param>
 /// <returns>True if the Partner exists, otherwise false.</returns>
 public static Boolean PartnerInfo(Int64 APartnerKey, TLocationPK ALocationKey,
                                   TPartnerInfoScopeEnum APartnerInfoScope,
                                   out PartnerInfoTDS APartnerInfoDS)
 {
     return(TRemote.MPartner.Partner.ServerLookups.WebConnectors.PartnerInfo(APartnerKey,
                                                                             ALocationKey, APartnerInfoScope, out APartnerInfoDS));
 }
Esempio n. 3
0
 /// <summary>
 /// Returns miscellaneous Partner data.
 /// </summary>
 /// <remarks>Used by the Partner Info UserControl.</remarks>
 /// <param name="APartnerKey">PartnerKey of the Partner for which the data
 /// should be retrieved.</param>
 /// <param name="APartnerInfoScope">Scope of data that should be loaded and
 /// returned by the PetraServer.</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested Partner data.</param>
 /// <param name="ASeparateDBConnection">If you *must have* a separate DB Connection</param>
 /// <returns>True if the Partner exists, otherwise false.</returns>
 public static Boolean PartnerInfo(Int64 APartnerKey,
                                   TPartnerInfoScopeEnum APartnerInfoScope,
                                   out PartnerInfoTDS APartnerInfoDS,
                                   Boolean ASeparateDBConnection = false)
 {
     return(TRemote.MPartner.Partner.ServerLookups.WebConnectors.PartnerInfo(APartnerKey,
                                                                             APartnerInfoScope, out APartnerInfoDS, ASeparateDBConnection));
 }
Esempio n. 4
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));
 }
Esempio n. 5
0
        /// <summary>
        /// Retrieves 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 PartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
                                                    ref PartnerInfoTDS APartnerInfoDS,
                                                    bool AIncludeRest, TDBTransaction AReadTransaction)
        {
            bool        ReturnValue = false;
            PPartnerRow PartnerDR;

            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);

                    /*
                     * Partner exists --> we can go ahead with data gathering
                     */
                    PartnerLocationInternal(APartnerKey, ALocationKey, AReadTransaction, ref APartnerInfoDS);

                    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);
        }
Esempio n. 6
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));
 }
        /// <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;
        }
 /// <summary>
 /// Retrieves PartnerAttributes information only.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data for</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool PartnerAttributesOnly(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS)
 {
     return PartnerAttributesInternal(APartnerKey, ref APartnerInfoDS, false);
 }
        /// <summary>
        /// Retrieves all of the PartnerInfo data.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data for</param>
        /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
        /// <returns>True if Partner exists, otherwise false.</returns>
        public static bool AllPartnerInfoData(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS)
        {
            bool ReturnValue = false;
            TDBTransaction ReadTransaction;
            Boolean NewTransaction = false;
            PPartnerRow PartnerDR;

            TLocationPK BestLocationPK;
            PLocationRow LocationDR;
            PLocationRow LocationDR2;
            PPartnerLocationRow PartnerLocationDR;
            PPartnerLocationRow PartnerLocationDR2;
            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);

                    /*
                     * Get the Partner's Address data of its 'Best' Address
                     */
                    if (TMailing.GetPartnersBestLocationData(APartnerKey, out BestLocationPK,
                            out LocationDR, out PartnerLocationDR))
                    {
                        #region Process Address

                        /*
                         * Check for existance of PLocation and PPartnerLocation Tables in the passed in
                         * DataSet APartnerInfoDS.
                         */
                        if (!APartnerInfoDS.Tables.Contains(PLocationTable.GetTableName()))
                        {
                            // Need to create Table here
                            APartnerInfoDS.Tables.Add(new PLocationTable());
                        }

                        if (!APartnerInfoDS.Tables.Contains(PPartnerLocationTable.GetTableName()))
                        {
                            // Need to create Table here
                            APartnerInfoDS.Tables.Add(new PPartnerLocationTable());
                        }

                        // Add copies of the Location and PartnerLocation DataRows of the 'Best Address'

                        /*
                         * Remove DataColumns that might have been added by the call to
                         * TMailing.GetPartnersBestLocationData - otherwise PartnerLocationDR2.ItemArray
                         * assignment will fail.
                         */
                        if (PartnerLocationDR.Table.Columns.Contains(Calculations.PARTNERLOCATION_BESTADDR_COLUMN))
                        {
                            PartnerLocationDR.Table.Columns.Remove(Calculations.PARTNERLOCATION_BESTADDR_COLUMN);
                        }

                        if (PartnerLocationDR.Table.Columns.Contains(Calculations.PARTNERLOCATION_ICON_COLUMN))
                        {
                            PartnerLocationDR.Table.Columns.Remove(Calculations.PARTNERLOCATION_ICON_COLUMN);
                        }

                        LocationDR2 = APartnerInfoDS.PLocation.NewRowTyped(false);
                        LocationDR2.ItemArray = LocationDR.ItemArray;
                        PartnerLocationDR2 = APartnerInfoDS.PPartnerLocation.NewRowTyped(false);
                        PartnerLocationDR2.ItemArray = PartnerLocationDR.ItemArray;

                        APartnerInfoDS.PLocation.Rows.Add(LocationDR2);
                        APartnerInfoDS.PPartnerLocation.Rows.Add(PartnerLocationDR2);

                        #endregion

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

                        // Process 'Head' data and rest of data for the Partner
                        HeadInternal(PartnerDR, ref APartnerInfoDS);
                        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.AllPartnerInfoData exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TServerLookups_PartnerInfo.AllPartnerInfoData: committed own transaction.");
                }
            }

            return ReturnValue;
        }
Esempio n. 10
0
 /// <summary>
 /// Retrieves PartnerAttributes information only.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data for</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool PartnerAttributesOnly(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS)
 {
     return(PartnerAttributesInternal(APartnerKey, ref APartnerInfoDS, false));
 }
Esempio n. 11
0
 /// <summary>
 /// Retrieves PartnerLocation information and the rest of the PartnerInfo data, but not the
 /// 'Head' data.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data 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="AReadTransaction" >Open DB Transaction.</param>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool PartnerLocationAndRestOnly(Int64 APartnerKey, TLocationPK ALocationKey,
                                               ref PartnerInfoTDS APartnerInfoDS, TDBTransaction AReadTransaction)
 {
     return(PartnerLocationInternal(APartnerKey, ALocationKey, ref APartnerInfoDS, true, AReadTransaction));
 }
Esempio n. 12
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 PartnerInfo data 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>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool LocationPartnerLocationOnly(Int64 APartnerKey, TLocationPK ALocationKey,
                                                ref PartnerInfoTDS APartnerInfoDS)
 {
     return(LocationPartnerLocationInternal(APartnerKey, ALocationKey, ref APartnerInfoDS, false));
 }
Esempio n. 13
0
        public static Boolean PartnerInfo(Int64 APartnerKey, TLocationPK ALocationKey,
            TPartnerInfoScopeEnum APartnerInfoScope,
            out PartnerInfoTDS APartnerInfoDS)
        {
            const string DATASET_NAME = "PartnerInfo";

            Boolean ReturnValue = false;

            APartnerInfoDS = new PartnerInfoTDS(DATASET_NAME);

            switch (APartnerInfoScope)
            {
                case TPartnerInfoScopeEnum.pisHeadOnly:

                    throw new NotImplementedException();

                case TPartnerInfoScopeEnum.pisPartnerLocationAndRestOnly:

                    if (TServerLookups_PartnerInfo.PartnerLocationAndRestOnly(APartnerKey,
                            ALocationKey, ref APartnerInfoDS))
                    {
                        ReturnValue = true;
                    }
                    else
                    {
                        ReturnValue = false;
                    }

                    break;

                case TPartnerInfoScopeEnum.pisPartnerLocationOnly:

                    if (TServerLookups_PartnerInfo.PartnerLocationOnly(APartnerKey,
                            ALocationKey, ref APartnerInfoDS))
                    {
                        ReturnValue = true;
                    }
                    else
                    {
                        ReturnValue = false;
                    }

                    break;

                case TPartnerInfoScopeEnum.pisLocationPartnerLocationAndRestOnly:

                    if (TServerLookups_PartnerInfo.LocationPartnerLocationAndRestOnly(APartnerKey,
                            ALocationKey, ref APartnerInfoDS))
                    {
                        ReturnValue = true;
                    }
                    else
                    {
                        ReturnValue = false;
                    }

                    break;

                case TPartnerInfoScopeEnum.pisLocationPartnerLocationOnly:

                    if (TServerLookups_PartnerInfo.LocationPartnerLocationOnly(APartnerKey,
                            ALocationKey, ref APartnerInfoDS))
                    {
                        ReturnValue = true;
                    }
                    else
                    {
                        ReturnValue = false;
                    }

                    break;

                case TPartnerInfoScopeEnum.pisFull:

                    if (TServerLookups_PartnerInfo.AllPartnerInfoData(APartnerKey,
                            ref APartnerInfoDS))
                    {
                        ReturnValue = true;
                    }
                    else
                    {
                        ReturnValue = false;
                    }

                    break;

                default:

                    break;
            }

            return ReturnValue;
        }
 /// <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));
 }
        /// <summary>
        /// Puts 'Head' data from a Partner DataRow into Partner Information data.
        /// </summary>
        /// <param name="APartnerDR">DataRow that contains the Partner data.</param>
        /// <param name="APartnerInfoDS" >Typed PartnerInfoTDS DataSet</param>
        private static void HeadInternal(PPartnerRow APartnerDR,
            ref PartnerInfoTDS APartnerInfoDS)
        {
            PartnerInfoTDSPartnerHeadInfoRow PartnerHeadInfoDR;

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

            PartnerHeadInfoDR.PartnerKey = APartnerDR.PartnerKey;
            PartnerHeadInfoDR.PartnerShortName = APartnerDR.PartnerShortName;
            PartnerHeadInfoDR.PartnerClass = APartnerDR.PartnerClass;
            PartnerHeadInfoDR.StatusCode = APartnerDR.StatusCode;
            PartnerHeadInfoDR.AcquisitionCode = APartnerDR.AcquisitionCode;
            PartnerHeadInfoDR.PrivatePartnerOwner = APartnerDR.UserId;

            if (APartnerInfoDS.PartnerHeadInfo.Rows.Count == 0)
            {
                APartnerInfoDS.PartnerHeadInfo.Rows.Add(PartnerHeadInfoDR);
            }
        }
Esempio n. 16
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);
        }
Esempio n. 17
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);
        }
Esempio n. 18
0
        /// <summary>
        /// Retrieves all of the PartnerInfo data.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data for</param>
        /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
        /// <param name="AReadTransaction" >Open DB Transaction.</param>
        /// <returns>True if Partner exists, otherwise false.</returns>
        public static bool AllPartnerInfoData(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS,
                                              TDBTransaction AReadTransaction)
        {
            bool        ReturnValue = false;
            PPartnerRow PartnerDR;

            TLocationPK           BestLocationPK;
            PLocationRow          LocationDR;
            PLocationRow          LocationDR2;
            PPartnerLocationRow   PartnerLocationDR;
            PPartnerLocationRow   PartnerLocationDR2;
            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);

                    /*
                     * Get the Partner's Address data of its 'Best' Address
                     */
                    if (TMailing.GetPartnersBestLocationData(APartnerKey, out BestLocationPK,
                                                             out LocationDR, out PartnerLocationDR, AReadTransaction.DataBaseObj))
                    {
                        #region Process Address

                        /*
                         * Check for existance of PLocation and PPartnerLocation Tables in the passed in
                         * DataSet APartnerInfoDS.
                         */
                        if (!APartnerInfoDS.Tables.Contains(PLocationTable.GetTableName()))
                        {
                            // Need to create Table here
                            APartnerInfoDS.Tables.Add(new PLocationTable());
                        }

                        if (!APartnerInfoDS.Tables.Contains(PPartnerLocationTable.GetTableName()))
                        {
                            // Need to create Table here
                            APartnerInfoDS.Tables.Add(new PPartnerLocationTable());
                        }

                        // Add copies of the Location and PartnerLocation DataRows of the 'Best Address'

                        /*
                         * Remove DataColumns that might have been added by the call to
                         * TMailing.GetPartnersBestLocationData - otherwise PartnerLocationDR2.ItemArray
                         * assignment will fail.
                         */
                        if (PartnerLocationDR.Table.Columns.Contains(Calculations.PARTNERLOCATION_BESTADDR_COLUMN))
                        {
                            PartnerLocationDR.Table.Columns.Remove(Calculations.PARTNERLOCATION_BESTADDR_COLUMN);
                        }

                        if (PartnerLocationDR.Table.Columns.Contains(Calculations.PARTNERLOCATION_ICON_COLUMN))
                        {
                            PartnerLocationDR.Table.Columns.Remove(Calculations.PARTNERLOCATION_ICON_COLUMN);
                        }

                        LocationDR2                  = APartnerInfoDS.PLocation.NewRowTyped(false);
                        LocationDR2.ItemArray        = LocationDR.ItemArray;
                        PartnerLocationDR2           = APartnerInfoDS.PPartnerLocation.NewRowTyped(false);
                        PartnerLocationDR2.ItemArray = PartnerLocationDR.ItemArray;

                        APartnerInfoDS.PLocation.Rows.Add(LocationDR2);
                        APartnerInfoDS.PPartnerLocation.Rows.Add(PartnerLocationDR2);

                        #endregion

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

                        TPPartnerAddressAggregate.ApplySecurity(ref PartnerLocationDT,
                                                                ref LocationDT);

                        // Process 'Head' data and rest of data for the Partner
                        HeadInternal(PartnerDR, ref APartnerInfoDS);
                        RestInternal(PartnerDR, ref APartnerInfoDS, AReadTransaction);

                        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.AllPartnerInfoData exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);

                throw;
            }

            return(ReturnValue);
        }
Esempio n. 19
0
 /// <summary>
 /// Retrieves PartnerAttributes information only.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data for</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
 /// <param name="AReadTransaction" >Open DB Transaction.</param>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool PartnerAttributesOnly(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS,
                                          TDBTransaction AReadTransaction)
 {
     return(PartnerAttributesInternal(APartnerKey, ref APartnerInfoDS, false, AReadTransaction));
 }
Esempio n. 20
0
 /// <summary>
 /// Retrieves PartnerLocation information and the rest of the PartnerInfo data, but not the
 /// 'Head' data.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data 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>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool PartnerLocationAndRestOnly(Int64 APartnerKey, TLocationPK ALocationKey,
                                               ref PartnerInfoTDS APartnerInfoDS)
 {
     return(PartnerLocationInternal(APartnerKey, ALocationKey, ref APartnerInfoDS, true));
 }
        /// <summary>
        /// Retrieves PartnerAttribute 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="APartnerInfoDS">Typed DataSet that contains the requested data.</param>
        /// <param name="AIncludeRest">Include 'Rest' data as well</param>
        private static bool PartnerAttributesInternal(Int64 APartnerKey, ref PartnerInfoTDS APartnerInfoDS,
            bool AIncludeRest)
        {
            bool ReturnValue = false;
            TDBTransaction ReadTransaction;
            Boolean NewTransaction = false;
            PPartnerRow PartnerDR;

            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);

                    /*
                     * Partner exists --> we can go ahead with data gathering
                     */
                    PartnerAttributesInternal(APartnerKey, ReadTransaction, ref APartnerInfoDS);

                    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.PartnerAttributesInternal exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TServerLookups_PartnerInfo.PartnerAttributesInternal: committed own transaction.");
                }
            }

            return ReturnValue;
        }
 /// <summary>
 /// Retrieves PartnerLocation information and the rest of the PartnerInfo data, but not the
 /// 'Head' data.
 /// </summary>
 /// <param name="APartnerKey">PartnerKey of Partner to find the PartnerInfo data 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>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool PartnerLocationAndRestOnly(Int64 APartnerKey, TLocationPK ALocationKey,
     ref PartnerInfoTDS APartnerInfoDS)
 {
     return PartnerLocationInternal(APartnerKey, ALocationKey, ref APartnerInfoDS, true);
 }
 /// <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));
 }
Esempio n. 24
0
        /// <summary>
        /// Retrieves 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 PartnerLocationInternal(Int64 APartnerKey, TLocationPK ALocationKey,
                                                    ref PartnerInfoTDS APartnerInfoDS,
                                                    bool AIncludeRest)
        {
            bool           ReturnValue = false;
            TDBTransaction ReadTransaction;
            Boolean        NewTransaction = false;
            PPartnerRow    PartnerDR;

            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);

                    /*
                     * Partner exists --> we can go ahead with data gathering
                     */
                    PartnerLocationInternal(APartnerKey, ALocationKey, ReadTransaction, ref APartnerInfoDS);

                    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);
        }
        /// <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
        }
Esempio n. 26
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
        }
 /// <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 PartnerInfo data 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>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool LocationPartnerLocationOnly(Int64 APartnerKey, TLocationPK ALocationKey,
     ref PartnerInfoTDS APartnerInfoDS)
 {
     return LocationPartnerLocationInternal(APartnerKey, ALocationKey, ref APartnerInfoDS, false);
 }
Esempio n. 28
0
 public static Boolean PartnerInfo(Int64 APartnerKey,
                                   TPartnerInfoScopeEnum APartnerInfoScope,
                                   out PartnerInfoTDS APartnerInfoDS)
 {
     return(PartnerInfo(APartnerKey, null, APartnerInfoScope, out APartnerInfoDS));
 }
Esempio n. 29
0
 public static Boolean PartnerInfo(Int64 APartnerKey,
     TPartnerInfoScopeEnum APartnerInfoScope,
     out PartnerInfoTDS APartnerInfoDS)
 {
     return PartnerInfo(APartnerKey, null, APartnerInfoScope, out APartnerInfoDS);
 }
Esempio n. 30
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 PartnerInfo data 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="AReadTransaction" >Open DB Transaction.</param>
 /// <returns>True if Partner exists, otherwise false.</returns>
 public static bool LocationPartnerLocationOnly(Int64 APartnerKey, TLocationPK ALocationKey,
                                                ref PartnerInfoTDS APartnerInfoDS, TDBTransaction AReadTransaction)
 {
     return(LocationPartnerLocationInternal(APartnerKey, ALocationKey, ref APartnerInfoDS, false,
                                            AReadTransaction));
 }
Esempio n. 31
0
 /// <summary>
 /// Returns miscellaneous Partner data.
 /// </summary>
 /// <remarks>Used by the Partner Info UserControl.</remarks>
 /// <param name="APartnerKey">PartnerKey of the Partner for which the data
 /// should be retrieved.</param>
 /// <param name="ALocationKey">LocationKey of the Location for which data
 /// for the Partner specified should be retrieved.</param>
 /// <param name="APartnerInfoScope">Scope of data that should be loaded and
 /// returned by the PetraServer.</param>
 /// <param name="APartnerInfoDS">Typed DataSet that contains the requested Partner data.</param>
 /// <returns>True if the Partner exists, otherwise false.</returns>
 public static Boolean PartnerInfo(Int64 APartnerKey, TLocationPK ALocationKey,
     TPartnerInfoScopeEnum APartnerInfoScope,
     out PartnerInfoTDS APartnerInfoDS)
 {
     return TRemote.MPartner.Partner.ServerLookups.WebConnectors.PartnerInfo(APartnerKey,
         ALocationKey, APartnerInfoScope, out APartnerInfoDS);
 }
Esempio n. 32
0
        public static Boolean PartnerInfo(Int64 APartnerKey, TLocationPK ALocationKey,
                                          TPartnerInfoScopeEnum APartnerInfoScope,
                                          out PartnerInfoTDS APartnerInfoDS)
        {
            const string DATASET_NAME = "PartnerInfo";

            Boolean ReturnValue = false;

            APartnerInfoDS = new PartnerInfoTDS(DATASET_NAME);

            switch (APartnerInfoScope)
            {
            case TPartnerInfoScopeEnum.pisHeadOnly:

                throw new NotImplementedException();

            case TPartnerInfoScopeEnum.pisPartnerLocationAndRestOnly:

                if (TServerLookups_PartnerInfo.PartnerLocationAndRestOnly(APartnerKey,
                                                                          ALocationKey, ref APartnerInfoDS))
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }

                break;

            case TPartnerInfoScopeEnum.pisPartnerLocationOnly:

                if (TServerLookups_PartnerInfo.PartnerLocationOnly(APartnerKey,
                                                                   ALocationKey, ref APartnerInfoDS))
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }

                break;

            case TPartnerInfoScopeEnum.pisLocationPartnerLocationAndRestOnly:

                if (TServerLookups_PartnerInfo.LocationPartnerLocationAndRestOnly(APartnerKey,
                                                                                  ALocationKey, ref APartnerInfoDS))
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }

                break;

            case TPartnerInfoScopeEnum.pisLocationPartnerLocationOnly:

                if (TServerLookups_PartnerInfo.LocationPartnerLocationOnly(APartnerKey,
                                                                           ALocationKey, ref APartnerInfoDS))
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }

                break;

            case TPartnerInfoScopeEnum.pisPartnerAttributesOnly:

                if (TServerLookups_PartnerInfo.PartnerAttributesOnly(APartnerKey,
                                                                     ref APartnerInfoDS))
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }

                break;

            case TPartnerInfoScopeEnum.pisFull:

                if (TServerLookups_PartnerInfo.AllPartnerInfoData(APartnerKey,
                                                                  ref APartnerInfoDS))
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }

                break;

            default:

                break;
            }

            return(ReturnValue);
        }