Esempio n. 1
0
 private void SetDisplayPos()
 {
     if (this.deMetaAttri != null)
     {
         foreach (DEMetaAttribute attribute in this.Attrs)
         {
             if (this.deMetaAttri.Combination.IndexOf("[" + attribute.Name + "]") > -1)
             {
                 string label = "";
                 label = attribute.Label;
                 if (ResFunc.IsRefRes(this.classOid))
                 {
                     if (attribute.Name == "ID")
                     {
                         label = "代号";
                     }
                     if (attribute.Name == "LABEL")
                     {
                         label = "类名";
                     }
                 }
                 if ((base.DisplayLayout.Bands.Count != 0) && (base.DisplayLayout.Bands[0].Columns.Count != 0))
                 {
                     base.DisplayLayout.Bands[0].Columns[label].Header.VisiblePosition = 0;
                 }
             }
         }
     }
 }
Esempio n. 2
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);
        }
Esempio n. 3
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);
     }
 }
Esempio n. 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);
        }
Esempio n. 5
0
        public Guid GetResourceOID(string id, string clsName)
        {
            string str = "PLM_CUS_" + clsName;

            if (ResFunc.IsRefRes(this.classOid))
            {
                str = "PLM_CUSV_" + clsName;
            }
            Guid  empty = Guid.Empty;
            ulong stamp = 0L;

            if (id != "")
            {
                DataSet set;
                UCCusResource.GetData(out stamp, out set, clsName, this.Attrs);
                if ((set == null) || (set.Tables.Count <= 0))
                {
                    return(empty);
                }
                if (set.Tables[str].Rows.Count <= 0)
                {
                    return(empty);
                }
                try
                {
                    foreach (DataRow row in set.Tables[str].Rows)
                    {
                        string str2 = row["PLM_ID"].ToString();
                        if (id == str2)
                        {
                            return(new Guid((byte[])row["PLM_OID"]));
                        }
                    }
                    return(empty);
                }
                catch (Exception exception)
                {
                    throw new Exception("error!" + exception.Message);
                }
            }
            return(empty);
        }
Esempio n. 6
0
        public string GetResourceID(Guid resOID, string clsName)
        {
            string str = "PLM_CUS_" + clsName;

            if (ResFunc.IsRefRes(this.classOid))
            {
                str = "PLM_CUSV_" + clsName;
            }
            string str2  = "";
            ulong  stamp = 0L;

            if (resOID != Guid.Empty)
            {
                DataSet set;
                UCCusResource.GetData(out stamp, out set, clsName, this.Attrs);
                if ((set == null) || (set.Tables.Count <= 0))
                {
                    return(str2);
                }
                if (set.Tables[str].Rows.Count <= 0)
                {
                    return(str2);
                }
                try
                {
                    foreach (DataRow row in set.Tables[str].Rows)
                    {
                        Guid guid = new Guid((byte[])row["PLM_OID"]);
                        if (resOID == guid)
                        {
                            return(row["PLM_ID"].ToString());
                        }
                    }
                    return(str2);
                }
                catch (Exception exception)
                {
                    throw new Exception("error!" + exception.Message);
                }
            }
            return(str2);
        }
Esempio n. 7
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;
     }
 }
Esempio n. 8
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);
        }
Esempio n. 9
0
 private void ResCombo_DragDrop(object sender, DragEventArgs e)
 {
     if (!base.ReadOnly)
     {
         this.LoadData();
         DEMetaAttribute deMetaAttri = this.deMetaAttri;
         CLCopyData      data        = new CLCopyData();
         data = (CLCopyData)e.Data.GetData(typeof(CLCopyData));
         if (data != null)
         {
             string combination;
             if (data[0] is DEBusinessItem)
             {
                 DEBusinessItem item = (DEBusinessItem)data[0];
                 combination = deMetaAttri.Combination;
                 foreach (DEMetaAttribute attribute2 in this.Attrs)
                 {
                     if (deMetaAttri.Combination.IndexOf("[" + attribute2.Name + "]") > -1)
                     {
                         combination = combination.Replace("[" + attribute2.Name + "]", item.GetAttrValue(this.className, attribute2.Name).ToString());
                     }
                 }
                 combination      = combination.Replace("[ID]", item.Id.ToString());
                 this.Text        = combination.Trim();
                 this.ResourceOid = item.MasterOid;
             }
             else
             {
                 DECopyData data2 = (DECopyData)data[0];
                 if (data2 != null)
                 {
                     if (data2.ClassName != this.className)
                     {
                         MessageBoxPLM.Show("资源类不匹配", "工程资源", MessageBoxButtons.OK);
                     }
                     else
                     {
                         DataRowView view = (DataRowView)data2.ItemList[0];
                         if (view != null)
                         {
                             if ((deMetaAttri != null) && (deMetaAttri.LinkType == 1))
                             {
                                 combination = deMetaAttri.Combination;
                                 foreach (DEMetaAttribute attribute3 in this.Attrs)
                                 {
                                     if (deMetaAttri.Combination.IndexOf("[" + attribute3.Name + "]") > -1)
                                     {
                                         string str2 = "PLM_" + attribute3.Name;
                                         combination = combination.Replace("[" + attribute3.Name + "]", Convert.ToString(view[str2]));
                                     }
                                 }
                                 if (ResFunc.IsRefRes(this.classOid))
                                 {
                                     string str3 = "PLM_M_ID";
                                     combination = combination.Replace("[ID]", Convert.ToString(view[str3]));
                                 }
                                 this.Text = combination.Trim();
                             }
                             else
                             {
                                 this.Text = view["PLM_ID"].ToString();
                             }
                             this.ResourceOid = new Guid((byte[])view["PLM_OID"]);
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 10
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);
        }
Esempio n. 11
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 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();
         }
     }
 }
Esempio n. 12
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);
                    }
                }
            }
        }