Esempio n. 1
0
        // 自动填充面板上的 报表名和创建频率
        void AutoFillReportName()
        {
#if NO
            // 用配置文件中的 typeName 填充报表名称
            if (string.IsNullOrEmpty(this.textBox_reportName.Text) == false)
            {
                return;
            }
#endif

            string strError = "";

            string strLocalFilePath = this.textBox_cfgFileName.Text;

            if (string.IsNullOrEmpty(strLocalFilePath) == true)
            {
                return;
            }
            if (File.Exists(strLocalFilePath) == false)
            {
                return;
            }

#if NO
            string strTypeName = "";
            // 获得 typeName
            // return:
            //      -1  出错
            //      0   配置文件没有找到
            //      1   成功
            int nRet = ReportDefForm.GetReportTypeName(
                strLocalFilePath,
                out strTypeName,
                out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }
#endif
            ReportConfigStruct config = null;

            // 从报表配置文件中获得各种配置信息
            // return:
            //      -1  出错
            //      0   没有找到配置文件
            //      1   成功
            int nRet = ReportDefForm.GetReportConfig(strLocalFilePath,
                                                     out config,
                                                     out strError);
            if (nRet == -1 || nRet == 0)
            {
                goto ERROR1;
            }

            if (string.IsNullOrEmpty(config.TypeName) == false &&
                config.TypeName.Length > 3)
            {
                this.textBox_reportName.Text = config.TypeName.Substring(GetNumberPrefix(config.TypeName).Length).Trim();
            }

            if (string.IsNullOrEmpty(this.checkedComboBox_createFreq.Text) == true)
            {
                this.checkedComboBox_createFreq.Text = config.CreateFreq;
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }