Exemplo n.º 1
0
        /// <summary>
        /// 根据参数ID构造对象
        /// </summary>
        /// <param name="cfgID"></param>
        public SystemCfg(int cfgID)
        {
            InitDatabase();
            try
            {
                _dbType = DatabaseType.SqlServer;
                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):1-cfgID:" + cfgID.ToString()) }, true);
                DataRow dr = DataRowConfig(cfgID);   //2013-7-18 修改 取内存表
                if (dr == null)
                {
                    dr = _database.GetDataRow("SELECT * FROM JC_CONFIG(nolock) WHERE ID=" + cfgID);
                }

                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):2-cfgID:" + cfgID.ToString()) }, true);
                if (dr == null)
                {
                    _cfgID = -1;
                    throw new Exception("指定的参数记录不存在:" + cfgID);
                }

                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):3-cfgID:" + cfgID.ToString()) + ":列:" + GetTableColumnsName(dr.Table) }, true);
                _cfgID     = cfgID;
                _config    = Convertor.IsNull(dr["CONFIG"], "");
                _note      = Convertor.IsNull(dr["NOTE"], "");
                _moduleID  = Convert.ToInt32(Convertor.IsNull(dr["MODULE_ID"], "-1"));
                _paraLevel = Convert.ToInt16(Convertor.IsNull(dr["CSJB"], "-1"));
                _writable  = Convert.ToInt16(Convertor.IsNull(dr["RWBZ"], "0")) > 0 ? true : false;
                _varType   = Convert.ToInt16(Convertor.IsNull(dr["BLBZ"], "-1"));
                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):4-cfgID:" + cfgID.ToString()) }, true);
                ReleaseDatabase();
            }
            catch (Exception err)
            {
                FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):err-cfgID:" + cfgID.ToString()) + err.Message }, true);
                MessageBox.Show("SystemCfg(int cfgID)\\读取系统参数表出错\n" + err.Message);
                //throw new Exception("SystemCfg\\读取系统参数表出错\n"+err.Message);
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            /*
             * 参数说明:
             * caption		:主窗体标题
             * connectionType : 数据库连接类型
             * connectionString 连接字符串
             * mainProgramname:主程序名
             * checkRegister :是否检查注册信息
             *
             * */
            string serverName = "mydb_svr";

            serverName = TrasenClasses.GeneralClasses.ApiFunction.GetIniString("SERVER_NAME", "NAME", Constant.ApplicationDirectory + "\\ClientConfig.ini");
            if (serverName == "")
            {
                System.Windows.Forms.MessageBox.Show("ClientConfig.ini中[SERVER_NAME]的NAME未设置,请启动配置程序并设置当前服务器", "错误");
                return;
            }
            string connectionString = WorkStaticFun.GetConnnectionString(ConnectionType.SQLSERVER, serverName);

            FrmMdiMain.StartupMain("创星科技信息系统", ConnectionType.SQLSERVER, connectionString, "Trasen", true);
        }