Esempio n. 1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L2PR_SP_1040 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here
            if (Parameter.ArchiveOrDelete == "Delete")
            {
                foreach (var projectID in Parameter.Project_IDs_to_Save)
                {
                    P_L3SPFT_SPN_1100 projectParameter = new P_L3SPFT_SPN_1100();
                    projectParameter.IsDeleted         = true;
                    projectParameter.TMS_PRO_ProjectID = Guid.Parse(projectID);
                    cls_Save_Admin_Project_for_Tenant.Invoke(Connection, Transaction, projectParameter, securityTicket);
                }
            }
            else if (Parameter.ArchiveOrDelete == "Archive")
            {
                foreach (var projectID in Parameter.Project_IDs_to_Save)
                {
                    P_L3SPFT_SPN_1100 projectParameter = new P_L3SPFT_SPN_1100();
                    projectParameter.IsArchived        = true;
                    projectParameter.TMS_PRO_ProjectID = Guid.Parse(projectID);
                    cls_Save_Admin_Project_for_Tenant.Invoke(Connection, Transaction, projectParameter, securityTicket);
                }
            }

            else if (Parameter.ArchiveOrDelete == "Unarchive")
            {
                foreach (var projectID in Parameter.Project_IDs_to_Save)
                {
                    P_L2PR_UPfPID_1438 parameter = new P_L2PR_UPfPID_1438();
                    parameter.TMS_PRO_ProjectID = Guid.Parse(projectID);

                    cls_Unarchive_Project_for_ProjectID.Invoke(Connection, Transaction, parameter, securityTicket);

                    //P_L3SPFT_SPN_1100 projectParameter = new P_L3SPFT_SPN_1100();
                    //projectParameter.IsArchived = false;
                    //projectParameter.TMS_PRO_ProjectID = Guid.Parse(projectID);
                    //cls_Save_Admin_Project_for_Tenant.Invoke(Connection, Transaction, projectParameter, securityTicket);
                }
            }

            return(returnValue);

            #endregion UserCode
        }
Esempio n. 2
0
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, P_L2PR_SP_1040 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
Esempio n. 3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L2PR_SP_1040 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

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