示例#1
0
        /// <summary>
        /// 更新服务器列表。
        /// </summary>
        private void UpdateServerSitList()
        {
            //连接服务器列表进行更新
            string[] columns = new string[] { "SITE_NAME", "SITE_VALUE", "TIME_CONTROL", "FACTORY_CODE", "CHECK_OPERATOR" };
            KeyValuePair <string, string> category = new KeyValuePair <string, string>("CATEGORY_NAME", "Site");
            DataTable siteTable = BaseData.Get(columns, category);

            if (siteTable.Rows.Count > 0)
            {
                DataRow[] dataRow = siteTable.Select("SITE_NAME='" + site + "'");//查询自定义表siteTable的数据“select * from siteTable where site_name="+site+"”
                if (dataRow.Length > 0)
                {
                    string bIsTimeControl = "0";
                    if (!string.IsNullOrEmpty(dataRow[0]["TIME_CONTROL"].ToString()))
                    {
                        bIsTimeControl = dataRow[0]["TIME_CONTROL"].ToString();
                    }
                    PropertyService.Set(PROPERTY_FIELDS.TimeControl, bIsTimeControl);

                    string factoryCode = string.Empty;
                    if (!string.IsNullOrEmpty(dataRow[0]["FACTORY_CODE"].ToString()))
                    {
                        factoryCode = dataRow[0]["FACTORY_CODE"].ToString();
                    }
                    PropertyService.Set(PROPERTY_FIELDS.FACTORY_CODE, factoryCode.Trim());
                }

                Dictionary <string, string[]> dicSite = new Dictionary <string, string[]>();
                for (int i = 0; i < siteTable.Rows.Count; i++)
                {
                    string   siteName    = siteTable.Rows[i]["site_name"].ToString();
                    string   siteValue   = siteTable.Rows[i]["site_value"].ToString();
                    string   factoryCode = siteTable.Rows[i]["FACTORY_CODE"].ToString();
                    string[] value       = { siteValue, factoryCode };
                    dicSite.Add(siteName, value);
                }
//#if DEBUG
//                dicSite.Add("LocalHost", new string[] { "LocalHost", string.Empty });
//#endif
                CallRemotingService.UpdateConfigureSiteXml(dicSite);
            }
        }