Beispiel #1
0
        protected static FR_L5DD_GFSIfRID_1438_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5DD_GFSIfRID_1438 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5DD_GFSIfRID_1438_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_KPRS_DueDiligences.Atomic.Retrieval.SQL.cls_Get_FacadeSubmisionInfo_For_RevisionID.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, "RevisionID", Parameter.RevisionID);

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "BuildingPartID", Parameter.BuildingPartID);

            if (Parameter.BuildingPartID_IsSpecified == false)
            {
                var regex = new System.Text.RegularExpressions.Regex(@"((and|or)\s*)?(\w*\.)?\w*\s*(=|like|<|>)\s*@BuildingPartID", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                command.CommandText = regex.Replace(command.CommandText, "");
            }


            List <L5DD_GFSIfRID_1438_raw> results = new List <L5DD_GFSIfRID_1438_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[] { "RES_STR_FacadeID", "Facade_DocumentHeader_RefID", "Facade_Comment", "AverageRating_RefID", "RES_BLD_Facade_RefID", "RES_STR_Facade_PropertyAssessmentID", "DocumentHeader_RefID", "Rating_RefID", "GlobalPropertyMatchingID", "RES_STR_Facade_PropertyID", "PropertyAssessment_Comment", "SelectedActionVersion_RefID", "Action_PricePerUnit_RefID", "Action_UnitAmount", "Action_Unit_RefID", "RES_STR_Facade_RequiredActionID", "IfCustom_Description", "IfCustom_Name", "IsCustom", "Action_Timeframe_RefID", "RequiredActions_Comment", "EffectivePrice_RefID", "Action_Name_DictID", "PriceValue_Amount" });
                while (reader.Read())
                {
                    L5DD_GFSIfRID_1438_raw resultItem = new L5DD_GFSIfRID_1438_raw();
                    //0:Parameter RES_STR_FacadeID of type Guid
                    resultItem.RES_STR_FacadeID = reader.GetGuid(0);
                    //1:Parameter Facade_DocumentHeader_RefID of type Guid
                    resultItem.Facade_DocumentHeader_RefID = reader.GetGuid(1);
                    //2:Parameter Facade_Comment of type String
                    resultItem.Facade_Comment = reader.GetString(2);
                    //3:Parameter AverageRating_RefID of type Guid
                    resultItem.AverageRating_RefID = reader.GetGuid(3);
                    //4:Parameter RES_BLD_Facade_RefID of type Guid
                    resultItem.RES_BLD_Facade_RefID = reader.GetGuid(4);
                    //5:Parameter RES_STR_Facade_PropertyAssessmentID of type Guid
                    resultItem.RES_STR_Facade_PropertyAssessmentID = reader.GetGuid(5);
                    //6:Parameter DocumentHeader_RefID of type Guid
                    resultItem.DocumentHeader_RefID = reader.GetGuid(6);
                    //7:Parameter Rating_RefID of type Guid
                    resultItem.Rating_RefID = reader.GetGuid(7);
                    //8:Parameter GlobalPropertyMatchingID of type String
                    resultItem.GlobalPropertyMatchingID = reader.GetString(8);
                    //9:Parameter RES_STR_Facade_PropertyID of type Guid
                    resultItem.RES_STR_Facade_PropertyID = reader.GetGuid(9);
                    //10:Parameter PropertyAssessment_Comment of type String
                    resultItem.PropertyAssessment_Comment = reader.GetString(10);
                    //11:Parameter SelectedActionVersion_RefID of type Guid
                    resultItem.SelectedActionVersion_RefID = reader.GetGuid(11);
                    //12:Parameter Action_PricePerUnit_RefID of type Guid
                    resultItem.Action_PricePerUnit_RefID = reader.GetGuid(12);
                    //13:Parameter Action_UnitAmount of type double
                    resultItem.Action_UnitAmount = reader.GetDouble(13);
                    //14:Parameter Action_Unit_RefID of type Guid
                    resultItem.Action_Unit_RefID = reader.GetGuid(14);
                    //15:Parameter RES_STR_Facade_RequiredActionID of type Guid
                    resultItem.RES_STR_Facade_RequiredActionID = reader.GetGuid(15);
                    //16:Parameter IfCustom_Description of type String
                    resultItem.IfCustom_Description = reader.GetString(16);
                    //17:Parameter IfCustom_Name of type String
                    resultItem.IfCustom_Name = reader.GetString(17);
                    //18:Parameter IsCustom of type bool
                    resultItem.IsCustom = reader.GetBoolean(18);
                    //19:Parameter Action_Timeframe_RefID of type Guid
                    resultItem.Action_Timeframe_RefID = reader.GetGuid(19);
                    //20:Parameter RequiredActions_Comment of type String
                    resultItem.RequiredActions_Comment = reader.GetString(20);
                    //21:Parameter EffectivePrice_RefID of type Guid
                    resultItem.EffectivePrice_RefID = reader.GetGuid(21);
                    //22:Parameter Action_Name of type Dict
                    resultItem.Action_Name             = reader.GetDictionary(22);
                    resultItem.Action_Name.SourceTable = "res_act_action_version";
                    loader.Append(resultItem.Action_Name);
                    //23:Parameter PriceValue_Amount of type double
                    resultItem.PriceValue_Amount = reader.GetDouble(23);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_FacadeSubmisionInfo_For_RevisionID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L5DD_GFSIfRID_1438_raw.Convert(results).ToArray();
            return(returnStatus);
        }
Beispiel #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5DD_GFSIfRID_1438_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5DD_GFSIfRID_1438 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Beispiel #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5DD_GFSIfRID_1438_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5DD_GFSIfRID_1438 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5DD_GFSIfRID_1438_Array functionReturn = new FR_L5DD_GFSIfRID_1438_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 new Exception("Exception occured in method cls_Get_FacadeSubmisionInfo_For_RevisionID", ex);
            }
            return(functionReturn);
        }
Beispiel #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5DD_GFSIfRID_1438_Array Invoke(string ConnectionString, P_L5DD_GFSIfRID_1438 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }