public InstShortInfos GetDictByKey(string key) { var aaa = sysDictService.GetDictsByKey(key); var dict = aaa.ToDictionary(t => t.KeyValue, t => t.Name); return(InstShortInfos.FromDictonary(dict)); }
public InstShortInfos GetDefaultInstSTs() { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add(string.Empty, string.Empty); return(InstShortInfos.FromDictonary(dic)); }
public InstShortInfos GetAllCheckUnitEliminateIsUer() { var data = cacheInsts.Get(PkPmCacheKeys.AllCheckUnitEliminateIsUser); if (data == null) { var dicData = rep.GetDictByCondition <string, string>(r => r.ID != null && r.data_status != "-1" && r.IsUse != 0, r => new { r.ID, r.NAME }); data = InstShortInfos.FromDictonary(dicData); cacheInsts.Put(PkPmCacheKeys.AllCheckUnitEliminateIsUser, data); } return(data); }
public InstShortInfos GetAllCustomST() { var data = cacheInst.Get(PkPmCacheKeys.AllCustomST); if (data == null) { var dicData = repST.GetDictByCondition <string, string>(r => r.Id != null && r.data_status != "-1", r => new { r.Id, r.NAME }); data = InstShortInfos.FromDictonary(dicData); cacheInst.Put(PkPmCacheKeys.AllCustomST, data); } return(data); }
public string GetSTUnitByIdFromAll(InstShortInfos allInsts, string customId) { string unitName = string.Empty; if (customId.IsNullOrEmpty()) { return(unitName); } if (allInsts.TryGetValue(customId, out unitName)) { return(unitName); } else { return(customId); } }
public InstShortInfos GetUserFormalInsts(int userId) { var user = _repUser.GetById(userId); //数据权限检测人员全部从 customid字段取,去掉usercode string customId = user.CustomId; if (customId.IsNullOrEmpty()) { customId = pkpmConfigService.DefaultInst;// defaultInst; } var role = GetUserRole(userId); InstShortInfos insts = new InstShortInfos(); //管理员 if (roleService.IsAdmin(role) || roleService.IsReport(role)) { insts = checkUnitService.GetAllFormalCheckUnit(); } else if (roleService.IsSuperVisor(role)) //监督 { var userArea = GetUserAreas(userId); //有地区先从地区获取数据 if (userArea != null && userArea.Count > 0) { insts = checkUnitService.GetUnitByArea(userArea); } else { var userCustoms = userCustomrep.GetByCondition(r => r.UserId == userId && r.UserCustomType == UserCustomType.UserLogCustom); //无地区从人员机构表中获取特定的机构 if (userCustoms != null && userCustoms.Count > 0) { var allInsts = checkUnitService.GetAllFormalCheckUnit(); Dictionary <string, string> dicUserCustoms = new Dictionary <string, string>(); foreach (var item in userCustoms) { string value = checkUnitService.GetCheckUnitByIdFromAll(allInsts, item.CustomId); dicUserCustoms[item.CustomId] = value; } insts = InstShortInfos.FromDictonary(dicUserCustoms); } else { insts = checkUnitService.GetAllFormalCheckUnit(); } } } else { insts = checkUnitService.GetSubInsts(customId); } if (insts.Count == 0) { insts = checkUnitService.GetDefaultInsts(); } cacheInsts.Put(PkPmCacheKeys.CustomsByUserIdFmt.Fmt(userId), insts); return(insts); }
public InstShortInfos GetUnitByIdST(string customId) { return(InstShortInfos.FromDictonary(repST.GetDictByCondition <string, string>(r => r.Id != null && r.Id == customId, r => new { r.Id, r.NAME }))); }
public InstShortInfos GetPartCheckUnitST(string customPart) { return(InstShortInfos.FromDictonary(repST.GetDictByCondition <string, string>(r => r.Id != null && r.Id.StartsWith(customPart), r => new { r.Id, r.NAME }))); }