protected static FR_L5OF_GOFSH_1323 Execute(DbConnection Connection, DbTransaction Transaction, P_L5OF_GOFSH_1323 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5OF_GOFSH_1323(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_VacationPlanner_Office.Atomic.Retrieval.SQL.cls_get_Offices_For_Shortname.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; CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ShortName", Parameter.ShortName); List <L5OF_GOFSH_1323_raw> results = new List <L5OF_GOFSH_1323_raw>(); 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_STR_OfficeID", "Region_RefID", "BillingAddress_CMN_AddressID", "BillingAddress_Street_Name", "BillingAddress_Street_Number", "BillingAddress_City_AdministrativeDistrict", "BillingAddress_City_Region", "BillingAddress_City_Name", "BillingAddress_City_PostalCode", "BillingAddress_Province_Name", "BillingAddress_Country_Name", "BillingAddress_Country_ISOCode", "ShippingAddress_CMN_AddressID", "ShippingAddress_Street_Name", "ShippingAddress_City_AdministrativeDistrict", "ShippingAddress_Street_Number", "ShippingAddress_City_Region", "ShippingAddress_City_Name", "ShippingAddress_Province_Name", "ShippingAddress_City_PostalCode", "ShippingAddress_Country_Name", "ShippingAddress_Country_ISOCode", "Default_PhoneNumber", "Default_FaxNumber", "Office_Name_DictID", "Office_Description_DictID", "Office_ShortName", "CMN_CAL_CalendarInstance_RefID", "CMN_BPT_BusinessParticipantID", "CMN_BPT_EMP_EmployeeID", "LastName", "CMN_STR_Office_ResponsiblePersonID", "FirstName", "AssignmentID", "CMN_STR_CostCenterID", "InternalID", "Name_DictID" }); while (reader.Read()) { L5OF_GOFSH_1323_raw resultItem = new L5OF_GOFSH_1323_raw(); //0:Parameter CMN_STR_OfficeID of type Guid resultItem.CMN_STR_OfficeID = reader.GetGuid(0); //1:Parameter Region_RefID of type Guid resultItem.Region_RefID = reader.GetGuid(1); //2:Parameter BillingAddress_CMN_AddressID of type Guid resultItem.BillingAddress_CMN_AddressID = reader.GetGuid(2); //3:Parameter BillingAddress_Street_Name of type String resultItem.BillingAddress_Street_Name = reader.GetString(3); //4:Parameter BillingAddress_Street_Number of type String resultItem.BillingAddress_Street_Number = reader.GetString(4); //5:Parameter BillingAddress_City_AdministrativeDistrict of type String resultItem.BillingAddress_City_AdministrativeDistrict = reader.GetString(5); //6:Parameter BillingAddress_City_Region of type String resultItem.BillingAddress_City_Region = reader.GetString(6); //7:Parameter BillingAddress_City_Name of type String resultItem.BillingAddress_City_Name = reader.GetString(7); //8:Parameter BillingAddress_City_PostalCode of type String resultItem.BillingAddress_City_PostalCode = reader.GetString(8); //9:Parameter BillingAddress_Province_Name of type String resultItem.BillingAddress_Province_Name = reader.GetString(9); //10:Parameter BillingAddress_Country_Name of type String resultItem.BillingAddress_Country_Name = reader.GetString(10); //11:Parameter BillingAddress_Country_ISOCode of type String resultItem.BillingAddress_Country_ISOCode = reader.GetString(11); //12:Parameter ShippingAddress_CMN_AddressID of type Guid resultItem.ShippingAddress_CMN_AddressID = reader.GetGuid(12); //13:Parameter ShippingAddress_Street_Name of type String resultItem.ShippingAddress_Street_Name = reader.GetString(13); //14:Parameter ShippingAddress_City_AdministrativeDistrict of type String resultItem.ShippingAddress_City_AdministrativeDistrict = reader.GetString(14); //15:Parameter ShippingAddress_Street_Number of type String resultItem.ShippingAddress_Street_Number = reader.GetString(15); //16:Parameter ShippingAddress_City_Region of type String resultItem.ShippingAddress_City_Region = reader.GetString(16); //17:Parameter ShippingAddress_City_Name of type String resultItem.ShippingAddress_City_Name = reader.GetString(17); //18:Parameter ShippingAddress_Province_Name of type String resultItem.ShippingAddress_Province_Name = reader.GetString(18); //19:Parameter ShippingAddress_City_PostalCode of type String resultItem.ShippingAddress_City_PostalCode = reader.GetString(19); //20:Parameter ShippingAddress_Country_Name of type String resultItem.ShippingAddress_Country_Name = reader.GetString(20); //21:Parameter ShippingAddress_Country_ISOCode of type String resultItem.ShippingAddress_Country_ISOCode = reader.GetString(21); //22:Parameter Default_PhoneNumber of type String resultItem.Default_PhoneNumber = reader.GetString(22); //23:Parameter Default_FaxNumber of type String resultItem.Default_FaxNumber = reader.GetString(23); //24:Parameter OfficeName of type Dict resultItem.OfficeName = reader.GetDictionary(24); resultItem.OfficeName.SourceTable = "cmn_str_offices"; loader.Append(resultItem.OfficeName); //25:Parameter OfficeDescription of type Dict resultItem.OfficeDescription = reader.GetDictionary(25); resultItem.OfficeDescription.SourceTable = "cmn_str_offices"; loader.Append(resultItem.OfficeDescription); //26:Parameter Office_ShortName of type String resultItem.Office_ShortName = reader.GetString(26); //27:Parameter CMN_CAL_CalendarInstance_RefID of type Guid resultItem.CMN_CAL_CalendarInstance_RefID = reader.GetGuid(27); //28:Parameter CMN_BPT_BusinessParticipantID of type Guid resultItem.CMN_BPT_BusinessParticipantID = reader.GetGuid(28); //29:Parameter CMN_BPT_EMP_EmployeeID of type Guid resultItem.CMN_BPT_EMP_EmployeeID = reader.GetGuid(29); //30:Parameter LastName of type String resultItem.LastName = reader.GetString(30); //31:Parameter CMN_STR_Office_ResponsiblePersonID of type Guid resultItem.CMN_STR_Office_ResponsiblePersonID = reader.GetGuid(31); //32:Parameter FirstName of type String resultItem.FirstName = reader.GetString(32); //33:Parameter AssignmentID of type Guid resultItem.AssignmentID = reader.GetGuid(33); //34:Parameter CMN_STR_CostCenterID of type Guid resultItem.CMN_STR_CostCenterID = reader.GetGuid(34); //35:Parameter InternalID of type String resultItem.InternalID = reader.GetString(35); //36:Parameter CostcenterName of type Dict resultItem.CostcenterName = reader.GetDictionary(36); resultItem.CostcenterName.SourceTable = "cmn_str_costcenters"; loader.Append(resultItem.CostcenterName); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_get_Offices_For_Shortname", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L5OF_GOFSH_1323_raw.Convert(results).FirstOrDefault(); return(returnStatus); }
///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_L5OF_GOFSH_1323 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5OF_GOFSH_1323 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5OF_GOFSH_1323 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5OF_GOFSH_1323 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5OF_GOFSH_1323 functionReturn = new FR_L5OF_GOFSH_1323(); 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_Offices_For_Shortname", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5OF_GOFSH_1323 Invoke(string ConnectionString, P_L5OF_GOFSH_1323 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }