Пример #1
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);
            }
        }
Пример #2
0
        /// <summary>
        /// 研究单元-发表日期
        ///获取所有年份下的所有文献数量
        /// </summary>
        /// <returns>所有年份,所有年份下的文献and数量</returns>

        public async Task <List <TypeNameCount> > GetSYS_YearListAndCount()
        {
            ProductionsAdapter productionsAdapter = new ProductionsAdapter();


            return(await productionsAdapter.LoadProductionYearListAndCountByUserID());
        }
Пример #3
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);
            }
        }
Пример #4
0
        /// <summary>
        /// 个人详细信息-收录类别
        ///获取个人所有模板的收录类别,该收录类别的所有文献数量
        /// </summary>
        /// <param name="username">作者的名字</param>
        /// <returns>所有模板收录类别和该收录类别下的所有文献and数量</returns>

        //E134A22A-4187-4318-BB70-BCC66711ED1D 收录类型
        //50883877-E367-4D5B-85FD-5F15A5B2E789 作者
        public List <Dictionary <String, Object> > GetUserIndexedTypeListAndCount(string username)
        {
            SYS_TemplateFieldAdapter sys_TemplateFieldModelAdapter = new SYS_TemplateFieldAdapter();
            ProductionsFieldAdapter  productionsFieldAdapter       = new ProductionsFieldAdapter();
            ProductionsAdapter       productionsAdapter            = new ProductionsAdapter();
            string IndexedTypesql = @"SELECT DISTINCT indexed FROM dbo.StaticProductions WHERE indexed IS NOT NULL AND indexed<>''";

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

                List <Dictionary <String, Object> > dicList = new List <Dictionary <string, object> >();

                for (int i = 0; i < IndexedType.Count; i++)
                {
                    int    count = 0;
                    string sql   = @" SELECT count(*) FROM  StaticProductions WHERE indexed = '" + IndexedType[i] + "' and author LIKE'%" + username + "%'";

                    count = db.Database.SqlQuery <int>(sql).FirstOrDefault();



                    Dictionary <String, Object> dic = new Dictionary <string, object>();
                    dic.Add("IndexedTypeID", "indexed");
                    dic.Add("IndexedType", IndexedType[i]);
                    dic.Add("IndexedTypeCount", count);

                    dicList.Add(dic);
                }

                return(dicList);
            }
        }
Пример #5
0
        /// <summary>
        /// 个人详细信息-语言
        ///获取所有语言下的所有文献数量
        /// </summary>
        /// <param name="username">作者的名字</param>
        /// <returns>所有语言,所有语言下的文献数量</returns>

        public List <Dictionary <String, Object> > GetSYS_LanguageListAndCount(string username)
        {
            SYS_TemplateFieldAdapter sys_TemplateFieldModelAdapter = new SYS_TemplateFieldAdapter();

            ProductionsAdapter productionsAdapter = new ProductionsAdapter();
            //var templateField = sys_TemplateFieldModelAdapter.GetSYS_TemplateFieldByMetaDataID("8BC5C3A3-6565-45F8-B77A-891077D4E2A5");
            string languagesql = @"SELECT DISTINCT Iso FROM dbo.StaticProductions WHERE iso IS NOT NULL AND iso<>''";

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



                // string[] language = templateField.DefaultText.Split(';');
                List <Dictionary <String, Object> > dicList = new List <Dictionary <string, object> >();

                for (int i = 0; i < language.Count; i++)
                {
                    //List<ProductionsField> lif = LoadByDefaultText("8BC5C3A3-6565-45F8-B77A-891077D4E2A5", language[i], "50883877-E367-4D5B-85FD-5F15A5B2E789", username);
                    int    count = 0;
                    string sql   = @" SELECT  count(*) FROM  StaticProductions WHERE iso LIKE '%" + language[i] + "%' and author LIKE'%" + username + "%'";

                    count = db.Database.SqlQuery <int>(sql).FirstOrDefault();


                    Dictionary <String, Object> dic = new Dictionary <string, object>();

                    dic.Add("LanguageTypeID", "iso");
                    dic.Add("LanguageType", language[i]);
                    dic.Add("LanguageTypeCount", count);

                    dicList.Add(dic);
                }



                return(dicList);
            }
        }
        /// <summary>
        /// 根据用户ID查询学者集合
        /// </summary>
        /// <param name="sysuserID"></param>
        /// <returns></returns>
        public async Task <DicData> LoadBySysUserID(Guid sysuserID, int pageSize, int curPage)
        {
            using (var db = new OperationManagerDbContext())
            {
                List <RelationUserAttentionScholarModel> lis = await db.RelationUserAttentionScholar.AsNoTracking().OrderBy(c => c.CreateTime).Where(w => w.SysUserID == sysuserID).ToListAsync();



                string[] values = new string[lis.Count];

                for (int i = 0; i < lis.Count; i++)
                {
                    values[i] = lis[i].ScholarName;
                }



                ProductionsAdapter proadapter = new ProductionsAdapter();
                Task <DicData>     dic        = proadapter.LoadProductionByMetaData("author", values, pageSize, curPage, true);

                return(await dic);
            }
        }