예제 #1
0
        /// <summary>
        /// 研究单元-是否有全文
        ///获取所有收录类别下的是否有全文
        /// </summary>
        /// <returns>所有收录类别,是否有全文</returns>

        public List <TypeNameCount> GetSYS_AttachmentListAndCount()
        {
            var    hasnum  = 0;
            var    nonum   = 0;
            string sqlhave = @"SELECT COUNT(*)  FROM  dbo.StaticProductions WHERE ProductionID IN (SELECT BusinessID FROM dbo.Comm_Attachment) ";

            string sqlnot = @"SELECT COUNT(*)  FROM  dbo.StaticProductions WHERE ProductionID not IN (SELECT BusinessID FROM dbo.Comm_Attachment) ";

            using (var db = new OperationManagerDbContext())
            {
                hasnum = db.Database.SqlQuery <int>(sqlhave).FirstOrDefault();
                nonum  = db.Database.SqlQuery <int>(sqlnot).FirstOrDefault();
            }



            List <TypeNameCount> dicList = new List <TypeNameCount>();

            TypeNameCount dic = new TypeNameCount();

            dic.TypeID    = "CommAttachmentTypeID";
            dic.TypeName  = "有";
            dic.TypeCount = hasnum;
            TypeNameCount dic1 = new TypeNameCount();

            dic1.TypeID    = "CommAttachmentTypeID";
            dic1.TypeName  = "无";
            dic1.TypeCount = nonum;
            dicList.Add(dic);
            dicList.Add(dic1);
            return(dicList);
        }
예제 #2
0
        /// <summary>
        /// 研究单元-内容类型
        ///获取所有模板的内容类型,该内容类型下的所有文献数量
        /// </summary>
        /// <param name="userID">userID,登陆用户ID</param>
        /// <returns>所有模板内容类型和该内容类型下的所有文献and数量</returns>

        public async Task <List <TypeNameCount> > GetSYS_TemplateContentTypeListAndCount()
        {
            using (var db = new OperationManagerDbContext())
            {
                SYS_TemplateAdapter  sys_TemplateAdapter = new SYS_TemplateAdapter();
                List <TypeNameCount> dicList             = new List <TypeNameCount>();
                ProductionsAdapter   prad = new ProductionsAdapter();
                List <SYS_Template>  list = await db.SYS_Template.ToListAsync();

                int lic;
                foreach (var sale in list)
                {
                    if (sale.TemplateID.ToString().Length > 0)
                    {
                        TypeNameCount dic = new TypeNameCount();

                        lic = db.StaticProductions.Where(w => w.TemplateID == sale.TemplateID).Count();
                        // dic.TypeID = sale.TemplateID.ToString();
                        dic.TypeID    = "TemplateID";
                        dic.TypeValue = sale.TemplateID.ToString();
                        dic.TypeName  = sale.ContentType;
                        dic.TypeCount = lic;
                        //  dic.Add("ContentTypeList", lic);
                        dicList.Add(dic);
                    }
                }

                return(dicList);
            }
        }
예제 #3
0
        /// <summary>
        /// 研究单元-语言
        ///获取所有语言下的所有文献数量
        /// </summary>
        /// <returns>所有语言,所有语言下的文献数量</returns>

        public async Task <List <TypeNameCount> > GetSYS_LanguageListAndCount()
        {
            SYS_TemplateFieldAdapter sys_TemplateFieldModelAdapter = new SYS_TemplateFieldAdapter();
            ProductionsFieldAdapter  productionsFieldAdapter       = new ProductionsFieldAdapter();


            string sql = @"SELECT DISTINCT Iso FROM dbo.StaticProductions WHERE iso IS NOT NULL AND iso<>''";

            using (var db = new OperationManagerDbContext())
            {
                List <string> strlist = db.Database.SqlQuery <string>(sql).ToList();


                List <TypeNameCount> dicList = new List <TypeNameCount>();


                int lif = 0;
                for (int i = 0; i < strlist.Count; i++)
                {
                    lif = productionsFieldAdapter.LoadByDefaultText("iso", strlist[i]);
                    TypeNameCount dic = new TypeNameCount();
                    // dic.TypeID = "8BC5C3A3-6565-45F8-B77A-891077D4E2A5";
                    dic.TypeID    = "iso";
                    dic.TypeName  = strlist[i];
                    dic.TypeCount = lif;

                    dicList.Add(dic);
                }
                return(dicList);
            }
        }
