Esempio n. 1
0
        /// <summary>
        /// 得到子级(包括部门)(不是树 是list)
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="OrgList"></param>
        /// <returns></returns>
        public List <OrganizeModel> GetAllChildList(long orgId, List <OrganizeModel> OrgList = null)
        {
            if (OrgList == null)
            {
                OrgList = new List <OrganizeModel>();
            }
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic)
            .Add(ORMRestrictions <String> .Eq("RelatId", "lg"))
            .Add(ORMRestrictions <Int64> .Eq("ParentOrgId", orgId));
            IList <OrgRelatitem2Model> orgRelatitems = OrgRelatitem2Rule.Find(dic);

            if (orgRelatitems.Count > 0)
            {
                for (var i = 0; i < orgRelatitems.Count; i++)
                {
                    OrganizeModel Orgdata = OrganizationRule.Find(orgRelatitems[i].OrgId);
                    if (Orgdata.IfCorp == "Y" && Orgdata.IsActive == "1")//筛选组织
                    {
                        OrgList.Add(Orgdata);
                        GetAllChildList(Orgdata.PhId, OrgList);
                    }
                }
            }
            Dictionary <string, object> dicDept = new Dictionary <string, object>();

            new CreateCriteria(dicDept)
            .Add(ORMRestrictions <Int64> .Eq("ParentOrgId", orgId))
            .Add(ORMRestrictions <String> .Eq("IfCorp", "N"))
            .Add(ORMRestrictions <String> .Eq("IsActive", "1"));
            List <OrganizeModel> Depts = OrganizationRule.Find(dicDept).ToList();

            if (Depts.Count > 0)
            {
                for (var i = 0; i < Depts.Count; i++)
                {
                    OrgList.Add(Depts[i]);
                }
            }
            return(OrgList);
        }
        private static void ExtractNERTags(CoreDocument coredoc, Lucene.Net.Documents.Document document)
        {
            //I have no clue as to why NER-tagged messages are stored like that. I guess there is some deep idea behind copying the same info over and over again (or, most likely, this is because some documents have more than one sentence. even tho its stil really stupid)
            if (coredoc != null)
            {
                List nerList = coredoc.entityMentions();
                if (nerList.size() > 0)
                {
                    for (int j = 0; j < nerList.size(); j++)
                    {
                        CoreEntityMention em = (CoreEntityMention)nerList.get(j);
                        //Does this need to be a switch case?
                        if (em.entityType() == "DATE")
                        {
                            var datekey = document.GetField("id").GetInt32Value().Value;
                            if (!DateList.ContainsKey(datekey))
                            {
                                DateList.Add(datekey, em.text());
                            }
                            else
                            {
                                DateList.TryUpdate(datekey, DateList[datekey] + ", " + em.text());
                            }
                        }
                        if (em.entityType() == "TIME")
                        {
                            var timekey = document.GetField("id").GetInt32Value().Value;
                            if (!TimeList.ContainsKey(timekey))
                            {
                                TimeList.Add(timekey, em.text());
                            }
                            else
                            {
                                TimeList.TryUpdate(timekey, TimeList[timekey] + ", " + em.text());
                            }
                        }

                        if (em.entityType() == "LOCATION")
                        {
                            var lockey = document.GetField("id").GetInt32Value().Value;
                            if (!LocList.ContainsKey(lockey))
                            {
                                LocList.Add(lockey, em.text());
                            }
                            else
                            {
                                LocList.TryUpdate(lockey, LocList[lockey] + ", " + em.text());
                            }
                        }
                        if (em.entityType() == "ORGANIZATION")
                        {
                            var orgkey = document.GetField("id").GetInt32Value().Value;
                            if (!OrgList.ContainsKey(orgkey))
                            {
                                OrgList.Add(orgkey, em.text());
                            }
                            else
                            {
                                OrgList.TryUpdate(orgkey, OrgList[orgkey] + ", " + em.text());
                            }
                        }

                        if (em.entityType() == "URL")
                        {
                            var urlkey = document.GetField("id").GetInt32Value().Value;
                            if (!URLList.ContainsKey(urlkey))
                            {
                                URLList.Add(urlkey, em.text());
                            }
                            else
                            {
                                URLList.TryUpdate(urlkey, OrgList[urlkey] + ", " + em.text());
                            }
                        }
                    }
                }
            }
        }