コード例 #1
0
ファイル: ResDataToExcel.cs プロジェクト: funtomi/MyNewCode
        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);
        }
コード例 #2
0
ファイル: ResDataToExcel.cs プロジェクト: funtomi/MyNewCode
 private void InitResStatus()
 {
     if (ResFunc.IsOnlineOutRes(this.curFolder.ClassOid))
     {
         this.emResType = emResourceType.OutSystem;
     }
     else if (ResFunc.IsRefRes(this.curFolder.ClassOid))
     {
         this.emResType = emResourceType.Standard;
         this.b_refType = true;
     }
     else if (ResFunc.IsTabRes(this.curFolder.ClassOid))
     {
         this.emResType = emResourceType.Customize;
     }
     else
     {
         this.emResType = emResourceType.PLM;
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: UCRes.cs プロジェクト: funtomi/MyNewCode
 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();
         }
     }
 }
コード例 #5
0
ファイル: ResDataToExcel.cs プロジェクト: funtomi/MyNewCode
        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);
                    }
                }
            }
        }