コード例 #1
0
        protected static FR_L5DD_GASIfRID_1507_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5DD_GASIfRID_1507 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5DD_GASIfRID_1507_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_KPRS_DueDiligences.Atomic.Retrieval.SQL.cls_Get_StaircaseSubmisionInfo_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(\s*collate\s+\w+)?", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                command.CommandText = regex.Replace(command.CommandText, "");
            }

            List <L5DD_GASIfRID_1507_raw> results = new List <L5DD_GASIfRID_1507_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[] { "Staircase_DocumentHeader_RefID", "Staircase_Comment", "AverageRating_RefID", "RES_STR_StaircaseID", "RES_BLD_Staircase_RefID", "StaircaseSize_Unit_RefID", "StaircaseSize_Value", "GlobalPropertyMatchingID", "RES_STR_Staircase_PropertyID", "RES_STR_Staircase_PropertyAssessmentID", "Rating_RefID", "DocumentHeader_RefID", "PropertyAssessment_Comment", "RES_STR_Staircase_RequiredActionID", "SelectedActionVersion_RefID", "RequiredAction_Comment", "Action_PricePerUnit_RefID", "Action_Unit_RefID", "Action_UnitAmount", "IsCustom", "IfCustom_Name", "IfCustom_Description", "Action_Timeframe_RefID", "EffectivePrice_RefID", "Action_Name_DictID", "PriceValue_Amount" });
                while (reader.Read())
                {
                    L5DD_GASIfRID_1507_raw resultItem = new L5DD_GASIfRID_1507_raw();
                    //0:Parameter Staircase_DocumentHeader_RefID of type Guid
                    resultItem.Staircase_DocumentHeader_RefID = reader.GetGuid(0);
                    //1:Parameter Staircase_Comment of type String
                    resultItem.Staircase_Comment = reader.GetString(1);
                    //2:Parameter AverageRating_RefID of type Guid
                    resultItem.AverageRating_RefID = reader.GetGuid(2);
                    //3:Parameter RES_STR_StaircaseID of type Guid
                    resultItem.RES_STR_StaircaseID = reader.GetGuid(3);
                    //4:Parameter RES_BLD_Staircase_RefID of type Guid
                    resultItem.RES_BLD_Staircase_RefID = reader.GetGuid(4);
                    //5:Parameter StaircaseSize_Unit_RefID of type Guid
                    resultItem.StaircaseSize_Unit_RefID = reader.GetGuid(5);
                    //6:Parameter StaircaseSize_Value of type Double
                    resultItem.StaircaseSize_Value = reader.GetDouble(6);
                    //7:Parameter GlobalPropertyMatchingID of type String
                    resultItem.GlobalPropertyMatchingID = reader.GetString(7);
                    //8:Parameter RES_STR_Staircase_PropertyID of type Guid
                    resultItem.RES_STR_Staircase_PropertyID = reader.GetGuid(8);
                    //9:Parameter RES_STR_Staircase_PropertyAssessmentID of type Guid
                    resultItem.RES_STR_Staircase_PropertyAssessmentID = reader.GetGuid(9);
                    //10:Parameter Rating_RefID of type Guid
                    resultItem.Rating_RefID = reader.GetGuid(10);
                    //11:Parameter DocumentHeader_RefID of type Guid
                    resultItem.DocumentHeader_RefID = reader.GetGuid(11);
                    //12:Parameter PropertyAssessment_Comment of type String
                    resultItem.PropertyAssessment_Comment = reader.GetString(12);
                    //13:Parameter RES_STR_Staircase_RequiredActionID of type Guid
                    resultItem.RES_STR_Staircase_RequiredActionID = reader.GetGuid(13);
                    //14:Parameter SelectedActionVersion_RefID of type Guid
                    resultItem.SelectedActionVersion_RefID = reader.GetGuid(14);
                    //15:Parameter RequiredAction_Comment of type String
                    resultItem.RequiredAction_Comment = reader.GetString(15);
                    //16:Parameter Action_PricePerUnit_RefID of type Guid
                    resultItem.Action_PricePerUnit_RefID = reader.GetGuid(16);
                    //17:Parameter Action_Unit_RefID of type Guid
                    resultItem.Action_Unit_RefID = reader.GetGuid(17);
                    //18:Parameter Action_UnitAmount of type double
                    resultItem.Action_UnitAmount = reader.GetDouble(18);
                    //19:Parameter IsCustom of type bool
                    resultItem.IsCustom = reader.GetBoolean(19);
                    //20:Parameter IfCustom_Name of type String
                    resultItem.IfCustom_Name = reader.GetString(20);
                    //21:Parameter IfCustom_Description of type String
                    resultItem.IfCustom_Description = reader.GetString(21);
                    //22:Parameter Action_Timeframe_RefID of type Guid
                    resultItem.Action_Timeframe_RefID = reader.GetGuid(22);
                    //23:Parameter EffectivePrice_RefID of type Guid
                    resultItem.EffectivePrice_RefID = reader.GetGuid(23);
                    //24:Parameter Action_Name of type Dict
                    resultItem.Action_Name             = reader.GetDictionary(24);
                    resultItem.Action_Name.SourceTable = "res_act_action_version";
                    loader.Append(resultItem.Action_Name);
                    //25:Parameter PriceValue_Amount of type double
                    resultItem.PriceValue_Amount = reader.GetDouble(25);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw ex;
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L5DD_GASIfRID_1507_raw.Convert(results).ToArray();
            return(returnStatus);
        }
コード例 #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_GASIfRID_1507_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5DD_GASIfRID_1507 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
コード例 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5DD_GASIfRID_1507_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5DD_GASIfRID_1507 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5DD_GASIfRID_1507_Array functionReturn = new FR_L5DD_GASIfRID_1507_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);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5DD_GASIfRID_1507_Array Invoke(string ConnectionString, P_L5DD_GASIfRID_1507 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }