当前位置: 首页>>代码示例>>C#>>正文


C# UserRepository.GetUserInfoByUuidAsync方法代码示例

本文整理汇总了C#中UserRepository.GetUserInfoByUuidAsync方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.GetUserInfoByUuidAsync方法的具体用法?C# UserRepository.GetUserInfoByUuidAsync怎么用?C# UserRepository.GetUserInfoByUuidAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserRepository的用法示例。


在下文中一共展示了UserRepository.GetUserInfoByUuidAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PostSendChatForEK

        public async Task<HttpResponseMessage> PostSendChatForEK([FromBody]DualParameter postParameter)
        {
            Guid openid = Guid.Empty;
            Guid.TryParse(postParameter.openID, out openid);
            Guid uuid = postParameter.uuid;
            string textMsg = postParameter.textMsg;
            if(openid == Guid.Empty || uuid == Guid.Empty || string.IsNullOrEmpty(textMsg))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using(UserRepository userRepository = new UserRepository())
            {
                var from = userRepository.GetUserInfoByUuidAsync(openid);
                var to = userRepository.GetUserInfoByUuidAsync(uuid);
                if(await from == null || await to == null)
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.Fail);
                var result = await WeChatSendMQHelper.SendMessage(openid.ToString().ToUpper(), uuid.ToString().ToUpper(), textMsg);
                if(result)
                {
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.Success);
                }
                else
                {
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.Fail);
                }
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:28,代码来源:EKSynchronizController.cs

