Example #1
0
        protected static FR_L5EX_GAPOaMOfPAID_1639 Execute(DbConnection Connection, DbTransaction Transaction, P_L5EX_GAPOaMOfPAID_1639 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L5EX_GAPOaMOfPAID_1639();
            //Put your code here
            L5EX_GAPOaMOfPAID_1639 madeAndPotentialObservations = new L5EX_GAPOaMOfPAID_1639();
            var allPotentialObservations = ORM_HEC_PotentialObservation.Query.Search(Connection, Transaction, new ORM_HEC_PotentialObservation.Query()
            {
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID
            }).ToArray();
            var madeObservationsForPerformedActionID = ORM_HEC_ACT_PerformedAction_MadeObservation.Query.Search(Connection, Transaction, new ORM_HEC_ACT_PerformedAction_MadeObservation.Query()
            {
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID,
                HEC_ACT_PerformedAction_RefID = Parameter.PerformedActionID
            }).ToArray();

            List <L5EX_GAPOaMOfPAID_1639MadeObservations> madeObservations = new List <L5EX_GAPOaMOfPAID_1639MadeObservations>();
            foreach (var observation in madeObservationsForPerformedActionID)
            {
                L5EX_GAPOaMOfPAID_1639MadeObservations newObservation = new L5EX_GAPOaMOfPAID_1639MadeObservations();
                newObservation.Comment = observation.Comment;
                newObservation.PotentialObservationRef_ID = observation.PotentialObservation_RefID;
                madeObservations.Add(newObservation);
            }

            madeAndPotentialObservations.MadeObservations      = madeObservations.ToArray();
            madeAndPotentialObservations.PotentialObservations = allPotentialObservations.ToArray();
            returnValue.Result = madeAndPotentialObservations;
            return(returnValue);

            #endregion UserCode
        }
Example #2
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5EX_GAPOaMOfPAID_1639 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5EX_GAPOaMOfPAID_1639 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5EX_GAPOaMOfPAID_1639 functionReturn = new FR_L5EX_GAPOaMOfPAID_1639();

            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_All_PotentialObservations_and_MadeObservations_for_PerformedActionID", ex);
            }
            return(functionReturn);
        }