コード例 #1
0
        public bool Upgrade()
        {
            ColumnCollection oldcolumns = null;
            BusinessObject   BO         = null;
            object           dsid       = SqlHelper.ExecuteScalar(_metastring, "select DataSourceID from uap_report where id='" + _reportid + "'");

            if (dsid != null)
            {
                oldcolumns = ((QueryFunction)BO.Functions[0]).QuerySettings[0].QueryResultTable.Columns;
                //((QueryFunction)BO.Functions[0]).QuerySettings[0].QueryResultTable.Columns=new ColumnCollection();
            }
            else
            {
                //new bo
            }

            ColumnCollection newcolumns = ((QueryFunction)BO.Functions[0]).QuerySettings[0].QueryResultTable.Columns;
            //获取老报表数据,考虑列的顺序
            SqlDataReader reader = SqlHelper.ExecuteReader(_datastring, "select ,, from rpt order by orderid");

            while (reader.Read())
            {
                string      columnname = reader["ColumnName"].ToString();
                TableColumn column     = AlreadyInColumns(columnname, oldcolumns);
                if (column != null)
                {
                    newcolumns.Add(column);
                }
                else//不存在则加进去
                {
                    DataTypeEnum dt   = GetDataType();
                    string       desc = null;
                    column = new TableColumn(columnname, dt, desc);
                    newcolumns.Add(column);
                }
            }
            ConfigureServiceProxy c = new ConfigureServiceProxy();

            c.UpdateBusinessObject(BO);

            UpgradeReport ur = new UpgradeReport();

            ur.DataSourceID = BO.MetaID;


            //创建BusinessObject对象,并调用Save方法
            //创建Report对象,并调用Save方法
            //reportengine
            //Report report=reportengine.DesignReport()
            //reportengine.UpgradeSave(report,ref commonxml,ref cnxml,ref twxml,ref enxml);
            //if rpt_id在meta库中UAP_Report表不存在
            //BusinessObject BO = new BusinessObject();
            //else rpt_id在meta库中UAP_Report表存在
            //ConfigureServiceProxy proxy =new ConfigureServiceProxy();
            //proxy.GetBusinessObject()

            ur.Save();
            return(true);
        }
コード例 #2
0
        private BusinessObject GetBOFromDataEngine()
        {
            ConfigureServiceProxy proxy = new ConfigureServiceProxy(
                this._loginInfor.AppServer,
                this._loginInfor.UfMetaCnnString);

            proxy.LanguageId = "zh-CN";
            BusinessObject bo = proxy.GetBusinessObject(this._dataSourceId);

            if (bo == null ||
                bo.Functions == null ||
                bo.Functions.Count == 0)
            {
                throw new TempDBServiceException(
                          "不能从数据引擎获取正确的BusinessObject对象",
                          "DataSourceId:" + this._dataSourceId);
            }
            return(bo);
        }