示例#1
0
        public GroupAndFriendResultModel GetContactList()
        {
            GroupAndFriendResultModel result = new GroupAndFriendResultModel();

            try
            {
                int?memberId = IdentityHelper.GetMemberId();
                if (!memberId.HasValue)
                {
                    throw new OrgException("Invalid member MemberId");
                }

                FriendBL friendBl = new FriendBL();

                var favouriteList = friendBl.GetFriends(memberId.Value, true, OrgComm.Data.Models.Friend.StatusType.Active);
                var friendList    = friendBl.GetFriends(memberId.Value, false, OrgComm.Data.Models.Friend.StatusType.Active);

                GroupBL groupBl = new GroupBL();

                var groupList = groupBl.GetGroupsByMember(memberId.Value, null);

                result.Status  = true;
                result.Message = ((friendList.Count + favouriteList.Count == 0) ? "No friend found." : (friendList.Count + favouriteList.Count).ToString() + " friends found. ")
                                 + ((groupList.Count == 0) ? "No group found." : groupList.Count.ToString() + " groups found.");

                result.Favourites = favouriteList;
                result.Friends    = friendList;
                result.Groups     = groupList;
            }
            catch (OrgException oex)
            {
                result.Status  = false;
                result.Message = oex.Message;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = AppConfigs.InternalErrorMessage;

                if (AppConfigs.DebugInternalMessage)
                {
                    result.InternalMessage = ex.Message;
                }
            }

            return(result);
        }
示例#2
0
        public FriendResultModel GetHiddenMember()
        {
            FriendResultModel result = new FriendResultModel();

            try
            {
                int?memberId = IdentityHelper.GetMemberId();
                if (!memberId.HasValue)
                {
                    throw new OrgException("Invalid member MemberId");
                }

                FriendBL friendBl = new FriendBL();

                var friendList = friendBl.GetFriends(memberId.Value, null, OrgComm.Data.Models.Friend.StatusType.Hide);

                result.Status  = true;
                result.Message = ((friendList.Count == 0) ? "No hidden-friend found." : friendList.Count.ToString() + " hiddend-friends found. ");
                result.Friends = friendList;
            }
            catch (OrgException oex)
            {
                result.Status  = false;
                result.Message = oex.Message;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = AppConfigs.InternalErrorMessage;

                if (AppConfigs.DebugInternalMessage)
                {
                    result.InternalMessage = ex.Message;
                }
            }

            return(result);
        }