public static DataForNewUser GetDataForNewUser(AuthUser user) { if (user == null || user == User.Guest) { return(null); } DataForNewUser userDataProxy = new DataForNewUser(); ConvertUserProxy(userDataProxy, user); userDataProxy.GenderName = user.GenderName; userDataProxy.ExtendedFields = new List <UserExtendedValueProxy>(); foreach (UserExtendedValue extendedValue in user.ExtendedFields) { userDataProxy.ExtendedFields.Add(GetUserExtendedValueProxy(extendedValue)); } userDataProxy.IPAddress = user.LastVisitIP; userDataProxy.IsActive = user.IsActive; userDataProxy.Password = user.Password; userDataProxy.PasswordFormat = (int)user.PasswordFormat; userDataProxy.Signature = user.Signature; userDataProxy.SignatureFormat = (int)user.SignatureFormat; userDataProxy.TimeZone = user.TimeZone; userDataProxy.InviterID = user.InviterID; //getfriend FriendGroupCollection friendgroups = user.FriendGroups; userDataProxy.FriendGroups = new List <MaxLabs.Passport.Proxy.FriendGroupProxy>(); foreach (FriendGroup fg in friendgroups) { MaxLabs.Passport.Proxy.FriendGroupProxy fgp = GetFriendGroupProxy(fg); userDataProxy.FriendGroups.Add(fgp); FriendCollection friends = FriendBO.Instance.GetFriends(user.UserID, fg.GroupID); foreach (MaxLabs.bbsMax.Entities.Friend friend in friends) { fgp.Friends.Add(GetFriendProxy(friend)); } } //getExtendedFields //userDataProxy.ExtendedFields = GetStringKeyValueList(user.ExtendedFields); return(userDataProxy); }
public static MaxLabs.Passport.Proxy.FriendGroupProxy GetFriendGroupProxy(FriendGroup group) { if (group == null) { return(null); } MaxLabs.Passport.Proxy.FriendGroupProxy friendGroupProxy = new MaxLabs.Passport.Proxy.FriendGroupProxy(); friendGroupProxy.GroupID = group.GroupID; friendGroupProxy.Name = group.Name; friendGroupProxy.TotalFriends = group.TotalFriends; friendGroupProxy.IsShield = group.IsShield; friendGroupProxy.OwnerUserID = group.UserID; return(friendGroupProxy); }
public static MaxLabs.Passport.Proxy.FriendGroupProxy GetFriendGroupProxy(FriendGroup group) { if (group == null) return null; MaxLabs.Passport.Proxy.FriendGroupProxy friendGroupProxy = new MaxLabs.Passport.Proxy.FriendGroupProxy(); friendGroupProxy.GroupID = group.GroupID; friendGroupProxy.Name = group.Name; friendGroupProxy.TotalFriends = group.TotalFriends; friendGroupProxy.IsShield = group.IsShield; friendGroupProxy.OwnerUserID = group.UserID; return friendGroupProxy; }
public APIResult Friend_CreateFriendGroup(int userID, string groupName, out FriendGroupProxy friendGroup) { friendGroup = null; if (!CheckClient()) return null; APIResult result= new APIResult(); FriendGroup newGroup = null; int errorCode; using (ErrorScope es = new ErrorScope()) { try { result.IsSuccess = FriendBO.Instance.Server_AddFriendGroup(userID, groupName, out newGroup, out errorCode); if (result.IsSuccess == false) { es.CatchError<ErrorInfo>(delegate(ErrorInfo error) { result.AddError(error.TatgetName,error.Message); }); } result.ErrorCode = errorCode; } catch (Exception ex) { result.AddError(ex.Message); result.IsSuccess = false; result.ErrorCode = Consts.ExceptionCode; } friendGroup = ProxyConverter.GetFriendGroupProxy(newGroup); } return result; }
public List<FriendGroupProxy> Friend_GetFriendGroupsWithFriends(int userID) { if (!CheckClient()) return null; List<FriendGroupProxy> groups = new List<FriendGroupProxy>(); FriendGroupCollection temp = FriendBO.Instance.GetFriendGroups(userID); FriendGroupProxy blackGroup = new FriendGroupProxy(); blackGroup.GroupID = -1; blackGroup.Name = "#black list"; FriendCollection friends = FriendBO.Instance.GetFriendAndBlackList(userID); foreach (BlacklistItem b in friends.Blacklist) { FriendProxy fItem = new FriendProxy(); fItem.GroupID = b.GroupID; fItem.UserID = b.UserID; blackGroup.Friends.Add(fItem); } foreach (FriendGroup fg in temp) { groups.Add(ProxyConverter.GetFriendGroupProxy(fg)); } while (friends.Count > 0) { Friend friend = friends[friends.Count - 1]; FriendProxy fp = ProxyConverter.GetFriendProxy(friend); foreach (FriendGroupProxy proxy in groups) { if (proxy.GroupID == friend.GroupID) { proxy.Friends.Add(fp); } } friends.Remove(friend); } groups.Add(blackGroup); return groups; }
public override void Execute(int userID, DateTime instructDateTime, string datas) { MaxLabs.Passport.Proxy.FriendGroupProxy friendGroupProxy = DataReadWrap.Get <MaxLabs.Passport.Proxy.FriendGroupProxy>(datas); FriendBO.Instance.Client_RenameFriendGroup(friendGroupProxy.OwnerUserID, friendGroupProxy.GroupID, friendGroupProxy.Name); }