Beispiel #1
0
 private void InitializeData()
 {
     if ((this.className != null) && (this.className != ""))
     {
         string tableName = "PLM_CUS_" + this.className;
         this.Attrs = this.GetAttributes(this.className);
         try
         {
             if (ResFunc.IsOnlineOutRes(this.className))
             {
                 this.myds  = new PLOuterResource().GetOuterResData(this.classOid, true);
                 this.Attrs = ResFunc.GetAttrList(this.myds, this.Attrs);
                 if (this.myds != null)
                 {
                     tableName = this.myds.Tables[0].TableName;
                 }
             }
             else if (ResFunc.IsTabRes(this.classOid))
             {
                 ResFunc.GetData(out Stamp, out this.myds, this.className, this.Attrs);
             }
             else
             {
                 this.myds = new DataSet();
                 ArrayList items = new ArrayList();
                 items = this.GetItemLST(this.className);
                 DataTable dataSource = DataSourceMachine.GetDataSource(this.className, items);
                 this.myds.Tables.Add(dataSource);
             }
         }
         catch (PLMException exception)
         {
             PrintException.Print(exception);
         }
         catch (Exception exception2)
         {
             MessageBoxPLM.Show("读取数据集发生错误" + exception2.ToString(), "读取数据集", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         if ((this.myds != null) && (this.deMetaAttri != null))
         {
             if (((this.deMetaAttri != null) && (this.deMetaAttri.LinkType == 1)) && (this.deMetaAttri.Combination != ""))
             {
                 DataColumn column = new DataColumn(this.comColumn)
                 {
                     DataType = typeof(string)
                 };
                 this.myds.Tables[tableName].Columns.Add(column);
                 foreach (DataRow row in this.myds.Tables[tableName].Rows)
                 {
                     string combination = this.deMetaAttri.Combination;
                     string str3        = combination;
                     foreach (DEMetaAttribute attribute in this.Attrs)
                     {
                         if (this.deMetaAttri.Combination.IndexOf("[" + attribute.Name + "]") > -1)
                         {
                             string str2 = "PLM_" + attribute.Name;
                             combination = combination.Replace("[" + attribute.Name + "]", Convert.ToString(row[str2]));
                             str3        = str3.Replace("[" + attribute.Name + "]", "");
                         }
                     }
                     if (combination == str3)
                     {
                         combination = "";
                     }
                     row[this.comColumn] = combination;
                 }
             }
             else if ((this.deMetaAttri.LinkType == 0) && (this.deMetaAttri.DataType == 8))
             {
                 DataColumn column2 = new DataColumn(this.comColumn)
                 {
                     DataType = typeof(string)
                 };
                 this.myds.Tables[tableName].Columns.Add(column2);
                 foreach (DataRow row2 in this.myds.Tables[tableName].Rows)
                 {
                     row2[this.comColumn] = row2["PLM_ID"].ToString();
                 }
             }
             DataSet ds = this.myds.Copy();
             this.SetDisplayName(ds);
             this.myView = ds.Tables[tableName].DefaultView;
             this.ConfigureResCombo();
             this.SetDisplayGrid();
             this.InitFilterData();
         }
     }
 }