Ejemplo n.º 1
0
 private void LoadData(ArrayList al_item)
 {
     DataTable dataSource = new DataTable();
     if ((this.className != null) && (this.className != ""))
     {
         string name = "PLM_CUS_" + this.className;
         this.Attrs = this.GetAttributes(this.className);
         new ArrayList();
         new ArrayList();
         if (al_item.Count > 0)
         {
             dataSource = DataSourceMachine.GetDataSource(this.className, al_item);
         }
         else
         {
             this.uGrid_Res.DataSource = null;
             return;
         }
         this.myds.Clear();
         this.myds.Tables.Remove(name);
         this.myds.Tables.Add(dataSource);
         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[name].Columns.Add(column);
                 foreach (DataRow row in this.myds.Tables[name].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 + "]", "");
                         }
                     }
                     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[name].Columns.Add(column2);
                 foreach (DataRow row2 in this.myds.Tables[name].Rows)
                 {
                     ArrayList splitString = this.GetSplitString(this.deMetaAttri.Combination, "}");
                     string str5 = "";
                     for (int i = 0; i < (splitString.Count - 1); i++)
                     {
                         str5 = str5 + "{" + row2["PLM_ID"].ToString() + "}";
                     }
                     row2[this.comColumn] = str5;
                 }
             }
             DataSet ds = this.myds.Copy();
             this.SetDisplayName(ds);
             this.myView = ds.Tables[name].DefaultView;
             this.ConfigureResCombo();
             this.SetDisplayGrid();
         }
     }
 }
Ejemplo n.º 2
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();
         }
     }
 }
Ejemplo n.º 3
0
 private void InitializeData()
 {
     if ((this.className != null) && (this.className != ""))
     {
         string str4 = "PLM_CUS_" + this.className;
         this.Attrs = this.GetAttributes(this.className);
         try
         {
             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[str4].Columns.Add(column);
                 foreach (DataRow row in this.myds.Tables[str4].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 + "]", "");
                         }
                     }
                     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[str4].Columns.Add(column2);
                 foreach (DataRow row2 in this.myds.Tables[str4].Rows)
                 {
                     ArrayList splitString = this.GetSplitString(this.deMetaAttri.Combination, "}");
                     string str5 = "";
                     for (int i = 0; i < (splitString.Count - 1); i++)
                     {
                         str5 = str5 + "{" + row2["PLM_ID"].ToString() + "}";
                     }
                     row2[this.comColumn] = str5;
                 }
             }
             DataSet ds = this.myds.Copy();
             this.SetDisplayName(ds);
             this.myView = ds.Tables[str4].DefaultView;
             this.ConfigureResCombo();
             this.SetDisplayGrid();
         }
     }
 }