예제 #4
0
        /// <summary>
        /// 研究单元-收录类别
        ///获取所有收录类别下的所有文献数量
        /// </summary>
        /// <returns>所有收录类别,收录类别下的文献数量</returns>

        public List <TypeNameCount> GetSYS_IndexedTypeListAndCount()
        {
            ProductionsFieldAdapter productionsFieldAdapter = new ProductionsFieldAdapter();


            string sql = @"SELECT DISTINCT indexed FROM dbo.StaticProductions WHERE indexed IS NOT NULL AND indexed<>''";
            List <TypeNameCount> dicList = new List <TypeNameCount>();

            using (var db = new OperationManagerDbContext())
            {
                List <string> strlist = db.Database.SqlQuery <string>(sql).ToList();

                int lif = 0;
                for (int i = 0; i < strlist.Count; i++)
                {
                    string indexsql = @"SELECT COUNT(*) FROM dbo.StaticProductions WHERE indexed='" + strlist[i] + "'";
                    lif = db.Database.SqlQuery <int>(indexsql).FirstOrDefault();
                    TypeNameCount typeNameCount = new TypeNameCount();


                    typeNameCount.TypeID    = "indexed";//收录类别
                    typeNameCount.TypeName  = strlist[i];
                    typeNameCount.TypeCount = lif;

                    dicList.Add(typeNameCount);
                }
            }

            return(dicList);
        }
예제 #5
0
        /// <summary>
        /// 研究单元-内容类型
        ///获取所有模板的内容类型,该内容类型下的所有文献数量
        /// </summary>
        /// <param name="userID">userID,登陆用户ID</param>
        /// <returns>所有模板内容类型和该内容类型下的所有文献and数量</returns>

        public async Task <List <TypeNameCount> > GetSYS_TemplateContentTypeListAndCountAsync(Guid userID)
        {
            using (var db = new OperationManagerDbContext())
            {
                SYS_TemplateAdapter sys_TemplateAdapter = new SYS_TemplateAdapter();
                List <SYS_Template> list = await db.SYS_Template.AsNoTracking().ToListAsync();

                List <TypeNameCount> dicList = new List <TypeNameCount>();
                ProductionsAdapter   prad    = new ProductionsAdapter();
                int lic = 0;
                foreach (var sale in list)
                {
                    TypeNameCount dic = new TypeNameCount();

                    lic = prad.LoadProductionByTempleteIDAndUserID(sale.TemplateID, userID).Count;

                    //  dic.TypeID = sale.TemplateID.ToString();

                    dic.TypeID    = "TemplateID";
                    dic.TypeName  = sale.ContentType;
                    dic.TypeCount = lic;

                    dicList.Add(dic);
                }

                return(dicList);
            }
        }
