예제 #1
0
        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
 private void SetDisplayName(DataSet ds)
 {
     try
     {
         string tableName = "";
         if (ResFunc.IsOnlineOutRes(this.classOid))
         {
             tableName = this.myds.Tables[0].TableName;
         }
         else
         {
             tableName = "PLM_CUS_" + this.className;
             if (ResFunc.IsRefRes(this.classOid))
             {
                 tableName = "PLM_CUSV_" + this.className;
             }
         }
         string str2 = "PLM_";
         string str3 = "";
         if (((ds != null) && (ds.Tables.Count > 0)) && (ds.Tables[tableName] != null))
         {
             this.SetParam();
             foreach (DataColumn column in ds.Tables[tableName].Columns)
             {
                 if (column.ColumnName == "PLM_M_ID")
                 {
                     column.ColumnName = "代号";
                 }
                 if (column.ColumnName == "PLM_LABEL")
                 {
                     column.ColumnName = "类名";
                 }
                 foreach (DEMetaAttribute attribute in this.Attrs)
                 {
                     str3 = str2 + attribute.Name;
                     if (column.ColumnName == str3)
                     {
                         column.ColumnName = attribute.Label;
                         break;
                     }
                 }
                 if (column.DataType.Equals(System.Type.GetType("System.Byte[]")))
                 {
                     this.al_guid.Add(column.ColumnName);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         throw new Exception("error!" + exception.Message);
     }
 }
예제 #3
0
 private void ResCombo_RowSelected(object sender, RowSelectedEventArgs e)
 {
     this.m_dropdownRow = e.Row;
     if ((((this.m_dropdownRow != null) && !ResFunc.IsOnlineOutRes(this.classOid)) && (constResource.Label_OID != "")) && ((this.m_dropdownRow.Cells[constResource.Label_OID] != null) && (this.m_dropdownRow.Cells[constResource.Label_OID].Value.ToString() != "")))
     {
         if (this.m_dropdownRow.Cells[constResource.Label_OID].Value.GetType() == typeof(Guid))
         {
             this.resOid = (Guid)this.m_dropdownRow.Cells[constResource.Label_OID].Value;
         }
         else
         {
             this.resOid = new Guid((byte[])this.m_dropdownRow.Cells[constResource.Label_OID].Value);
         }
     }
 }
예제 #4
0
        public bool IsInDataSet(string str)
        {
            this.LoadData();
            string tableName = "PLM_CUS_" + this.className;

            if (ResFunc.IsRefRes(this.classOid))
            {
                tableName = "PLM_CUSV_" + this.className;
            }
            bool flag = false;

            if (this.myds == null)
            {
                this.InitializeData();
            }
            DataSet myds = this.myds;

            if ((myds == null) || (myds.Tables.Count <= 0))
            {
                return(false);
            }
            if (ResFunc.IsOnlineOutRes(this.className))
            {
                tableName = myds.Tables[0].TableName;
            }
            if (myds.Tables[tableName].Rows.Count <= 0)
            {
                return(false);
            }
            foreach (DataColumn column in myds.Tables[tableName].Columns)
            {
                if (column.ColumnName == this.comColumn)
                {
                    foreach (DataRow row in myds.Tables[tableName].Rows)
                    {
                        if (str == row[this.comColumn].ToString())
                        {
                            return(true);
                        }
                    }
                    return(flag);
                }
            }
            return(flag);
        }
예제 #5
0
 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;
     }
 }
예제 #6
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);
        }
예제 #7
0
 private void ConfigureResCombo()
 {
     base.DataSource = this.myView;
     if (ResFunc.IsOnlineOutRes(this.classOid))
     {
         base.ValueMember = this.comColumn;
     }
     else
     {
         base.ValueMember = constResource.Label_OID;
     }
     base.DisplayMember = this.comColumn;
     this.SetDisplayPos();
     if (this.deMetaAttri.IsResInputEnable)
     {
         base.AutoEdit = true;
     }
     else
     {
         base.AutoEdit = false;
     }
     base.MaxDropDownItems = 6;
 }
예제 #8
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();
         }
     }
 }
예제 #9
0
        public bool IsInDataSet(object ob_in, string str_comattr)
        {
            this.LoadData();
            string tableName = "PLM_CUS_" + this.className;

            if (ResFunc.IsRefRes(this.classOid))
            {
                tableName = "PLM_CUSV_" + this.className;
            }
            if (str_comattr == null)
            {
                return(false);
            }
            if (str_comattr == string.Empty)
            {
                return(false);
            }
            bool flag = false;

            if (this.myds == null)
            {
                this.InitializeData();
            }
            DataSet myds = this.myds;

            if ((myds == null) || (myds.Tables.Count <= 0))
            {
                return(false);
            }
            if (ResFunc.IsOnlineOutRes(this.className))
            {
                tableName = myds.Tables[0].TableName;
            }
            if (myds.Tables[tableName].Rows.Count <= 0)
            {
                return(false);
            }
            foreach (DataColumn column in myds.Tables[tableName].Columns)
            {
                if (column.ColumnName == this.comColumn)
                {
                    foreach (DataRow row in myds.Tables[tableName].Rows)
                    {
                        if (str_comattr.Equals("对象全局唯一标识"))
                        {
                            if ((row["PLM_OID"] != null) && (row["PLM_OID"].ToString() != ""))
                            {
                                Guid guid = (Guid)row["PLM_OID"];
                                if (((Guid)ob_in) == guid)
                                {
                                    return(true);
                                }
                            }
                        }
                        else
                        {
                            string str2 = str_comattr;
                            string str3 = str2;
                            foreach (DEMetaAttribute attribute in this.Attrs)
                            {
                                if (str_comattr.IndexOf("[" + attribute.Name + "]") > -1)
                                {
                                    string str4 = "PLM_" + attribute.Name;
                                    str2 = str2.Replace("[" + attribute.Name + "]", Convert.ToString(row[str4].ToString()));
                                    str3 = str3.Replace("[" + attribute.Name + "]", "");
                                }
                            }
                            if (str2 == str3)
                            {
                                str2 = "";
                            }
                            string str5 = str2;
                            if (ob_in.ToString() == str5)
                            {
                                return(true);
                            }
                        }
                    }
                    return(flag);
                }
            }
            return(flag);
        }
예제 #10
0
        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);
                    }
                }
            }
        }