///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L6RP_GaRPfT_1139_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6RP_GaRPfT_1139 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L6RP_GaRPfT_1139_Array functionReturn = new FR_L6RP_GaRPfT_1139_Array(); 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 ex; } return(functionReturn); }
protected static FR_L6RP_GaRPfT_1139_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6RP_GaRPfT_1139 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L6RP_GaRPfT_1139_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL6_KPRS_RealestateProperty.Atomic.Retrieval.SQL.cls_Get_all_RealestateProperties_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; CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "UploaderUserName", Parameter.UploaderUserName); if (Parameter.UploaderUserName_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@UploaderUserName(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Title", Parameter.Title); if (Parameter.Title_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@Title(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "StreetName", Parameter.StreetName); if (Parameter.StreetName_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@StreetName(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "StreetNumber", Parameter.StreetNumber); if (Parameter.StreetNumber_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@StreetNumber(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "City", Parameter.City); if (Parameter.City_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@City(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Province", Parameter.Province); if (Parameter.Province_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@Province(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Region", Parameter.Region); if (Parameter.Region_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@Region(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ZipCode", Parameter.ZipCode); if (Parameter.ZipCode_IsSpecified == false) { var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@ZipCode(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); command.CommandText = regex.Replace(command.CommandText, ""); } if (Parameter.Country_IsSpecified == true) { //var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@Country(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase); //command.CommandText = regex.Replace(command.CommandText, ""); command.CommandText += " And \ncmn_addresses.Country_ISOCode In (@CountryISO)"; CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CountryISO", Parameter.Country); } List <L6RP_GaRPfT_1139_raw> results = new List <L6RP_GaRPfT_1139_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[] { "Username", "USR_AccountID", "RealestateProperty_Title", "Street_Name", "Street_Number", "City_AdministrativeDistrict", "City_Region", "City_Name", "Province_Name", "City_PostalCode", "Country_Name", "Country_ISOCode", "RES_RealestatePropertyID", "Creation_Timestamp", "Geolocation_Lattitude", "Geolocation_Longitude", "RES_BLD_BuildingID", "Building_Name", "Building_BalconyPortionPercent" }); while (reader.Read()) { L6RP_GaRPfT_1139_raw resultItem = new L6RP_GaRPfT_1139_raw(); //0:Parameter Username of type String resultItem.Username = reader.GetString(0); //1:Parameter USR_AccountID of type Guid resultItem.USR_AccountID = reader.GetGuid(1); //2:Parameter RealestateProperty_Title of type String resultItem.RealestateProperty_Title = reader.GetString(2); //3:Parameter Street_Name of type String resultItem.Street_Name = reader.GetString(3); //4:Parameter Street_Number of type String resultItem.Street_Number = reader.GetString(4); //5:Parameter City_AdministrativeDistrict of type String resultItem.City_AdministrativeDistrict = reader.GetString(5); //6:Parameter City_Region of type String resultItem.City_Region = reader.GetString(6); //7:Parameter City_Name of type String resultItem.City_Name = reader.GetString(7); //8:Parameter Province_Name of type String resultItem.Province_Name = reader.GetString(8); //9:Parameter City_PostalCode of type String resultItem.City_PostalCode = reader.GetString(9); //10:Parameter Country_Name of type String resultItem.Country_Name = reader.GetString(10); //11:Parameter Country_ISOCode of type String resultItem.Country_ISOCode = reader.GetString(11); //12:Parameter RES_RealestatePropertyID of type Guid resultItem.RES_RealestatePropertyID = reader.GetGuid(12); //13:Parameter Creation_Timestamp of type DateTime resultItem.Creation_Timestamp = reader.GetDate(13); //14:Parameter Geolocation_Lattitude of type String resultItem.Geolocation_Lattitude = reader.GetString(14); //15:Parameter Geolocation_Longitude of type String resultItem.Geolocation_Longitude = reader.GetString(15); //16:Parameter RES_BLD_BuildingID of type Guid resultItem.RES_BLD_BuildingID = reader.GetGuid(16); //17:Parameter Building_Name of type String resultItem.Building_Name = reader.GetString(17); //18:Parameter Building_BalconyPortionPercent of type String resultItem.Building_BalconyPortionPercent = reader.GetString(18); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw ex; } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L6RP_GaRPfT_1139_raw.Convert(results, Parameter.StartIndex, Parameter.RowCount).ToArray(); return(returnStatus); }