Beispiel #1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="APartnerKey"></param>
        /// <param name="ALastContactDate"></param>
        /// <param name="ADataBase">An instantiated <see cref="TDataBase" /> object, or null (default = null). If null
        /// gets passed then the Method executes DB commands with the 'globally available'
        /// <see cref="DBAccess.GDBAccessObj" /> instance, otherwise with the instance that gets passed in with this
        /// Argument!</param>
        public static void GetLastContactDate(Int64 APartnerKey, out DateTime ALastContactDate,
                                              TDataBase ADataBase = null)
        {
            TDBTransaction ReadTransaction = null;

            DataSet        LastContactDS;
            PContactLogRow ContactDR;
            DateTime       LastContactDate = new DateTime();

            LastContactDS = new DataSet("LastContactDate");
            LastContactDS.Tables.Add(new PContactLogTable());

            DBAccess.GetDBAccessObj(ADataBase).GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                                                                                   TEnforceIsolationLevel.eilMinimum,
                                                                                   ref ReadTransaction,
                                                                                   delegate
            {
                PContactLogAccess.LoadViaPPartnerPPartnerContact(LastContactDS, APartnerKey,
                                                                 StringHelper.InitStrArr(new String[] { PContactLogTable.GetContactDateDBName() }), ReadTransaction,
                                                                 StringHelper.InitStrArr(new String[] { "ORDER BY " + PContactLogTable.GetContactDateDBName() + " DESC" }), 0, 1);

                if (LastContactDS.Tables[PContactLogTable.GetTableName()].Rows.Count > 0)
                {
                    ContactDR       = ((PContactLogTable)LastContactDS.Tables[PContactLogTable.GetTableName()])[0];
                    LastContactDate = ContactDR.ContactDate;
                }
                else
                {
                    LastContactDate = DateTime.MinValue;
                }
            });

            ALastContactDate = LastContactDate;
        }
Beispiel #2
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="APartnerKey"></param>
        /// <param name="ALastContactDate"></param>
        /// <param name="ADataBase">An instantiated <see cref="TDataBase" /> object, or null (default = null). If null
        /// gets passed then the Method executes DB commands with a new Database connection</param>
        public static void GetLastContactDate(Int64 APartnerKey, out DateTime ALastContactDate,
                                              TDataBase ADataBase = null)
        {
            TDBTransaction ReadTransaction = new TDBTransaction();

            DataSet        LastContactDS;
            PContactLogRow ContactDR;
            DateTime       LastContactDate = new DateTime();

            LastContactDS = new DataSet("LastContactDate");
            LastContactDS.Tables.Add(new PContactLogTable());

            TDataBase db = DBAccess.Connect("GetLastContactDate", ADataBase);

            db.ReadTransaction(
                ref ReadTransaction,
                delegate
            {
                PContactLogAccess.LoadViaPPartnerPPartnerContact(LastContactDS, APartnerKey,
                                                                 StringHelper.InitStrArr(new String[] { PContactLogTable.GetContactDateDBName() }), ReadTransaction,
                                                                 StringHelper.InitStrArr(new String[] { "ORDER BY " + PContactLogTable.GetContactDateDBName() + " DESC" }), 0, 1);

                if (LastContactDS.Tables[PContactLogTable.GetTableName()].Rows.Count > 0)
                {
                    ContactDR       = ((PContactLogTable)LastContactDS.Tables[PContactLogTable.GetTableName()])[0];
                    LastContactDate = ContactDR.ContactDate;
                }
                else
                {
                    LastContactDate = DateTime.MinValue;
                }
            });

            ALastContactDate = LastContactDate;
        }
