Пример #1
0
        /// <summary>
        ///
        /// This method will do a data lookup of the value by looking for the value in the cached domain.
        ///
        /// </summary>
        public string ExecuteCacheCheck(string psArg1, string psArg2, string psArg3, string psArg4)
        {
            string sResultValue = "";

            if (IsDomainQuery && !String.IsNullOrEmpty(psArg1) && CachedDomain.Contains(psArg1))
            {
                sResultValue = psArg1;
            }

            return(sResultValue);
        }
Пример #2
0
        /// <summary>
        ///
        /// This method will assist with retrieving the entire domain
        ///
        /// NOTE: UNDER CONSTRUCTION
        ///
        /// </summary>
        public HashSet <string> RetrieveDomainSet()
        {
            var DomainSet = new HashSet <string>();

            if (IsDomainQuery)
            {
                try
                {
                    using (SqlConnection DbConn = GetConnection())
                    {
                        DbConn.Open();

                        // NOTE: Use parameters in prepared statement with query here?
                        string sSqlQuery =
                            String.Format(this.CustomOpSource.SqlQueryOrProcedure);

                        using (SqlCommand QueryCmd = new SqlCommand(sSqlQuery, DbConn))
                        {
                            using (SqlDataReader dataReader = QueryCmd.ExecuteReader())
                            {
                                if (dataReader.Read())
                                {
                                    // NOTE: For the time being, it will return the first value of the first column
                                    if (!dataReader.IsDBNull(0))
                                    {
                                        string sResultValue = dataReader[0].ToString();
                                        CachedDomain.Add(sResultValue);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    // NOTE: Do something here?
                }
            }

            return(DomainSet);
        }