Ejemplo n.º 1
0
        protected static FR_L5DD_GHSIfRID_1448_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5DD_GHSIfRID_1448 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5DD_GHSIfRID_1448_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_KPRS_DueDiligences.Atomic.Retrieval.SQL.cls_Get_HVACRSubmisionInfo_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_GHSIfRID_1448_raw> results = new List <L5DD_GHSIfRID_1448_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_HVACRID", "RES_BLD_HVACR_RefID", "HVACR_DocumentHeader_RefID", "AverageRating_RefID", "HVACR_Comment", "RES_STR_HVACR_PropertyAssessmentID", "GlobalPropertyMatchingID", "Rating_RefID", "PropertyAssessment_Comment", "DocumentHeader_RefID", "RES_STR_HVACR_PropertyID", "Action_Timeframe_RefID", "IfCustom_Description", "IfCustom_Name", "IsCustom", "Action_Unit_RefID", "Action_PricePerUnit_RefID", "Action_UnitAmount", "SelectedActionVersion_RefID", "RES_STR_HVACR_RequiredActionID", "RequiredAction_Comment", "EffectivePrice_RefID", "Action_Name_DictID", "PriceValue_Amount" });
                while (reader.Read())
                {
                    L5DD_GHSIfRID_1448_raw resultItem = new L5DD_GHSIfRID_1448_raw();
                    //0:Parameter RES_STR_HVACRID of type Guid
                    resultItem.RES_STR_HVACRID = reader.GetGuid(0);
                    //1:Parameter RES_BLD_HVACR_RefID of type Guid
                    resultItem.RES_BLD_HVACR_RefID = reader.GetGuid(1);
                    //2:Parameter HVACR_DocumentHeader_RefID of type Guid
                    resultItem.HVACR_DocumentHeader_RefID = reader.GetGuid(2);
                    //3:Parameter AverageRating_RefID of type Guid
                    resultItem.AverageRating_RefID = reader.GetGuid(3);
                    //4:Parameter HVACR_Comment of type String
                    resultItem.HVACR_Comment = reader.GetString(4);
                    //5:Parameter RES_STR_HVACR_PropertyAssessmentID of type Guid
                    resultItem.RES_STR_HVACR_PropertyAssessmentID = reader.GetGuid(5);
                    //6:Parameter GlobalPropertyMatchingID of type String
                    resultItem.GlobalPropertyMatchingID = reader.GetString(6);
                    //7:Parameter Rating_RefID of type Guid
                    resultItem.Rating_RefID = reader.GetGuid(7);
                    //8:Parameter PropertyAssessment_Comment of type String
                    resultItem.PropertyAssessment_Comment = reader.GetString(8);
                    //9:Parameter DocumentHeader_RefID of type Guid
                    resultItem.DocumentHeader_RefID = reader.GetGuid(9);
                    //10:Parameter RES_STR_HVACR_PropertyID of type Guid
                    resultItem.RES_STR_HVACR_PropertyID = reader.GetGuid(10);
                    //11:Parameter Action_Timeframe_RefID of type Guid
                    resultItem.Action_Timeframe_RefID = reader.GetGuid(11);
                    //12:Parameter IfCustom_Description of type String
                    resultItem.IfCustom_Description = reader.GetString(12);
                    //13:Parameter IfCustom_Name of type String
                    resultItem.IfCustom_Name = reader.GetString(13);
                    //14:Parameter IsCustom of type bool
                    resultItem.IsCustom = reader.GetBoolean(14);
                    //15:Parameter Action_Unit_RefID of type Guid
                    resultItem.Action_Unit_RefID = reader.GetGuid(15);
                    //16:Parameter Action_PricePerUnit_RefID of type Guid
                    resultItem.Action_PricePerUnit_RefID = reader.GetGuid(16);
                    //17:Parameter Action_UnitAmount of type double
                    resultItem.Action_UnitAmount = reader.GetDouble(17);
                    //18:Parameter SelectedActionVersion_RefID of type Guid
                    resultItem.SelectedActionVersion_RefID = reader.GetGuid(18);
                    //19:Parameter RES_STR_HVACR_RequiredActionID of type Guid
                    resultItem.RES_STR_HVACR_RequiredActionID = reader.GetGuid(19);
                    //20:Parameter RequiredAction_Comment of type String
                    resultItem.RequiredAction_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_HVACRSubmisionInfo_For_RevisionID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L5DD_GHSIfRID_1448_raw.Convert(results).ToArray();
            return(returnStatus);
        }
Ejemplo n.º 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_GHSIfRID_1448_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5DD_GHSIfRID_1448 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Ejemplo n.º 3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5DD_GHSIfRID_1448_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5DD_GHSIfRID_1448 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5DD_GHSIfRID_1448_Array functionReturn = new FR_L5DD_GHSIfRID_1448_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_HVACRSubmisionInfo_For_RevisionID", ex);
            }
            return(functionReturn);
        }
Ejemplo n.º 4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5DD_GHSIfRID_1448_Array Invoke(string ConnectionString, P_L5DD_GHSIfRID_1448 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }