private int GetResDataCount() { int num = 0; if (ResFunc.IsOnlineOutRes(this.curFolder.ClassOid)) { return(ResFunc.GetDataCount(this.curFolder, this.attrList, this.attrOuter, emResourceType.OutSystem)); } if (ResFunc.IsRefRes(this.curFolder.ClassOid)) { PLSPL plspl = new PLSPL(); DEMetaClass class2 = ModelContext.MetaModel.GetClass(this.curFolder.ClassOid); DEMetaClass class3 = ModelContext.MetaModel.GetClass(class2.RefClass); ArrayList attrList = new ArrayList(); foreach (DEMetaAttribute attribute in this.attrList) { if (this.ISDefAttrViewable(attribute)) { attrList.Add(attribute); } } return(plspl.GetSPLCount(class3.Name, attrList, ClientData.LogonUser.Oid, this.curFolder.FilterString, this.curFolder.FilterValue)); } if (ResFunc.IsTabRes(this.curFolder.ClassOid)) { ArrayList list2 = new ArrayList(); num = ResFunc.GetDataCount(this.curFolder, list2, this.attrOuter, emResourceType.Customize); } return(num); }
private bool CheckOptionByDA() { bool flag = true; DEResFolder defolder = new DEResFolder { Oid = Guid.Empty, ClassOid = this.clsOid, ClassName = this.clsName, Filter = this.FilterConditon.ToString(), FilterString = this.FilterString, FilterValue = this.FilterValue }; ArrayList list = new ArrayList(); ArrayList outerAttr = new ArrayList(); list = ResFunc.CloneMetaAttrLst(ResFunc.GetShowAttrList(defolder, emTreeType.NodeTree)); outerAttr = ResFunc.GetOuterAttr(defolder); try { if (ResFunc.IsOnlineOutRes(defolder.ClassOid)) { ResFunc.GetDataCount(defolder, list, outerAttr, emResourceType.OutSystem); return(flag); } if (ResFunc.IsRefRes(defolder.ClassOid)) { PLSPL plspl = new PLSPL(); DEMetaClass class2 = ModelContext.MetaModel.GetClass(defolder.ClassOid); DEMetaClass class3 = ModelContext.MetaModel.GetClass(class2.RefClass); plspl.GetSPLCount(class3.Name, list, ClientData.LogonUser.Oid, defolder.FilterString, defolder.FilterValue); return(flag); } if (ResFunc.IsTabRes(defolder.ClassOid)) { ArrayList list4 = new ArrayList(); ResFunc.GetDataCount(defolder, list4, outerAttr, emResourceType.Customize); } } catch { return(false); } return(flag); }
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 if (ResFunc.IsRefRes(this.classOid)) { this.b_isRefCls = true; PLSPL plspl = new PLSPL(); DEMetaClass class2 = ModelContext.MetaModel.GetClass(this.classOid); DEMetaClass class3 = ModelContext.MetaModel.GetClass(class2.RefClass); this.Attrs = this.GetAttributes(class3.Name); this.className = class3.Name; tableName = "PLM_CUSV_" + this.className; this.myds = plspl.GetSPLDataSet(class3.Name, this.Attrs, ClientData.LogonUser.Oid, "", ""); } 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 (this.b_isRefCls) { string str5 = "PLM_M_ID"; combination = combination.Replace("[ID]", Convert.ToString(row[str5])); str3 = str3.Replace("[ID]", ""); } 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(); } } }
private void DoOutFile(string strFileName) { ArrayList files = new ArrayList(); for (int i = 0; i < this.TotalNum; i++) { int num2 = 0; int num3 = 0; int num4 = 0; if ((i >= (this.StartNum - 1)) && (i <= (this.EndNum - 1))) { num4++; if (i == 0) { num2 = i * this.showNum; } else { num2 = (i * this.showNum) + 1; } num3 = (i + 1) * this.showNum; if (ResFunc.IsOnlineOutRes(this.curFolder.ClassOid)) { ResFunc.GetNumDS(out this.theDataSet, this.curFolder, this.attrList, num2, num3, this.strSort); ResFunc.ConvertOuterDSHead(this.theDataSet, this.attrList, this.attrOuter); } else if (ResFunc.IsRefRes(this.curFolder.ClassOid)) { PLSPL plspl = new PLSPL(); DEMetaClass class2 = ModelContext.MetaModel.GetClass(this.curFolder.ClassOid); DEMetaClass class3 = ModelContext.MetaModel.GetClass(class2.RefClass); this.clsName = class3.Name; ArrayList attrList = new ArrayList(); foreach (DEMetaAttribute attribute in this.attrList) { if (this.ISDefAttrViewable(attribute)) { attrList.Add(attribute); } } this.theDataSet = plspl.GetSPLNumDataSet(class3.Name, attrList, ClientData.LogonUser.Oid, num2, num3, this.curFolder.FilterString, this.curFolder.FilterValue, this.strSort); this.b_refType = true; } else if (ResFunc.IsTabRes(this.curFolder.ClassOid)) { new ArrayList(); ResFunc.GetNumDS(out this.theDataSet, this.curFolder, this.attrList, num2, num3, this.strSort); } if (this.theDataSet != null) { if (num4 == 1) { this.InitLvShowHeader(); } this.ConvertToListView(); if (this.IsMultiPageOut) { string str = Path.Combine(this.tmpPath, "page" + ((i + 1)).ToString()); this.ToXlsFile(this.lvw, str, "page" + ((i + 1)).ToString()); files.Add(str); } } } } if (!this.IsMultiPageOut) { string str2 = Path.Combine(this.tmpPath, "page1"); this.ToXlsFile(this.lvw, str2, "page1"); files.Add(str2); } if (files.Count > 0) { try { this.excelPipe.UnionBooks(files); this.excelPipe.RemoveWorkSheet(1); } catch (Exception exception) { MessageBoxPLM.Show(exception.Message); } finally { try { this.excelPipe.QuitAll(strFileName); } catch (Exception exception2) { MessageBoxPLM.Show(exception2.Message); } } } }
private void NodeSelected(TreeNode node) { if (this.dropDownTree.SelectedNode == null) { this.gbFilter.Visible = false; this.lvw.Clear(); } else if (this.dropDownTree.SelectedNode.Text != this.clsName) { this.curFolder = (DEResFolder)this.dropDownTree.SelectedNode.Tag; if (typeof(DEMetaClass).IsInstanceOfType(this.dropDownTree.SelectedNode.Tag)) { this.gbFilter.Visible = true; this.clsName = this.dropDownTree.SelectedNode.Text; DEMetaClass tag = (DEMetaClass)this.dropDownTree.SelectedNode.Tag; this.attrList = this.GetAttributes(tag.Name); this.AddFilter(this.attrList); this.myView = null; if (this.txtValue.Text != "") { this.txtValue.Text = ""; } if (this.cob.Text != "等于") { this.cob.Text = "等于"; } PLSPL plspl = new PLSPL(); try { this.theDataSet = plspl.GetSPLDataSet(tag.Name, this.attrList, this.userOid, this.curFolder.FilterString, this.curFolder.FilterValue); } catch (PLMException exception) { PrintException.Print(exception); } catch (Exception exception2) { MessageBoxPLM.Show("读取数据集发生错误" + exception2.ToString(), "读取数据集", MessageBoxButtons.OK, MessageBoxIcon.Hand); } if (this.theDataSet.Tables.Count != 0) { this.CreateLvwStyle(this.lvw, this.attrList); if (this.theDataSet.Tables[0].Rows.Count == 0) { this.tbnNext.Enabled = false; this.tbnPre.Enabled = false; } else { this.myView = this.theDataSet.Tables[0].DefaultView; this.DisplayData(this.myView); } } } else { this.gbFilter.Visible = false; this.lvw.Clear(); } } }