///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5PR_GPFT_1200_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5PR_GPFT_1200_Array functionReturn = new FR_L5PR_GPFT_1200_Array(); try { if (cleanupConnection == true) { Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString); Connection.Open(); } if (cleanupTransaction == true) { Transaction = Connection.BeginTransaction(); } functionReturn = Execute(Connection, Transaction, 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 ex; } return(functionReturn); }
protected static FR_L5PR_GPFT_1200_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5PR_GPFT_1200_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_Plannico_Projects.Atomic.Retrieval.SQL.cls_Get_Projects_For_Tenant.sql"; command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd(); CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket); command.CommandTimeout = QueryTimeout; List <L5PR_GPFT_1200> results = new List <L5PR_GPFT_1200>(); var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction); var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader()); try { reader.SetOrdinals(new string[] { "Name_DictID", "Description_DictID", "TMS_PRO_ProjectID", "IsArchived", "AssignmentID", "TMS_PRO_Project_Group_RefID", "Default_CostCenter_RefID" }); while (reader.Read()) { L5PR_GPFT_1200 resultItem = new L5PR_GPFT_1200(); //0:Parameter Name of type Dict resultItem.Name = reader.GetDictionary(0); resultItem.Name.SourceTable = "tms_pro_projects"; loader.Append(resultItem.Name); //1:Parameter Description of type Dict resultItem.Description = reader.GetDictionary(1); resultItem.Description.SourceTable = "tms_pro_projects"; loader.Append(resultItem.Description); //2:Parameter TMS_PRO_ProjectID of type Guid resultItem.TMS_PRO_ProjectID = reader.GetGuid(2); //3:Parameter IsArchived of type bool resultItem.IsArchived = reader.GetBoolean(3); //4:Parameter AssignmentID of type Guid resultItem.AssignmentID = reader.GetGuid(4); //5:Parameter TMS_PRO_Project_Group_RefID of type Guid resultItem.TMS_PRO_Project_Group_RefID = reader.GetGuid(5); //6:Parameter Default_CostCenter_RefID of type Guid resultItem.Default_CostCenter_RefID = reader.GetGuid(6); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw ex; } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.ToArray(); return(returnStatus); }