Пример #1
0
        public string GetResourceID(Guid resOID, string clsName)
        {
            string str   = "PLM_CUS_" + clsName;
            string str2  = "";
            ulong  stamp = 0L;

            if (resOID != Guid.Empty)
            {
                DataSet set;
                this.Attrs = this.GetAttributes(clsName);
                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);
        }
Пример #2
0
        public Guid GetResourceOID(string id, string clsName)
        {
            string str   = "PLM_CUS_" + clsName;
            Guid   empty = Guid.Empty;
            ulong  stamp = 0L;

            if (id != "")
            {
                DataSet set;
                this.Attrs = this.GetAttributes(clsName);
                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);
        }