예제 #6
0
        /// <summary>
        /// 研究单元-发表日期
        /// 获取所有年份下的所有文献数量
        /// </summary>
        /// <param name="userid">userid,登陆用户ID</param>
        /// <returns>所有年份,所有年份下的文献and数量</returns>
        public async Task <List <TypeNameCount> > LoadProductionYearListAndCountByUserID()
        {
            using (var db = new OperationManagerDbContext())
            {
                string sql = @"select year(issued) as year ,count(*) as count from   StaticProductions where issued is not null and issued <>'' group by year(issued) 	 order by year desc";

                List <TypeNameCount> dicList = new List <TypeNameCount>();
                var list = await db.Database.SqlQuery <YearAndCount>(sql).ToListAsync();

                foreach (var sale in list)
                {
                    TypeNameCount dic = new TypeNameCount();
                    dic.TypeName  = sale.Year.ToString();
                    dic.TypeCount = sale.Count;
                    // dic.TypeID = "6A94CC2F-545D-4F80-8843-CA037B84C24F";
                    dic.TypeID = "issued";
                    if (sale.Year.ToString() == "1900")
                    {
                        dic.TypeName = "其它";
                    }
                    dicList.Add(dic);
                }
                return(dicList);
            }
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userid">用户ID</param>
        /// <returns></returns>
        public async Task <List <TypeNameCount> > LoadProductionYearListAndCountByUserIDAsync(Guid userid)
        {
            using (var db = new OperationManagerDbContext())
            {
                string sql = @" select year(tt.issued) as year ,count(*) as count from StaticProductions tt
  group by year(tt.issued) ORDER BY year DESC";

                List <TypeNameCount> dicList = new List <TypeNameCount>();
                var list = await db.Database.SqlQuery <YearAndCount>(sql).ToListAsync();

                foreach (var sale in list)
                {
                    TypeNameCount dic = new TypeNameCount();
                    dic.TypeName  = sale.Year.ToString();
                    dic.TypeCount = sale.Count;
                    // dic.TypeID = "6A94CC2F-545D-4F80-8843-CA037B84C24F";
                    dic.TypeID = "issued";
                    dicList.Add(dic);
                }
                return(dicList);
            }
        }
예제 #8
0
        /// <summary>
        /// 研究单元-发表日期
        /// 获取所有年份下的所有文献数量
        /// </summary>
        /// <param name="userID">userID,用户ID</param>
        /// <returns>所有年份,所有年份下的文献and数量</returns>
        public async Task <List <TypeNameCount> > LoadProductionYearListAndCountByUserID(Guid userID)
        {
            using (var db = new OperationManagerDbContext())
            {
                //string sqlUser = @"SELECT UUID,REPLACE(SurnameChinese,' ','')+REPLACE(NameChinese,' ', '') AS UserName,
                //  REPLACE(SurnamePhoneticize,' ', '')+REPLACE(NamePhoneticize, ' ', '') AS EnglishName FROM dbo.[User] WHERE UUID='" + userID + "' ";
                //UserInfo userInfo = new UserInfo();
                //userInfo = await db.Database.SqlQuery<UserInfo>(sqlUser).FirstOrDefaultAsync();

                string sql = @"SELECT DISTINCT YEAR(sp.issued) AS year,count(*) as count FROM dbo.StaticProductions sp
WHERE CAST(YEAR(sp.issued)AS NVARCHAR) IS NOT NULL  ";
                //if(userInfo != null)//查询用户的 根据用户名称   英文名称 查询作者
                //{
                //    if(!string.IsNullOrEmpty(userInfo.EnglishName))
                //        sql += "WHERE  s.author LIKE '%"+ userInfo.UserName + "%' OR author LIKE '%"+ userInfo.EnglishName + "%' ";
                //    else
                //        sql += "WHERE  s.author LIKE '%"+ userInfo.UserName + "%' ";
                //}

                sql += " group by year(issued) 	 order by year desc";
                List <TypeNameCount> dicList = new List <TypeNameCount>();
                var list = await db.Database.SqlQuery <YearAndCount>(sql).ToListAsync();

                foreach (var sale in list)
                {
                    TypeNameCount dic = new TypeNameCount();
                    dic.TypeName  = sale.Year.ToString();
                    dic.TypeCount = sale.Count;
                    // dic.TypeID = "6A94CC2F-545D-4F80-8843-CA037B84C24F";
                    dic.TypeID = "issued";
                    if (sale.Year.ToString() == "1900")
                    {
                        dic.TypeName = "其它";
                    }
                    dicList.Add(dic);
                }
                return(dicList);
            }
        }
예제 #9
0
    public static int PrintObjTraceInfo(IntPtr L)
    {
        Dictionary<string, int> typecountmap = new Dictionary<string, int>();
        var objmap = LuaStatic.objtracemap;

        foreach (var obj in objmap)
        {
            string name = obj.Value;
            int count;
            if (typecountmap.TryGetValue(name, out count))
            {
                typecountmap[name] = count + 1;
            }
            else
                typecountmap[name] = 1;
        }

        List<TypeNameCount> typelist = new List<TypeNameCount>();
        foreach (var obj in typecountmap)
        {
            TypeNameCount t = new TypeNameCount();
            t.name = obj.Key;
            t.count = obj.Value;
            typelist.Add(t);
        }

        typelist.Sort((left, right) => -left.count.CompareTo(right.count));
        StringBuilder sb = new StringBuilder();
        sb.AppendLine("objcount: " + objmap.Count);

        foreach (var obj in typelist)
        {
            sb.AppendLine(obj.name);
            sb.AppendLine("Count: " + obj.count);
            sb.AppendLine();
        }

        File.WriteAllText(EntryPoint.Instance.AssetsPath + "/objtracecount.txt", sb.ToString());
        Debug.LogWarning("save to objtracecount.txt");

        return 0;
    }