亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stringresourcesdalc.cs

?? BugNET is an issue tracking and project issue management solution built using the ASP.NET web applic
?? CS
字號:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Specialized;
using System.Globalization;
using System.Threading;
using System.Data;
using System.Runtime.Remoting.Contexts;
using System.Runtime.CompilerServices;

namespace BugNET.Providers.ResourceProviders
{
    /// <summary>
    /// Data access component for the StringResources table. 
    /// This type is thread safe.
    /// </summary>
    public class StringResourcesDALC: IDisposable
    {
        private string m_defaultResourceCulture = "en";
        private string m_resourceType = "";

        private SqlConnection m_connection;
        private SqlCommand m_cmdGetResourceByCultureAndKey;
        private SqlCommand m_cmdGetResourcesByCulture;

        /// <summary>
        /// Constructs this instance of the data access 
        /// component supplying a resource type for the instance. 
        /// </summary>
        /// <param name="resourceType">The resource type.</param>
        public StringResourcesDALC(string resourceType)
        {
            // save the resource type for this instance
            this.m_resourceType = resourceType;

            // grab the connection string
            m_connection = new SqlConnection(ConfigurationManager.ConnectionStrings["BugNET"].ConnectionString);

            // command to retrieve the resource the matches 
            // a specific type, culture and key
            m_cmdGetResourceByCultureAndKey = new SqlCommand("SELECT resourceType, cultureCode, resourceKey, resourceValue FROM BugNet_StringResources WHERE (resourceType=@resourceType) AND (cultureCode=@cultureCode) AND (resourceKey=@resourceKey)");
            m_cmdGetResourceByCultureAndKey.Connection = m_connection;
            m_cmdGetResourceByCultureAndKey.Parameters.AddWithValue("resourceType", this.m_resourceType);
            m_cmdGetResourceByCultureAndKey.Parameters.AddWithValue("cultureCode", "");
            m_cmdGetResourceByCultureAndKey.Parameters.AddWithValue("resourceKey", "");

            // command to retrieve all resources for a particular culture
            m_cmdGetResourcesByCulture = new SqlCommand("SELECT resourceType, cultureCode, resourceKey, resourceValue FROM BugNet_StringResources WHERE (resourceType=@resourceType) AND (cultureCode=@cultureCode)");
            m_cmdGetResourcesByCulture.Connection = m_connection;
            m_cmdGetResourcesByCulture.Parameters.AddWithValue("resourceType", this.m_resourceType);
            m_cmdGetResourcesByCulture.Parameters.AddWithValue("cultureCode", "");

        }

        /// <summary>
        /// Uses an open database connection to recurse 
        /// looking for the resource.
        /// Retrieves a resource entry based on the 
        /// specified culture and resource 
        /// key. The resource type is based on this instance of the
        /// StringResourceDALC as passed to the constructor.
        /// Resource fallback follows the same mechanism 
        /// of the .NET 
        /// ResourceManager. Ultimately falling back to the 
        /// default resource
        /// specified in this class.
        /// </summary>
        /// <param name="culture">The culture to search with.</param>
        /// <param name="resourceKey">The resource key to find.</param>
        /// <returns>If found, the resource string is returned. 
        /// Otherwise an empty string is returned.</returns>
        private string GetResourceByCultureAndKeyInternal(CultureInfo culture, string resourceKey)
        {

            // we should only get one back, but just in case, we'll iterate reader results
            StringCollection resources = new StringCollection();
            string resourceValue = null;

            // set up the dynamic query params
            this.m_cmdGetResourceByCultureAndKey.Parameters["cultureCode"].Value = culture.Name;
            this.m_cmdGetResourceByCultureAndKey.Parameters["resourceKey"].Value = resourceKey;

            // get resources from the database
            using (SqlDataReader reader = this.m_cmdGetResourceByCultureAndKey.ExecuteReader())
            {
                while (reader.Read())
                {
                    resources.Add(reader.GetString(reader.GetOrdinal("resourceValue")));
                }
            }

            // we should only get 1 back, this is just to verify the tables aren't incorrect
            if (resources.Count == 0)
            {
                // is this already fallback location?
                if (culture.Name == this.m_defaultResourceCulture)
                {
                    throw new InvalidOperationException(String.Format(Thread.CurrentThread.CurrentUICulture, Properties.Resources.RM_DefaultResourceNotFound, resourceKey));
                }

                // try to get parent culture
                culture = culture.Parent;
                if (culture.Name.Length == 0)
                {
                    // there isn't a parent culture, change to neutral
                    culture = new CultureInfo(this.m_defaultResourceCulture);
                }
                resourceValue = this.GetResourceByCultureAndKeyInternal(culture, resourceKey);
            }
            else if (resources.Count == 1)
            {
                resourceValue = resources[0];
            }
            else
            {
                // if > 1 row returned, log an error, we shouldn't have > 1 value for a resourceKey!
                throw new DataException(String.Format(Thread.CurrentThread.CurrentUICulture, Properties.Resources.RM_DuplicateResourceFound, resourceKey));
            }

            return resourceValue;
        }

