Exemplo n.º 1
0
 protected void BuildDataSetStructure()
 {
     BuildDataSet();
     if (BillType == Template.BillType.Bill || BillType == Template.BillType.Master)
     {
         DataTable masterTable = this.DataSet.Tables[0];
         //DataSourceHelper.AddAttachmentSrcColumn(masterTable);
         if (!masterTable.ExtendedProperties.ContainsKey(TableProperty.DBIndex))
         {
             masterTable.ExtendedProperties.Add(TableProperty.DBIndex, new DBIndexCollection());
         }
         DBIndexCollection dbIndexs = (DBIndexCollection)masterTable.ExtendedProperties[TableProperty.DBIndex];
         dbIndexs.Add(new DBIndex(string.Format("{0}_ID_IDX", masterTable.TableName.ToUpper()), new DBIndexFieldCollection()
         {
             new DBIndexField("INTERNALID")
         }, true));
         for (int i = 1; i < this.DataSet.Tables.Count; i++)
         {
             DataTable table = this.DataSet.Tables[i];
             if (table.ExtendedProperties.ContainsKey(TableProperty.UsingAttachment))
             {
                 if (Convert.ToBoolean(table.ExtendedProperties[TableProperty.UsingAttachment]))
                 {
                     DataSourceHelper.AddAttachmentSrcColumn(table);
                 }
             }
             // 自动构建行项审核需要的数据列
             if (table.ExtendedProperties.ContainsKey(TableProperty.UsingApproveRow))
             {
                 if (Convert.ToBoolean(table.ExtendedProperties[TableProperty.UsingApproveRow]))
                 {
                     DataSourceHelper.AddApproveRowFixColumn(table);
                 }
             }
         }
         try
         {
             if (this.FuncPermission.UseSynchroData)
             {
                 //如果启用数据同步功能,则添加同步到的目标站点的虚拟子表
                 //if (this.DataSet.Tables.Contains(LibFuncPermission.SynchroDataSettingTableName) == false && LibTemplate.HasAxpLinkSite && LibTemplate.HasSyncDataTable)
                 if (this.DataSet.Tables.Contains(LibFuncPermission.SynchroDataSettingTableName) == false)
                 {
                     DataTable dt = DataSourceHelper.AddSyncDataSettingTable(this.DataSet, LibFuncPermission.SynchroDataSettingTableName);
                     dt.ExtendedProperties.Add(TableProperty.IsVirtual, true);  //设定同步配置数据表为虚表
                     dt.ExtendedProperties.Add(TableProperty.AllowCopy, false); //设定同步配置数据表不可复制
                     dt = DataSourceHelper.AddSyncDataHistoryTable(this.DataSet, LibFuncPermission.SynchroDataHisTableName);
                     dt.ExtendedProperties.Add(TableProperty.IsVirtual, true);  //设定同步历史数据表为虚表
                     dt.ExtendedProperties.Add(TableProperty.AllowCopy, false); //设定同步历史数据表不可复制
                 }
             }
         }
         catch { }
     }
 }