///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5DD_GDDFDD_1402 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5DD_GDDFDD_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
        protected static FR_L5DD_GDDFDD_1402 Execute(DbConnection Connection, DbTransaction Transaction, P_L5DD_GDDFDD_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5DD_GDDFDD_1402();

            L5DD_GDDFDD_1402          result        = new L5DD_GDDFDD_1402();
            ORM_RES_DUD_RevisionGroup revisionGroup = new ORM_RES_DUD_RevisionGroup();
            revisionGroup.Load(Connection, Transaction, Parameter.RevisionGroupID);

            ORM_CMN_PER_PersonInfo_2_Account.Query infoToAccountQuery = new ORM_CMN_PER_PersonInfo_2_Account.Query();
            infoToAccountQuery.IsDeleted         = false;
            infoToAccountQuery.Tenant_RefID      = securityTicket.TenantID;
            infoToAccountQuery.USR_Account_RefID = revisionGroup.RevisionGroup_SubmittedBy_Account_RefID;
            List <ORM_CMN_PER_PersonInfo_2_Account> infoToAccountList = ORM_CMN_PER_PersonInfo_2_Account.Query.Search(Connection, Transaction, infoToAccountQuery);


            ORM_CMN_PER_PersonInfo.Query personInfoQuery = new ORM_CMN_PER_PersonInfo.Query();
            personInfoQuery.IsDeleted            = false;
            personInfoQuery.Tenant_RefID         = securityTicket.TenantID;
            personInfoQuery.CMN_PER_PersonInfoID = infoToAccountList[0].CMN_PER_PersonInfo_RefID;
            List <ORM_CMN_PER_PersonInfo> personInfo = ORM_CMN_PER_PersonInfo.Query.Search(Connection, Transaction, personInfoQuery);

            result.Creation_Timestamp       = revisionGroup.Creation_Timestamp;
            result.FirstName                = personInfo[0].FirstName;
            result.LastName                 = personInfo[0].LastName;
            result.RealestateProperty_RefID = revisionGroup.RealestateProperty_RefID;
            result.RES_DUD_Revision_GroupID = revisionGroup.RES_DUD_Revision_GroupID;
            result.RevisionGroup_Comment    = revisionGroup.RevisionGroup_Comment;
            result.RevisionGroup_Name       = revisionGroup.RevisionGroup_Name;
            result.RevisionGroup_SubmittedBy_Account_RefID = revisionGroup.RevisionGroup_SubmittedBy_Account_RefID;
            result.Tenant_RefID = securityTicket.TenantID;
            returnValue.Result  = result;
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5DD_GDDFDD_1402 Invoke(string ConnectionString, P_L5DD_GDDFDD_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5DD_GDDFDD_1402 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5DD_GDDFDD_1402 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5DD_GDDFDD_1402 functionReturn = new FR_L5DD_GDDFDD_1402();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Get_DueDiligence_For_DueDiligenceID", ex);
            }
            return(functionReturn);
        }