Exemplo n.º 1
0
        internal static void FillProfileEntity(model.Profile pe, contract.Profile profile, bool RestrictPhone)
        {
            if (profile == null || pe == null)
            {
                return;
            }
            pe.UserID    = profile.UserID;
            pe.ProfileID = profile.ProfileID;

            if (profile.PhoneSetting == null)
            {
                profile.PhoneSetting = new contract.DeviceSetting();
            }


            if (!RestrictPhone)
            {
                pe.MobileNumber  = utility.Security.Encrypt(profile.MobileNumber);
                pe.SecurityToken = profile.SecurityToken;
            }

            pe.CanEmail = profile.CanMail;
            pe.CanPost  = profile.CanPost;

            pe.IsValid = profile.IsValid;

            pe.RegionCode = profile.RegionCode;

            pe.CanSMS = profile.CanSMS;

            pe.LocationConsent = profile.LocationConsent;

            if (profile.PhoneSetting != null)
            {
                pe.DeviceID   = profile.PhoneSetting.DeviceID;
                pe.DeviceType = GetDeviceType(profile.PhoneSetting.PlatForm);
            }
            //Filled in Fill FBDetails
            pe.FBGroup   = profile.FBGroupName;
            pe.FBGroupID = profile.FBGroupID;

            pe.EnterpriseSecurityToken = profile.EnterpriseSecurityToken;
            pe.EnterpriseEmailID       = profile.EnterpriseEmailID;
            pe.NotificationUri         = profile.NotificationUri;
        }
Exemplo n.º 2
0
        internal static contract.Profile MakeContractProfile(model.Profile profileEntity, model.User userEntity,
                                                             List <contract.Group> groupsAsociated, List <model.Buddy> buddies, List <contract.ProfileLite> LocateBuds)
        {
            if (profileEntity == null)
            {
                return(null);
            }

            var retProfile = new contract.Profile();

            retProfile.ProfileID = profileEntity.ProfileID;
            retProfile.UserID    = profileEntity.UserID;

            retProfile.Name         = userEntity.Name;
            retProfile.Email        = userEntity.Email;
            retProfile.MobileNumber = (string.IsNullOrEmpty(utility.Security.Decrypt(profileEntity.MobileNumber)))
                ? utility.Security.Decrypt(userEntity.MobileNumber)
                : utility.Security.Decrypt(profileEntity.MobileNumber);
            retProfile.CanPost         = profileEntity.CanPost;
            retProfile.CanMail         = profileEntity.CanEmail;
            retProfile.CanSMS          = profileEntity.CanSMS;
            retProfile.IsValid         = profileEntity.IsValid;
            retProfile.LocationConsent = profileEntity.LocationConsent;
            retProfile.RegionCode      = profileEntity.RegionCode;
            retProfile.LiveDetails     = new contract.LiveCred
            {
                LiveID = userEntity.Email
            };

            retProfile.FBAuthID    = userEntity.FBAuthID;
            retProfile.FBID        = userEntity.FBID;
            retProfile.FBGroupName = profileEntity.FBGroup;
            retProfile.FBGroupID   = profileEntity.FBGroupID;

            List <contract.Buddy> buddys = null;

            if (buddies != null && buddies.Count > 0)
            {
                buddys = new List <contract.Buddy>();
                foreach (model.Buddy bud in buddies)
                {
                    buddys.Add(new contract.Buddy
                    {
                        BuddyID = bud.BuddyID,
                        //RelProfileID = bud.ProfileID,
                        Name           = bud.BuddyName,
                        UserID         = bud.UserID,
                        Email          = bud.Email,
                        MobileNumber   = utility.Security.Decrypt(bud.MobileNumber),
                        IsPrimeBuddy   = bud.IsPrimeBuddy,
                        State          = (contract.BuddyState)(bud.State),
                        SubscribtionID = bud.SubscribtionId
                    });
                }
            }
            else
            {
                buddys = null;
            }
            retProfile.AscGroups     = groupsAsociated;
            retProfile.MyBuddies     = buddys;
            retProfile.LocateBuddies = LocateBuds;

            return(retProfile);
        }