Beispiel #3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="APartnerKey"></param>
        /// <param name="ALastContactDate"></param>
        public static void GetLastContactDate(Int64 APartnerKey, out DateTime ALastContactDate)
        {
            TDBTransaction ReadTransaction;
            Boolean        NewTransaction;
            DataSet        LastContactDS;
            PContactLogRow ContactDR;

            LastContactDS = new DataSet("LastContactDate");
            LastContactDS.Tables.Add(new PContactLogTable());
            ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
                                                                                TEnforceIsolationLevel.eilMinimum,
                                                                                out NewTransaction);
            PContactLogAccess.LoadViaPPartnerPPartnerContact(LastContactDS, APartnerKey,
                                                             StringHelper.InitStrArr(new String[] { PContactLogTable.GetContactDateDBName() }), ReadTransaction,
                                                             StringHelper.InitStrArr(new String[] { "ORDER BY " + PContactLogTable.GetContactDateDBName() + " DESC" }), 0, 1);

            if (LastContactDS.Tables[PContactLogTable.GetTableName()].Rows.Count > 0)
            {
                ContactDR        = ((PContactLogTable)LastContactDS.Tables[PContactLogTable.GetTableName()])[0];
                ALastContactDate = ContactDR.ContactDate;
            }
            else
            {
                ALastContactDate = DateTime.MinValue;
            }

            if (NewTransaction)
            {
                DBAccess.GDBAccessObj.CommitTransaction();
                TLogging.LogAtLevel(7, "TMailroom.GetLastContactDate: committed own transaction.");
            }
        }
Beispiel #4
0
        public static PContactLogTable FindContactLogsForPartner(long partnerKey)
        {
            Boolean          NewTransaction;
            PContactLogTable contacts = new PContactLogTable();

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

            try
            {
                contacts = PContactLogAccess.LoadViaPPartnerPPartnerContact(partnerKey, WriteTransaction);
            }
            catch (Exception e)
            {
                TLogging.Log(e.Message);
                TLogging.Log(e.StackTrace);
            }

            if (NewTransaction)
            {
                DBAccess.GDBAccessObj.RollbackTransaction();
            }

            return(contacts);
        }
Beispiel #5
0
        public static PartnerEditTDS GetPartnerContactLogData(long APartnerKey, TDataBase ADataBase = null)
        {
            PartnerEditTDS ReturnDS = new PartnerEditTDS();

            TDBTransaction Transaction = new TDBTransaction();
            TDataBase      db          = DBAccess.Connect("GetPartnerContactLogData", ADataBase);

            db.ReadTransaction(ref Transaction,
                               delegate
            {
                ReturnDS.Merge(PContactLogAccess.LoadViaPPartnerPPartnerContact(APartnerKey, Transaction));
                ReturnDS.Merge(PPartnerContactAccess.LoadViaPPartner(APartnerKey, Transaction));

                if ((ReturnDS.PContactLog != null) && (ReturnDS.PContactLog.Count > 0))
                {
                    foreach (PContactLogRow Row in ReturnDS.PContactLog.Rows)
                    {
                        ReturnDS.Merge(PPartnerContactAttributeAccess.LoadViaPContactLog(Row.ContactLogId, Transaction));
                    }
                }
            });

            return(ReturnDS);
        }
Beispiel #6
0
        public static PartnerEditTDS GetPartnerContactLogData(long APartnerKey)
        {
            PartnerEditTDS ReturnDS = new PartnerEditTDS();

            TDBTransaction Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                                                                      TEnforceIsolationLevel.eilMinimum, ref Transaction,
                                                                      delegate
            {
                ReturnDS.Merge(PContactLogAccess.LoadViaPPartnerPPartnerContact(APartnerKey, Transaction));
                ReturnDS.Merge(PPartnerContactAccess.LoadViaPPartner(APartnerKey, Transaction));

                if ((ReturnDS.PContactLog != null) && (ReturnDS.PContactLog.Count > 0))
                {
                    foreach (PContactLogRow Row in ReturnDS.PContactLog.Rows)
                    {
                        ReturnDS.Merge(PPartnerContactAttributeAccess.LoadViaPContactLog(Row.ContactLogId, Transaction));
                    }
                }
            });

            return(ReturnDS);
        }