        /// <summary>
        /// Returns a dictionary type containing all resources for a 
        /// particular resource type and culture.
        /// The resource type is based on this instance of the
        /// StringResourceDALC as passed to the constructor.
        /// </summary>
        /// <param name="culture">The culture to search for.</param>
        /// <param name="resourceKey">The resource key to 
        /// search for.</param>
        /// <returns>If found, the dictionary contains key/value 
        /// pairs for each 
        /// resource for the specified culture.</returns>
        [MethodImpl(MethodImplOptions.Synchronized)]
        public ListDictionary GetResourcesByCulture(CultureInfo culture)
        {
            // make sure we have a default culture at least
            if (culture == null || culture.Name.Length == 0)
            {
                culture = new CultureInfo(this.m_defaultResourceCulture);
            }

            // set up dynamic query string parameters
            this.m_cmdGetResourcesByCulture.Parameters["cultureCode"].Value = culture.Name;

            // create the dictionary
            ListDictionary resourceDictionary = new ListDictionary();

            // open a connection to gather resource and create the dictionary
            try
            {
                m_connection.Open();

                // get resources from the database
                using (SqlDataReader reader = this.m_cmdGetResourcesByCulture.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string k = reader.GetString(reader.GetOrdinal("resourceKey"));
                        string v = reader.GetString(reader.GetOrdinal("resourceValue"));

                        resourceDictionary.Add(k, v);

                    }
                }

            }
            finally
            {
                m_connection.Close();
            }
            // TODO: check dispose results
            return resourceDictionary;
        }

        /// <summary>
        /// Retrieves a resource entry based on the specified culture and 
        /// resource key. The resource type is based on this instance of the
        /// StringResourceDALC as passed to the constructor.
        /// To optimize performance, this function opens the database connection 
        /// before calling the internal recursive function. 
        /// </summary>
        /// <param name="culture">The culture to search with.</param>
        /// <param name="resourceKey">The resource key to find.</param>
        /// <returns>If found, the resource string is returned. Otherwise an empty string is returned.</returns>
        [MethodImpl(MethodImplOptions.Synchronized)]
        public string GetResourceByCultureAndKey(CultureInfo culture, string resourceKey)
        {
            string resourceValue = string.Empty;

            try
            {

                // make sure we have a default culture at least
                if (culture == null || culture.Name.Length == 0)
                {
                    culture = new CultureInfo(this.m_defaultResourceCulture);
                }

                // open the connection before we call the recursive reading function
                this.m_connection.Open();

                // recurse to find resource, includes fallback behavior
                resourceValue = this.GetResourceByCultureAndKeyInternal(culture, resourceKey);
            }
            finally
            {
                // cleanup the connection, reader won't do that if it was open prior to calling in, and that's what we wanted
                this.m_connection.Close();
            }
            return resourceValue;
        }

