public static async Task<String> SaveOrUpdateAcademic(UserAcademic input) { string url = Form1.GetHost + "SaveOrUpdateUserAcademic"; Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("UserAcademic.id", input.Id.ToString()); if (input.AccountEmail_uuid.Equals(Guid.Empty)) return "error"; dic.Add("UserAcademic.AccountEmail_uuid", input.AccountEmail_uuid.ToString()); dic.Add("UserAcademic.Association", input.Association); dic.Add("UserAcademic.AssociationPost", input.AssociationPost); dic.Add("UserAcademic.Fund", input.Fund); dic.Add("UserAcademic.FundPost", input.FundPost); dic.Add("UserAcademic.Magazine", input.Magazine); dic.Add("UserAcademic.MagazinePost", input.MagazinePost); string retStr = await BK.CommonLib.Util.HttpUtil.RequestUtility.HttpPostAsync(url, formData: dic); return retStr; }
public static ProfessorIndex GenObject(Guid uuid) { if (uuid.Equals(Guid.Empty)) return null; ProfessorIndex index = new ProfessorIndex(); index.Id = uuid.ToString(); StringBuilder sb = new StringBuilder(); using (UserRepository repo = new UserRepository()) { var userinfo = repo.GetUserInfoByUuid_TB(uuid); if (userinfo.IsBusiness != 0) return null; if (userinfo.ResearchFieldId == null) userinfo.ResearchFieldId = 0; UserEducation userEducation = new UserEducation(); userEducation.AccountEmail_uuid = uuid; var educationList = repo.GetUserRecords_TB<UserEducation>(userEducation); UserAcademic userAc = new UserAcademic();userAc.AccountEmail_uuid = uuid; var acadmicList = repo.GetUserRecords_TB<UserAcademic>(userAc); //research id index.ResearchId = userinfo.ResearchFieldId.Value; sb.Append(string.Format("{0} ",userinfo.ResearchFieldId.Value.ToString())); //姓名 index.Name = userinfo.Name; sb.Append(string.Format("{0} ", userinfo.Name)); //研究兴趣 sb.Append(string.Format("{0} ", userinfo.Interests)); index.Interests = userinfo.Interests; //单位 sb.Append(string.Format("{0} ", userinfo.Unit)); index.Danwei = userinfo.Unit; //地位 if (acadmicList!=null && acadmicList.Count>0) { List<string> tmp = new List<string>(); int diweiScore = 0; foreach(var v in acadmicList) { if(!string.IsNullOrEmpty(v.Association)) { if (!tmp.Contains("协会委员")) { tmp.Add("协会委员"); diweiScore += 1; } } if (!string.IsNullOrEmpty(v.Fund)) { if (!tmp.Contains("基金评审")) { tmp.Add("基金评审"); diweiScore += 4; } } if (!string.IsNullOrEmpty(v.Magazine)) { if (!tmp.Contains("杂志编委")) { tmp.Add("杂志编委"); diweiScore += 2; } } } StringBuilder diweisb = new StringBuilder(); foreach(string s in tmp) { sb.Append(string.Format("{0} ", s)); diweisb.Append(string.Format("{0} ", s)); } index.Diwei = diweisb.ToString(); index.DiweiScore = diweiScore; } //校友 StringBuilder xiaoyousb = new StringBuilder(); if(educationList!=null && educationList.Count>0) { foreach(var v in educationList) { if(!string.IsNullOrEmpty(v.School)) { sb.Append(string.Format("{0} ", v.School)); xiaoyousb.Append(string.Format("{0} ", v.School)); } } index.Education = xiaoyousb.ToString(); } //地点 if(!string.IsNullOrEmpty(userinfo.Address)) { string adress = userinfo.Address.Replace(" ", "").Trim(); sb.Append(string.Format("{0} ", adress)); index.Address = adress; } //点击量 double score = _redis.GetScore<NameCardRedis, NameCardPCountZsetAttribute>(userinfo.uuid.ToString()); index.AccessCount = score; } index.KeyWords = sb.ToString(); return index; }