本文整理汇总了C#中UserRepository.GetUserRecordsByUuid方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.GetUserRecordsByUuid方法的具体用法?C# UserRepository.GetUserRecordsByUuid怎么用?C# UserRepository.GetUserRecordsByUuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository.GetUserRecordsByUuid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUCErrorUserAcademic
public async Task<List<UserAcademic>> GetUCErrorUserAcademic(Guid uuid)
{
List<UserAcademic> ret = new List<UserAcademic>();
using (UserRepository repo = new UserRepository())
{
ret = await repo.GetUserRecordsByUuid<UserAcademic>(uuid);
}
return ret;
}
示例2: GetUserEducations
public static async Task<List<string>> GetUserEducations(Guid uuid)
{
List<UserEducation> eduList = null;
List<string> ret = null;
using (UserRepository repo = new UserRepository())
{
var userinfo = await repo.GetUserInfoByUuidAsync(uuid);
eduList = await repo.GetUserRecordsByUuid<UserEducation>(userinfo.uuid);
}
if(eduList!=null)
{
ret = new List<string>();
foreach(var v in eduList)
{
string school = v.School.Trim().ToLower();
if (!string.IsNullOrEmpty(school) && !ret.Contains(school))
ret.Add(school);
}
}
return ret;
}
示例3: Search_rf3
public static async Task<List<ProfessorIndex>> Search_rf3(Guid uuid, bool xiaoyou = false, string danwei = "", int diwei =0, string address = "", int pageIndex = 0, int pageSize = 10)
{
try
{
int from = pageIndex * pageSize;
int size = pageSize;
List<ProfessorIndex> ret = new List<ProfessorIndex>();
UserInfo userinfo = null; List<UserEducation> eduList = null;
using (UserRepository repo = new UserRepository())
{
userinfo = await repo.GetUserInfoByUuidAsync(uuid);
eduList = await repo.GetUserRecordsByUuid<UserEducation>(userinfo.uuid);
}
//researchfieldid
if (userinfo.ResearchFieldId == null)
return new List<ProfessorIndex>();
string rfid = userinfo.ResearchFieldId.ToString();
var rfContainer = Query<ProfessorIndex>.Term("ResearchId", rfid.ToString());
var myuuidContainer = Query<ProfessorIndex>.Term("Id", uuid.ToString());
QueryContainer container = rfContainer && !myuuidContainer;
//标签
if (diwei != 0 || xiaoyou)
{
QueryContainer xyContainer = null;
QueryContainer diweiContainer = null;
QueryContainer lableContainer = null;
//地位
if (diwei != 0)
{
diweiContainer = MakeDiweiContainer(diwei);
}
//校友
if (xiaoyou && eduList != null)
{
List<string> tmpList = new List<string>();
foreach (UserEducation v in eduList)
{
if (string.IsNullOrEmpty(v.School))
continue;
if (xyContainer == null)
{
xyContainer = Query<ProfessorIndex>.QueryString(q => q.Query(v.School).OnFields(new string[] { "Education" }).DefaultOperator(Operator.And).Analyzer("ik_smart"));
tmpList.Add(v.School);
}
else
{
if (!tmpList.Contains(v.School))
{
xyContainer = xyContainer || (Query<ProfessorIndex>.QueryString(q => q.Query(v.School).OnFields(new string[] { "Education" }).DefaultOperator(Operator.Or).Analyzer("ik_smart")));
tmpList.Add(v.School);
}
}
}
}
//统计
if (xyContainer != null && diweiContainer != null)
lableContainer = diweiContainer || xyContainer;
else
{
lableContainer = xyContainer != null ? xyContainer : diweiContainer;
}
//合并
if (lableContainer != null)
container = container && lableContainer;
}
//单位
if (!string.IsNullOrEmpty(danwei))
{
container = container && (Query<ProfessorIndex>.QueryString(q => q.Query(danwei).DefaultOperator(Operator.And).Analyzer("ik_smart")));
}
//address
if (!string.IsNullOrEmpty(address))
{
var addressContainer = Query<ProfessorIndex>.QueryString(q => q.Query(address).DefaultOperator(Operator.Or).Analyzer("ik_smart"));
container = container && addressContainer;
}
//search
var result = await _client.SearchAsync<ProfessorIndex>(s => s.Index(_config.IndexName).Query(container).Skip(from).Take(size).SortDescending("DiweiScore").SortDescending("AccessCount"));
ret = result.Documents.ToList();
return ret;
}
catch (Exception ex)
{
LogError(ex);
}
return new List<ProfessorIndex>();
}