        #region IDisposable Members

            public void  Dispose()
            {
                try
                {
                    // TODO: add in idisposable pattern, check what we're cleaning up here
                    this.m_cmdGetResourceByCultureAndKey.Dispose();
                    this.m_cmdGetResourcesByCulture.Dispose();
                    this.m_connection.Dispose();
                }
                catch { }
            }

        #endregion
    }

    public class ResourceRecord
    {
        private string m_resourceType;

        public string ResourceType
        {
            get { return m_resourceType; }
            set { m_resourceType = value; }
        }
        private string m_cultureCode;

        public string CultureCode
        {
            get { return m_cultureCode; }
            set { m_cultureCode = value; }
        }
        private string m_resourceKey;

        public string ResourceKey
        {
            get { return m_resourceKey; }
            set { m_resourceKey = value; }
        }
        private string m_resourceValue;

        public string ResourceValue
        {
            get { return m_resourceValue; }
            set { m_resourceValue = value; }
        }


    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看视频在线| 久久国产精品99精品国产 | 2021国产精品久久精品| 首页国产欧美久久| 在线观看日韩电影| 亚洲你懂的在线视频| 国产乱人伦偷精品视频免下载| 欧美色涩在线第一页| 亚洲人妖av一区二区| voyeur盗摄精品| 久久日韩粉嫩一区二区三区| 午夜视频在线观看一区| 日本丶国产丶欧美色综合| 中文字幕一区二区不卡| 成人午夜免费视频| 国产精品欧美久久久久一区二区| 久久成人久久爱| 久久综合色婷婷| 激情另类小说区图片区视频区| 日韩美女视频一区二区在线观看| 日韩精品成人一区二区三区| 91精品国产一区二区三区| 日韩精品乱码av一区二区| 欧美一区二区三区性视频| 日韩不卡在线观看日韩不卡视频| 欧美精品在线视频| 韩国成人精品a∨在线观看| 久久久精品一品道一区| 成人激情黄色小说| 亚洲国产成人精品视频| 日韩精品综合一本久道在线视频| 久久精品国产精品亚洲红杏| 久久夜色精品一区| 91丨九色丨国产丨porny| 日韩**一区毛片| 精品人在线二区三区| heyzo一本久久综合| 日韩不卡一区二区| 国产精品大尺度| 日韩免费福利电影在线观看| 99久久国产综合色|国产精品| 婷婷开心激情综合| 日本一区二区综合亚洲| 欧美午夜精品久久久久久孕妇 | 亚洲色图制服丝袜| 精品久久久久久久人人人人传媒| 99久久99久久精品免费观看| 麻豆国产一区二区| 亚洲精品成人少妇| 国产情人综合久久777777| 欧美日韩视频在线第一区| 午夜精品久久久久久久| 5858s免费视频成人| 99久久精品国产精品久久| 久久 天天综合| 日韩高清不卡一区二区三区| 一区二区三区四区高清精品免费观看| 国产精品高潮呻吟| 欧美一卡二卡三卡| 国产福利一区二区三区视频在线| 中文字幕久久午夜不卡| 99精品国产一区二区三区不卡| 国产欧美一区二区精品性| 菠萝蜜视频在线观看一区| 欧美国产日韩亚洲一区| 久久久精品免费网站| 亚洲成人免费av| 99精品视频在线免费观看| 国产欧美一区二区精品久导航 | 国产精品成人一区二区艾草 | 久久亚洲精精品中文字幕早川悠里| 午夜成人免费电影| 欧美一区二区黄| 欧美性xxxxxxxx| 不卡视频在线观看| 成人小视频在线观看| 成人午夜碰碰视频| 亚洲一二三专区| 成人欧美一区二区三区1314| 欧美性受极品xxxx喷水| 欧美一区永久视频免费观看| 欧美二区三区91| 欧美性一二三区| 色狠狠色噜噜噜综合网| 91九色最新地址| 色天天综合色天天久久| 色94色欧美sute亚洲线路一ni | 性做久久久久久久免费看| 中国色在线观看另类| 综合久久久久久久| 免费亚洲电影在线| 奇米精品一区二区三区四区| 蜜乳av一区二区三区| 国内精品国产三级国产a久久| 成人高清视频在线| 欧美三级三级三级爽爽爽| 日韩午夜小视频| 亚洲欧美在线高清| 午夜激情综合网| 99久久精品国产一区| 欧美一区二区三区成人| 国产欧美日本一区视频| 久久综合久久综合九色| 中文字幕精品一区| 日本怡春院一区二区| 成人精品免费网站| 国产精品一区二区久激情瑜伽 | 亚洲男人的天堂在线观看| 欧美激情一区三区| 久久久精品免费网站| 日韩电影免费一区| 欧美日韩日日骚| 日本美女一区二区| 91精品国产色综合久久ai换脸| 亚洲免费观看高清完整版在线观看熊| 国产一区二区久久| 制服丝袜亚洲网站| 国内精品久久久久影院色| 色婷婷av一区| 久久精品亚洲乱码伦伦中文| 亚洲高清中文字幕| 成人国产精品免费观看| 中文字幕精品一区| 韩国一区二区视频| 欧美日韩aaaaaa| 三级影片在线观看欧美日韩一区二区| 精品无码三级在线观看视频| 美女爽到高潮91| 欧美精品一二三区| 亚洲视频中文字幕| 国产成a人无v码亚洲福利| 精品国精品国产尤物美女| 亚洲成人午夜电影| 6080国产精品一区二区| 亚洲h精品动漫在线观看| 91福利社在线观看| 综合亚洲深深色噜噜狠狠网站| 国产精品99久久久久久久女警| 欧美精品一区二区三| 日本伊人精品一区二区三区观看方式| 色婷婷精品久久二区二区蜜臂av| 国产欧美一区二区三区在线老狼| 裸体健美xxxx欧美裸体表演| 色悠悠久久综合| 丝袜国产日韩另类美女| 欧美日韩国产综合草草| 青椒成人免费视频| 精品国产一区a| 午夜精品久久久久久久| av在线播放成人| 亚洲美女视频一区| 欧美在线播放高清精品| 亚洲国产日韩精品| 欧美日韩精品专区| 国产一区二区三区免费| 欧美激情资源网| 色哟哟一区二区三区| 亚洲国产成人av好男人在线观看| 91精品国产一区二区| 国产乱子伦一区二区三区国色天香| 精品成人a区在线观看| 成人成人成人在线视频| 亚洲一区二区三区精品在线| 日韩欧美的一区| 99久久精品免费观看| 视频在线观看国产精品| 国产日产欧美一区| 成人的网站免费观看| 日日摸夜夜添夜夜添精品视频| 久久久久一区二区三区四区| 91麻豆福利精品推荐| 秋霞午夜鲁丝一区二区老狼| 日韩视频在线永久播放| 九九九久久久精品| 亚洲激情av在线| 国产拍揄自揄精品视频麻豆| 欧美一区二区精品久久911| 成人av在线资源网| 美女视频黄免费的久久| 中文字幕综合网| 国产精品欧美一级免费| 精品国产免费人成电影在线观看四季| 91论坛在线播放| 成人国产精品免费观看动漫| 国产·精品毛片| 国内成人免费视频| 久久精品99国产精品| 一区二区三区 在线观看视频| 中文字幕一区二区视频| 久久久精品综合| 久久久久久久久久久黄色| 日韩一级视频免费观看在线| 欧美日韩成人综合| 欧美性色黄大片手机版| 在线免费观看视频一区| 99久久精品情趣| 欧美日韩综合在线免费观看| av成人免费在线观看| 国产福利一区在线| 婷婷久久综合九色国产成人|