///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5AR_GART_1118_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5AR_GART_1118_Array functionReturn = new FR_L5AR_GART_1118_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_L5AR_GART_1118_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5AR_GART_1118_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_VacationPlanner_Absence.Atomic.Retrieval.SQL.cls_Get_AbsenceReasons_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 <L5AR_GART_1118> results = new List <L5AR_GART_1118>(); 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[] { "CMN_BPT_STA_AbsenceReasonID", "Parent_RefID", "ShortName", "ColorCode", "IsIncludedInCapacityCalculation", "IsAuthorizationRequired", "IsAllowedAbsence", "IsCarryOverEnabled", "IsDeactivated", "Creation_Timestamp", "Name_DictID", "Description_DictID", "IsLeaveTimeReducing_WorkingHours", "IsLeaveTimeReducingOverTime" }); while (reader.Read()) { L5AR_GART_1118 resultItem = new L5AR_GART_1118(); //0:Parameter CMN_BPT_STA_AbsenceReasonID of type Guid resultItem.CMN_BPT_STA_AbsenceReasonID = reader.GetGuid(0); //1:Parameter Parent_RefID of type Guid resultItem.Parent_RefID = reader.GetGuid(1); //2:Parameter ShortName of type String resultItem.ShortName = reader.GetString(2); //3:Parameter ColorCode of type String resultItem.ColorCode = reader.GetString(3); //4:Parameter IsIncludedInCapacityCalculation of type bool resultItem.IsIncludedInCapacityCalculation = reader.GetBoolean(4); //5:Parameter IsAuthorizationRequired of type bool resultItem.IsAuthorizationRequired = reader.GetBoolean(5); //6:Parameter IsAllowedAbsence of type bool resultItem.IsAllowedAbsence = reader.GetBoolean(6); //7:Parameter IsCarryOverEnabled of type Boolean resultItem.IsCarryOverEnabled = reader.GetBoolean(7); //8:Parameter IsDeactivated of type Boolean resultItem.IsDeactivated = reader.GetBoolean(8); //9:Parameter Creation_Timestamp of type DateTime resultItem.Creation_Timestamp = reader.GetDate(9); //10:Parameter ReasonName of type Dict resultItem.ReasonName = reader.GetDictionary(10); resultItem.ReasonName.SourceTable = "cmn_bpt_sta_absencereasons"; loader.Append(resultItem.ReasonName); //11:Parameter ReasonDescription of type Dict resultItem.ReasonDescription = reader.GetDictionary(11); resultItem.ReasonDescription.SourceTable = "cmn_bpt_sta_absencereasons"; loader.Append(resultItem.ReasonDescription); //12:Parameter IsLeaveTimeReducing_WorkingHours of type bool resultItem.IsLeaveTimeReducing_WorkingHours = reader.GetBoolean(12); //13:Parameter IsLeaveTimeReducingOverTime of type bool resultItem.IsLeaveTimeReducingOverTime = reader.GetBoolean(13); 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); }