/// <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); } }
/// <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); } }