예제 #1
0
 /// <summary>
 /// 获得系统参数
 /// </summary>
 /// <param name="propName">参数名称</param>
 /// <returns>参数值</returns>
 static public string Property(string propName)
 {
     if (m_props.ContainsKey(propName))
     {
         return(m_props[propName]);
     }
     else
     {
         IAppPropAction appPropAction = RemotingHelper.GetRemotingService <IAppPropAction>();
         string         result        = appPropAction.GetAppProperty(propName);
         m_props.Add(propName, result);
         return(result);
     }
 }
예제 #2
0
        /// <summary>
        /// 是否有新版本
        /// </summary>
        /// <param name="propName"></param>
        /// <returns></returns>
        static public bool HasNewVersion()
        {
            string serverProtocol, serverAddress, serverPort;
            string file = Application.StartupPath + "\\Itop.update.exe";

            serverProtocol = ConfigurationHelper.GetValue(file, "serverProtocol", "");
            serverAddress  = ConfigurationHelper.GetValue(file, "serverAddress", "");
            serverPort     = ConfigurationHelper.GetValue(file, "serverPort", "");

            string         serverUrl     = string.Format("{0}://{1}:{2}/", serverProtocol, serverAddress, serverPort);
            IAppPropAction appPropAction = null;

            foreach (WellKnownClientTypeEntry entry in RemotingConfiguration.GetRegisteredWellKnownClientTypes())
            {
                if (entry.ObjectType == typeof(IAppPropAction))
                {
                    appPropAction = (IAppPropAction)Activator.GetObject(typeof(IAppPropAction), serverUrl + entry.ObjectUrl);
                }
            }

            if (appPropAction == null)
            {
                return(false);
            }


            try {
                //获取数据库版本日期
                string ver1 = appPropAction.GetAppProperty("AppLastDate");
                //获取程序版本
                string ver2 = ConfigurationHelper.GetValue("UpdateDate");

                string sys1 = appPropAction.GetAppProperty("AppSysID");

                string sys2 = ConfigurationHelper.GetValue("AppSysID");
                if (string.IsNullOrEmpty(sys2))
                {
                    ConfigurationHelper.SetValue("AppSysID", sys1);
                    sys2 = sys1;
                }

                return(ver1.CompareTo(ver2) > 0 && !string.IsNullOrEmpty(sys1) && sys1.CompareTo(sys2) == 0 ? true : false);
            } catch { return(false); }
        }