///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L6TN_GSFT_1017 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L6TN_GSFT_1017 functionReturn = new FR_L6TN_GSFT_1017(); 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 new Exception("Exception occured in method cls_Get_Settings_For_Tenant", ex); } return(functionReturn); }
protected static FR_L6TN_GSFT_1017 Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L6TN_GSFT_1017(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL6_VacationPlanner_Tenant.Atomic.Retrieval.SQL.cls_Get_Settings_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 <L6TN_GSFT_1017> results = new List <L6TN_GSFT_1017>(); 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[] { "IsUsing_Offices", "IsUsing_WorkAreas", "IsUsing_Workplaces", "IsUsing_CostCenters", "NumberOfResponsiblePersonsRequiredToApprove", "CMN_CAL_APR_ResponsiblePersonID", "CMN_CAL_Event_ApprovalProcess_TypeID", "CMN_Tenant_ActiveApprovalProcessTypeID" }); while (reader.Read()) { L6TN_GSFT_1017 resultItem = new L6TN_GSFT_1017(); //0:Parameter IsUsing_Offices of type bool resultItem.IsUsing_Offices = reader.GetBoolean(0); //1:Parameter IsUsing_WorkAreas of type bool resultItem.IsUsing_WorkAreas = reader.GetBoolean(1); //2:Parameter IsUsing_Workplaces of type bool resultItem.IsUsing_Workplaces = reader.GetBoolean(2); //3:Parameter IsUsing_CostCenters of type bool resultItem.IsUsing_CostCenters = reader.GetBoolean(3); //4:Parameter NumberOfResponsiblePersonsRequiredToApprove of type int resultItem.NumberOfResponsiblePersonsRequiredToApprove = reader.GetInteger(4); //5:Parameter CMN_CAL_APR_ResponsiblePersonID of type Guid resultItem.CMN_CAL_APR_ResponsiblePersonID = reader.GetGuid(5); //6:Parameter CMN_CAL_Event_ApprovalProcess_TypeID of type Guid resultItem.CMN_CAL_Event_ApprovalProcess_TypeID = reader.GetGuid(6); //7:Parameter CMN_Tenant_ActiveApprovalProcessTypeID of type Guid resultItem.CMN_Tenant_ActiveApprovalProcessTypeID = reader.GetGuid(7); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_Settings_For_Tenant", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.FirstOrDefault(); return(returnStatus); }