示例2: PostChatCenterInitialize

        public async Task<HttpResponseMessage> PostChatCenterInitialize([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            if(string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            using(UserRepository userRepository = new UserRepository())
            {
                var uuid = await userRepository.GetUserUuidByOpenid(openid);
                var sessions = await MessageRedisOp.GetSessionsTimeStampByUuid(uuid.ToString().ToUpper(), Order.Descending, 0, -1);
                List<Tuple<double, UserInfo, string>> ChatCenterList = new List<Tuple<double, UserInfo, string>>();
                foreach(var s in sessions)
                {
                    double unreadNum = await MessageRedisOp.GetUnreadScore(uuid.ToString().ToUpper(), s.Key);
                    List<string> uuidPair = await MessageRedisOp.GetUUidsBySessionId(s.Key);
                    string userUuid = uuidPair[0] == uuid.ToString().ToUpper() ? uuidPair[1] : uuidPair[0];

                    Guid userGUID;
                    if(!Guid.TryParse(userUuid, out userGUID) || userGUID.Equals(Guid.Empty))
                        continue;
                    UserInfo toUser = await userRepository.GetUserInfoByUuidAsync(userGUID);

                    var latestMessage = await WeChatReceiveHelper.GetFirstMessagesFromRedis(uuid.ToString().ToUpper(), userUuid.ToUpper());
                    ChatCenterList.Add(Tuple.Create(unreadNum, toUser, latestMessage));
                }
                return WebApiHelper.HttpRMtoJson(ChatCenterList, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:29,代码来源:ChatController.cs

示例3: PostInitialize

        public async Task<HttpResponseMessage> PostInitialize([FromBody]DualParameter postParameter)
        {
            string openid = postParameter.openID;
            Guid uuid = postParameter.uuid;
            if (string.IsNullOrEmpty(openid) && uuid == Guid.Empty)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userRepository = new UserRepository())
            {
                userinfo = await userRepository.GetUserInfoByUuidAsync(uuid);
                if (userinfo == null)
                {
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.NotFound);
                }
                var userUuid = await userRepository.GetUserUuidByOpenid(openid);

                VisitBetweenUser newVisitor = new VisitBetweenUser() { UserGuest_uuid = userUuid, UserHost_uuid = uuid, VisitTime = DateTime.Now };
                await userRepository.AddVisitBetweenUser(newVisitor);

                userinfo.NumOfContacts = await userRepository.GetUserContactNumber(uuid);
                userinfo.NumOfVisitor = await userRepository.GetUserVisitorNumber(uuid);
                userinfo.NumOfFavorite = await userRepository.GetuserFavoriteNumber(uuid);
                userinfo.IsContact = await userRepository.IsUserContact(userUuid, uuid);
                userinfo.IsFavorite = (await userRepository.IsUserFavorite(userUuid, uuid)).ToString();
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, userinfo, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:29,代码来源:ProfessorIndexController.cs

示例4: PostFindProfessors

        public async Task<HttpResponseMessage> PostFindProfessors([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            //获取用户uuid 学校与院系与专业信息。
            Guid useruuid; string xuexiaoname, yuanxiname; long? rf;
            using (UserRepository userRepository = new UserRepository())
            {
                var userinfo = await userRepository.GetUserInfoByOpenid(openid);
                useruuid = userinfo.uuid;
                xuexiaoname = userinfo.Unit;
                yuanxiname = userinfo.Faculty;
                rf = userinfo.ResearchFieldId;

                if (string.IsNullOrEmpty(xuexiaoname) || string.IsNullOrEmpty(yuanxiname))
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "学校,院系有个为空!", HttpStatusCode.OK, customStatus.InvalidArguments);

                //获取score
                double univScore, depScore;
                FindHelper.GetUnivDeptScore(xuexiaoname, yuanxiname, out univScore, out depScore);
                    //return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "学校,院系名称不正规!", HttpStatusCode.OK, customStatus.InvalidArguments);

                //拿到三个集合
                double rfScore = Convert.ToDouble(rf.Value);
                var set = await FindHelper.GetThreeSet(true, univScore, depScore, rfScore);

                var retUuid = FindHelper.FindProfessorRule(useruuid,set.Item1, set.Item2, set.Item3, postParameter.pageIndex, postParameter.pageSize);

                List<Tuple<UserInfo, string, bool>> ret = new List<Tuple<UserInfo, string, bool>>();
                if (retUuid != null && retUuid.Count > 0)
                {
                    using (UserRepository repo = new UserRepository())
                    {
                        List<string> eduList = await ProfessorManager.GetUserEducations(userinfo.uuid);
                        var list = await ProfessorManager.Search_UUid(retUuid);
                        foreach (var v in list)
                        {
                            Guid uuid = Guid.Parse(v.Id);
                            var tempUserinfo = await repo.GetUserInfoByUuidAsync(uuid);
                            string three = !string.IsNullOrEmpty(v.Diwei) ? v.Diwei.Trim() : "";
                            bool isXY = ProfessorManager.IsXiaoYou(eduList, v.Education);
                            ret.Add(Tuple.Create(tempUserinfo, three, isXY));
                        }
                    }
                }
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:51,代码来源:FindPepoleController.cs

示例5: PostChatCenterInitialize

        public async Task<HttpResponseMessage> PostChatCenterInitialize([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            if(string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            using(UserRepository userRepository = new UserRepository())
            {
                var uuid = await userRepository.GetUserUuidByOpenid(openid);

                double unreadNum = await NoticeRedisOp.GetUnreadScore(uuid);
                var latestNotice = await WeChatNoticeReceiveHelper.GetFirstNoticeFromRedis(uuid);
                if(latestNotice != null)
                    latestNotice.RelationObj = await userRepository.GetUserInfoByUuidAsync(latestNotice.RelationID_uuid);
                return WebApiHelper.HttpRMtoJson(Tuple.Create(unreadNum, latestNotice), HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:18,代码来源:NoticeController.cs

示例6: PostSearchrf

        public async Task<HttpResponseMessage> PostSearchrf([FromBody]ProfessorSearchParameter postParameter)
        {
            string openid = postParameter.openID;
            int diwei = string.IsNullOrEmpty(postParameter.labels) ? 0 : ProfessorManager.GetDiweiScore(postParameter.labels);
            bool xiaoyou = postParameter.xiaoyou != null ? postParameter.xiaoyou.Value : false;
            string danwei = postParameter.danwei;

            int index = postParameter.pageIndex;
            int size = postParameter.pageSize;

            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            Guid Myuuid;
            using (UserRepository repo = new UserRepository())
            {
                Myuuid = (await repo.GetUserInfoByOpenid(openid)).uuid;
            }


            var list = await ProfessorManager.Search_rf3(Myuuid, xiaoyou, danwei, diwei, postParameter.address, postParameter.pageIndex, postParameter.pageSize);

            List<Tuple<UserInfo, string, bool>> ret = new List<Tuple<UserInfo, string, bool>>();
            if (list != null && list.Count > 0)
            {
                using (UserRepository repo = new UserRepository())
                {
                    List<string> eduList = await ProfessorManager.GetUserEducations(Myuuid);
                    foreach (var v in list)
                    {
                        Guid uuid = Guid.Parse(v.Id);
                        var userinfo = await repo.GetUserInfoByUuidAsync(uuid);
                        string three = !string.IsNullOrEmpty(v.Diwei) ? v.Diwei.Trim() : "";
                        bool isXY = ProfessorManager.IsXiaoYou(eduList, v.Education);
                        ret.Add(Tuple.Create(userinfo, three, isXY));
                    }
                }
            }
            return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:41,代码来源:ProfessorSearchController.cs

示例7: PostChatInitialize

        public async Task<HttpResponseMessage> PostChatInitialize([FromBody]DualParameter postParameter)
        {
            string openid = postParameter.openID;
            Guid uuid = postParameter.uuid;
            int pageIndex = postParameter.pageIndex;
            if(string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using(UserRepository userRepository = new UserRepository())
            {
                var user = await userRepository.GetUserInfoByOpenid(openid);
                var touser = await userRepository.GetUserInfoByUuidAsync(uuid);
                if(user == null || touser == null)
                {
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.NotFound);
                }
                var chatList = await WeChatReceiveHelper.GetMessage(user.uuid.ToString().ToUpper(), touser.uuid.ToString().ToUpper(), pageIndex);

                return WebApiHelper.HttpRMtoJson(Tuple.Create(user, touser, chatList), HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:23,代码来源:ChatController.cs

示例8: PostGetReadUsers

        public async Task<HttpResponseMessage> PostGetReadUsers([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            long ekid = postParameter.Id;
            int pageIndex = postParameter.pageIndex;
            int pageSize = postParameter.pageSize;
            int fromNo = pageIndex * pageSize;
            int toNo = fromNo + pageSize;

            if (string.IsNullOrEmpty(openid) || ekid == 0)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userR = new UserRepository())
            {
                UserInfo user = await userR.GetUserInfoByOpenid(openid);
                var redis = new RedisManager2<WeChatRedisConfig>();

                var zans = await redis.GetRangeByRankAsync<EKTodayRedis, EKReadPepleZsetAttribute>(ekid.ToString(), from: fromNo, to: toNo);

                List<UserInfo> ret = new List<UserInfo>();
                if (zans != null && zans.Count() > 0)
                {
                    foreach (var v in zans)
                    {
                        UserInfo tmp = await userR.GetUserInfoByUuidAsync(Guid.Parse(v.Key));
                        ret.Add(tmp);
                    }
                }

                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:34,代码来源:EKCommentController.cs

示例9: PostFindStudents

        public async Task<HttpResponseMessage> PostFindStudents([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            //获取用户uuid 学校与院系与专业信息。
            Guid useruuid; string xuexiaoname, yuanxiname; long? rf;
            using (UserRepository userRepository = new UserRepository())
            {
                var userinfo = await userRepository.GetUserInfoByOpenid(openid);
                useruuid = userinfo.uuid;
                xuexiaoname = userinfo.Unit;
                yuanxiname = userinfo.Faculty;
                rf = userinfo.ResearchFieldId;

                if (string.IsNullOrEmpty(xuexiaoname) || string.IsNullOrEmpty(yuanxiname))
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "学校,院系有个为空!", HttpStatusCode.OK, customStatus.InvalidArguments);

                //获取score
                double univScore, depScore;
                if (!FindHelper.GetUnivDeptScore(xuexiaoname, yuanxiname, out univScore, out depScore))
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "学校,院系名称不正规!", HttpStatusCode.OK, customStatus.InvalidArguments);

                //拿到三个集合
                double rfScore = Convert.ToDouble(rf.Value);
                var set = await FindHelper.GetThreeSet(false, univScore, depScore, rfScore);

                var retUuid = await FindHelper.FindStudtenRule(useruuid.ToString().ToUpper(), set.Item1, set.Item2, set.Item3, postParameter.pageIndex, postParameter.pageSize);
                
                List<UserInfo> ret = new List<UserInfo>();
                foreach (var s in retUuid)
                {
                    var v = await userRepository.GetUserInfoByUuidAsync(Guid.Parse(s));

                    if (v != null)
                        ret.Add(v);

                    //if (v.ResearchFieldId == 0)
                    //    v.SubResearchFieldId = 120513;//未知
                }

                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:46,代码来源:FindPepoleController.cs

示例10: PostSearch

        public async Task<HttpResponseMessage> PostSearch([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            string queryStr = postParameter.Content;
            int index = postParameter.pageIndex;
            int size = postParameter.pageSize;

            if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(queryStr))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            UserInfo myUserInfo = null;
            using (UserRepository repo = new UserRepository())
            {
                myUserInfo = await repo.GetUserInfoByOpenid(openid);
            }
                List<Tuple<UserInfo, string, bool>> ret = new List<Tuple<UserInfo, string, bool>>();
            var list = await ProfessorManager.Search(myUserInfo.uuid,queryStr, index, size);
            if (list != null && list.Count > 0)
            {
                
                using (UserRepository repo = new UserRepository())
                {
                    List<string> eduList = await ProfessorManager.GetUserEducations(myUserInfo.uuid);
                    foreach (var v in list)
                    {
                        Guid uuid = Guid.Parse(v.Id);
                        var userinfo = await repo.GetUserInfoByUuidAsync(uuid);

                        string three = !string.IsNullOrEmpty(v.Diwei) ? v.Diwei.Trim() : "";
                        bool isXY = ProfessorManager.IsXiaoYou(eduList, v.Education);
                        ret.Add(Tuple.Create(userinfo, three, isXY));
                    }
                }
            }
            return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:37,代码来源:ProfessorSearchController.cs

示例11: PostChatInitialize

        public async Task<HttpResponseMessage> PostChatInitialize([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            int pageIndex = postParameter.pageIndex;
            if(string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using(UserRepository userRepository = new UserRepository())
            {
                var user = await userRepository.GetUserUuidByOpenid(openid);
                if(user == null)
                {
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.NotFound);
                }
                var noticeList = await WeChatNoticeReceiveHelper.GetNotice(user, pageIndex);

                if(noticeList != null)
                    foreach(var n in noticeList)
                    {
                        if(n != null)
                            n.RelationObj = await userRepository.GetUserInfoByUuidAsync(n.RelationID_uuid);
                    }

                return WebApiHelper.HttpRMtoJson(Tuple.Create(user, noticeList), HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:28,代码来源:NoticeController.cs

示例12: 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;
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:22,代码来源:ProfessorManager.cs

示例13: 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>();
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:95,代码来源:ProfessorManager.cs

示例14: PostInitializeMyRecords

        public async Task<HttpResponseMessage> PostInitializeMyRecords([FromBody]DualParameter postParameter)
        {
            string openid = postParameter.openID;
            if (string.IsNullOrEmpty(openid) || Guid.Empty.Equals(postParameter.uuid))
            {
                return WebApiHelper.HttpRMtoJson("必须同时传入openid与uuid", HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            using (UserRepository userRepository = new UserRepository())
            {
                var userUuid = postParameter.uuid;
                if (userUuid == Guid.Empty)
                {
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.NotFound);
                }
                else
                {
                    UserInfo userinfo = await userRepository.GetUserInfoByUuidAsync(userUuid);
                    //研究兴趣
                    string Interests = userinfo.Interests;

                    //学术地位
                    List<UserAcademic> userAcademicList = await userRepository.GetUserRecords(new UserAcademic { AccountEmail_uuid = userUuid });
                    List<string> acadmeicList = RepositoryHelper.ConvertUserAcademicToString(userAcademicList);

                    //项目资助
                    List<UserAwards> userAwardList = await userRepository.GetUserRecords(new UserAwards() { AccountEmail_uuid = userUuid });
                    //教育经历
                    List<UserEducation> userEducationList = await userRepository.GetUserRecords(new UserEducation() { AccountEmail_uuid = userUuid });

                    //工作经历
                    List<UserExperience> userExperienceList = await userRepository.GetUserRecords(new UserExperience() { AccountEmail_uuid = userUuid });

                    //论文数
                    int userArticleNumber = await userRepository.GetUserRecordsNumber(new UserArticle() { AccountEmail_uuid = userUuid });

                    //专利数
                    int userPatendNumber = await userRepository.GetUserRecordsNumber(new UserPatent() { AccountEmail_uuid = userUuid });

                    //访问过我的人还访问过谁
                    int visitorsBeenToNumber = await userRepository.GetVisitorBeenToNumber(userUuid);
                    List<UserInfo> visitorsBeenTo = await userRepository.GetVisitorBeenTo(userUuid, 6);

                    Dictionary<string, object> tempResult = new Dictionary<string, object>();

                    tempResult.Add("Interests", Interests);
                    tempResult.Add("acadmeicList", acadmeicList);
                    tempResult.Add("userAwardList", userAwardList);
                    tempResult.Add("userEducationList", userEducationList);
                    tempResult.Add("userExperienceList", userExperienceList);
                    tempResult.Add("userArticleNumber", userArticleNumber);
                    tempResult.Add("userPatendNumber", userPatendNumber);
                    tempResult.Add("visitorsBeenToNumber", visitorsBeenToNumber);
                    tempResult.Add("visitorsBeenToTopSix", visitorsBeenTo);
                    return WebApiHelper.HttpRMtoJson(tempResult, HttpStatusCode.OK, customStatus.Success);
                }

            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:58,代码来源:ProfessorIndexController.cs

示例15: PostUserInfo

        public async Task<HttpResponseMessage> PostUserInfo([FromBody]UserRecordsParameter postParameter)
        {
            string openid = postParameter.openID;
            Guid uuid = postParameter.uuid;
            if (string.IsNullOrEmpty(openid) || uuid == Guid.Empty)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userRepository = new UserRepository())
            {
                var userinfo = await userRepository.GetUserInfoByUuidAsync(uuid);
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, userinfo, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:15,代码来源:UserIndexController.cs


注:本文中的UserRepository.GetUserInfoByUuidAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。