十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
报错:指定对象不在字典中解决方案:
创新互联专注于企业网络营销推广、网站重做改版、五指山网站定制设计、自适应品牌网站建设、H5高端网站建设、商城网站开发、集团公司官网建设、外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为五指山等各大城市提供网站开发制作服务。Creator = ( creatorDic.ContainsKey(d.Creator.Value) && d.Creator != null) ? creatorDic[d.Creator.Value] : "",
----------------------------------
public void GetList(MLevel model) { if (string.IsNullOrEmpty(model.SArg.Title)) { model.SArg.Title = string.Empty; } if (model.Key == Guid.Empty) { model.SchoolId = TypeKit.ToGuid(YK.School.Core.Context.SchoolId, Guid.Empty); } else { model.SchoolId = model.Key; } var dbSchool = DbContext.SchoolUnitOfWorkCreate(); var dbPlatform = DbContext.PlatformWorkCreate(); try { var query = dbSchool.Query().Where(t => t.SchoolId == model.SchoolId); if (!string.IsNullOrEmpty(model.SArg.Title)) { query = query.Where(t => t.LName.Contains(model.SArg.Title)); } model.PArg.RowsCount = query.Count(); query = query.OrderByDescending(d => d.LNo).Skip(model.PArg.FirstRowIndex).Take(model.PArg.PageSize); var levelList = query.ToList(); var lIdList = levelList.Select(d => d.Id); List creatorIds = levelList.Where(l => l.Creator != null).Select(l => l.Creator).Distinct().ToList(); var creatorDic = dbPlatform.Query ().Where(a => creatorIds.Contains(a.Id)).ToDictionary(a => a.Id, a => a.RealName); var cList = dbSchool.Query ().Where(c => c.SchoolId == model.SchoolId && c.Sc_LevelId != null && lIdList.Contains(c.Sc_LevelId ?? Guid.Empty)); model.levellist = levelList.Select(d => new MLevel.Level { Key = d.Id, State = cList.Count(c => c.Sc_LevelId == d.Id) > 0 ? ("已引用") : ("未引用"), Value = d.LName, Creator = ( creatorDic.ContainsKey(d.Creator.Value) && d.Creator != null) ? creatorDic[d.Creator.Value] : "", CreateType = d.CreateType == 1 ? ("管理员创建") : (d.CreateType == 2 ? ("班主任创建班级时自定义") : (d.CreateType == 3 ? ("华网导入") : ("无数据"))), CreateOn = d.CreatedOn.ToString() }).Where(d=>d.Value.Contains(model.SArg.Title)) .ToList(); } finally { dbSchool.Dispose(); dbPlatform.Dispose(); } }
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。