Пример #1
0
        private MembershipServiceRef.Buddy ConvertBuddy(BuddyTableEntity phoneBuddy)
        {
            var serverBuddy = new MembershipServiceRef.Buddy();

            serverBuddy.BuddyID      = Convert.ToInt64(phoneBuddy.BuddyRelationshipId);
            serverBuddy.UserID       = Convert.ToInt64(phoneBuddy.BuddyUserId);
            serverBuddy.Email        = phoneBuddy.Email;
            serverBuddy.Name         = (phoneBuddy.Name.StartsWith("*") || phoneBuddy.Name.StartsWith("+")) ? phoneBuddy.Name.Substring(0, phoneBuddy.Name.Length - 1) : phoneBuddy.Name;
            serverBuddy.MobileNumber = phoneBuddy.PhoneNumber;
            serverBuddy.ToRemove     = phoneBuddy.IsDeleted;
            serverBuddy.IsPrimeBuddy = phoneBuddy.IsPrimeBuddy;
            serverBuddy.State        = phoneBuddy.State;
            return(serverBuddy);
        }
Пример #2
0
        private BuddyTableEntity ConvertBuddy(MembershipServiceRef.Buddy serverBuddy, string profileId = "")
        {
            var phoneBuddy = new BuddyTableEntity();

            phoneBuddy.BuddyRelationshipId = serverBuddy.BuddyID.ToString();
            phoneBuddy.MyProfileId         = profileId == string.Empty ? Globals.User.CurrentProfileId : profileId;
            phoneBuddy.BuddyUserId         = serverBuddy.UserID.ToString();
            phoneBuddy.Email        = serverBuddy.Email;
            phoneBuddy.Name         = serverBuddy.State == MembershipServiceRef.BuddyState.Suspended && !serverBuddy.Name.StartsWith("*") ? "*" + serverBuddy.Name : (serverBuddy.State == MembershipServiceRef.BuddyState.Marshal && !serverBuddy.Name.StartsWith("+") ? "+" + serverBuddy.Name : serverBuddy.Name);
            phoneBuddy.PhoneNumber  = serverBuddy.MobileNumber;
            phoneBuddy.IsDeleted    = serverBuddy.ToRemove;
            phoneBuddy.IsPrimeBuddy = serverBuddy.IsPrimeBuddy;

            phoneBuddy.OrderNumber      = 0;
            phoneBuddy.BorderThickness  = new Thickness(2);
            phoneBuddy.BuddyStatusColor = Constants.WhiteColorCode;
            phoneBuddy.State            = serverBuddy.State;

            return(phoneBuddy);
        }