Beispiel #1
0
        //获取包名或者业务单元名称
        public static string getBizOrPackAlias(XmlTextReader reader, MetaDataTypeEnum metaDatetype)
        {
            string alias = "";

            if (reader == null)
            {
                return(alias);
            }
            XmlDocument xml = new XmlDocument();

            xml.Load(reader);
            XmlNamespaceManager nsMgr = new XmlNamespaceManager(xml.NameTable);

            nsMgr.AddNamespace("ns", "com.kingdee.bos.metadata");
            XmlNode root = null;

            switch (metaDatetype)
            {
            case MetaDataTypeEnum.bizUnit:
                root = xml.SelectSingleNode("/ns:bizUnit", nsMgr);
                break;

            case MetaDataTypeEnum.package:
                root = xml.SelectSingleNode("/ns:package", nsMgr);
                break;
            }
            if (root != null)
            {
                XmlNode aliasNode = root.SelectSingleNode("ns:alias", nsMgr);
                if (aliasNode != null)
                {
                    string      aliasName = aliasNode.InnerText.Trim();
                    XmlNodeList rsList    = root.SelectNodes("ns:resource/ns:rs", nsMgr);
                    foreach (XmlNode rs in rsList)
                    {
                        string key = rs.Attributes["key"].Value;
                        if (key.Trim() == aliasName)
                        {
                            foreach (XmlNode lang in rs.ChildNodes)
                            {
                                string locale = lang.Attributes["locale"].Value;
                                if (locale == "en_US")
                                {
                                    alias = lang.Attributes["value"].Value;
                                }
                                else if (locale == "zh_CN")
                                {
                                    alias = lang.Attributes["value"].Value;
                                    return(alias);
                                }
                            }
                        }
                    }
                }
            }
            return(alias);
        }
Beispiel #2
0
        public static void AddNew(MetaDataTypeEnum metaDataType, int sortMainId, string data)
        {
            SortMetaDataObject meta = new SortMetaDataObject();

            meta.MetaDataTypeEnum = metaDataType;
            meta.SortMainId       = sortMainId;
            meta.Data             = data;
            meta.Save();
        }
Beispiel #3
0
        public List <SortMetaDataObject> GetSortMetaDatas(int sortMainId, MetaDataTypeEnum metaDataType)
        {
            string sql = @" SELECT d.*, s.Title as 'SortTitle' 
                            FROM dat_SortMetaData d
                            inner join dat_SortMain s on s.SortMainId = d.SortMainId
                            WHERE d.SortMainId = @SortMainId 
                            AND d.MetaDataType = @MetaDataType";

            return(Config.Conn.Query <SortMetaDataObject>(sql, new { SortMainId = sortMainId, MetaDataType = metaDataType.ToString() }).ToList());
        }
Beispiel #4
0
        public static string getPath(string fullName, MetaDataTypeEnum metaDataType)
        {
            string path = fullName.Replace(".", "\\");

            path = baseDir + path;
            switch (metaDataType)
            {
            case MetaDataTypeEnum.bizUnit:
                path = path + ".bizunit";
                break;

            case MetaDataTypeEnum.package:
                path = path + ".package";
                break;

            case MetaDataTypeEnum.entity:
                path = path + ".entity";
                break;

            case MetaDataTypeEnum.relation:
                path = path + ".relation";
                break;

            case MetaDataTypeEnum.table:
                path = path + ".table";
                break;

            case MetaDataTypeEnum.enums:
                path = path + ".enum";
                break;

            case MetaDataTypeEnum.ui:
                path = path + ".ui";
                break;

            case MetaDataTypeEnum.query:
                path = path + ".query";
                break;

            case MetaDataTypeEnum.none:
                path = null;
                break;

            default:
                path = null;
                break;
            }
            return(path);
        }
Beispiel #5
0
        public static MetaDataTypeEnum xmlPathIsMetaDateType(string path)
        {
            MetaDataTypeEnum metaDateType = MetaDataTypeEnum.none;

            if (path == null || path.Trim().Length == 0)
            {
                return(metaDateType);
            }
            if (path.IndexOf(".entity") > -1)
            {
                metaDateType = MetaDataTypeEnum.entity;
            }
            else if (path.IndexOf(".bizunit") > -1)
            {
                metaDateType = MetaDataTypeEnum.bizUnit;
            }
            else if (path.IndexOf(".package") > -1)
            {
                metaDateType = MetaDataTypeEnum.package;
            }
            else if (path.IndexOf(".relation") > -1)
            {
                metaDateType = MetaDataTypeEnum.relation;
            }
            else if (path.IndexOf(".enum") > -1)
            {
                metaDateType = MetaDataTypeEnum.enums;
            }
            else if (path.IndexOf(".table") > -1)
            {
                metaDateType = MetaDataTypeEnum.table;
            }
            else if (path.IndexOf(".query") > -1)
            {
                metaDateType = MetaDataTypeEnum.query;
            }
            else if (path.IndexOf(".ui") > -1)
            {
                metaDateType = MetaDataTypeEnum.ui;
            }
            return(metaDateType);
        }
Beispiel #6
0
 public MetadataModel(int mainId, MetaDataTypeEnum dataType)
 {
     SortMainId   = mainId;
     MetaDataType = dataType.ToString();
     Metadata     = SortMetaDataObject.GetSortMetaDatas(SortMainId, MetaDataTypeEnum);
 }
Beispiel #7
0
 public static List <SortMetaDataObject> GetSortMetaDatas(int sortMainId, MetaDataTypeEnum metaDataType) => repo.GetSortMetaDatas(sortMainId, metaDataType);
Beispiel #8
0
 public SortMetaDataObject(MetaDataTypeEnum metaDataType)
 {
     MetaDataTypeEnum = metaDataType;
 }