示例#1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5PR_GPFPID_1204 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PR_GPFPID_1204 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5PR_GPFPID_1204 functionReturn = new FR_L5PR_GPFPID_1204();

            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_Project_For_ProjectID", ex);
            }
            return(functionReturn);
        }
示例#2
0
        protected static FR_L5PR_GPFPID_1204 Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_GPFPID_1204 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5PR_GPFPID_1204();
            returnValue.Result = new L5PR_GPFPID_1204();
            //Put your code here
            L5PR_GPFT_1200 resultProject = new L5PR_GPFT_1200();

            ORM_TMS_PRO_Project.Query projectsQuery = new ORM_TMS_PRO_Project.Query();
            projectsQuery.TMS_PRO_ProjectID = Parameter.TMS_PRO_ProjectID;
            projectsQuery.IsDeleted         = false;
            projectsQuery.Tenant_RefID      = securityTicket.TenantID;
            List <ORM_TMS_PRO_Project> projects = ORM_TMS_PRO_Project.Query.Search(Connection, Transaction, projectsQuery);

            if (projects.Count == 0)
            {
                return(null);
            }

            ORM_TMS_PRO_Project project = projects.FirstOrDefault();

            ORM_TMS_PRO_Project_2_ProjectGroup.Query project2ProjectGroupQuery = new ORM_TMS_PRO_Project_2_ProjectGroup.Query();
            project2ProjectGroupQuery.TMS_PRO_Project_RefID = Parameter.TMS_PRO_ProjectID;
            project2ProjectGroupQuery.IsDeleted             = false;
            project2ProjectGroupQuery.Tenant_RefID          = securityTicket.TenantID;
            List <ORM_TMS_PRO_Project_2_ProjectGroup> project2ProjectGroup = ORM_TMS_PRO_Project_2_ProjectGroup.Query.Search(Connection, Transaction, project2ProjectGroupQuery);

            ORM_TMS_PRO_Project_2_ProjectGroup resultProject2ProjectGroup = new ORM_TMS_PRO_Project_2_ProjectGroup();

            if (project2ProjectGroup.Count != 0)
            {
                resultProject2ProjectGroup = project2ProjectGroup.FirstOrDefault();
            }

            resultProject.TMS_PRO_ProjectID = project.TMS_PRO_ProjectID;
            resultProject.Name        = project.Name;
            resultProject.Description = project.Description;
            resultProject.IsArchived  = project.IsArchived;
            resultProject.Default_CostCenter_RefID    = project.Default_CostCenter_RefID;
            resultProject.AssignmentID                = resultProject2ProjectGroup.AssignmentID;
            resultProject.TMS_PRO_Project_Group_RefID = resultProject2ProjectGroup.TMS_PRO_Project_Group_RefID;

            returnValue.Result.Project = resultProject;
            return(returnValue);

            #endregion UserCode
        }