public MembershipServiceRef.Profile GetNewProfileObject(string userName, string liveId, string countryCode, string mobileNumber, string securityCode, string enterpriseEmail, string enterpriseSecurityToken, string AccessToken, string RefreshToken) { var profile = new MembershipServiceRef.Profile(); //profile.LiveDetails = new MembershipServiceRef.LiveCred() { LiveAccessToken = AccessToken, LiveRefreshToken = RefreshToken }; profile.Email = liveId; profile.Name = userName; profile.RegionCode = countryCode; profile.MobileNumber = countryCode + mobileNumber; profile.SecurityToken = securityCode; if (Config.IsEnterpriseBuild) { profile.EnterpriseEmailID = enterpriseEmail; profile.EnterpriseSecurityToken = enterpriseSecurityToken; } profile.CanMail = true; profile.CanSMS = true; profile.CanPost = false; profile.LocationConsent = true; profile.NotificationUri = Globals.CurrentProfile.NotificationUri; profile.MyBuddies = App.MyBuddies.GetAllCurrentProfileBuddies(); return(profile); }
public ProfileTableEntity ConvertProfile(MembershipServiceRef.Profile profile) { var outProfile = new ProfileTableEntity(); outProfile.ProfileId = profile.ProfileID.ToString(); outProfile.CountryCode = profile.RegionCode; outProfile.MobileNumber = profile.MobileNumber; outProfile.FBGroupName = profile.FBGroupName; outProfile.FBGroupId = profile.FBGroupID; outProfile.CanEmail = profile.CanMail; outProfile.CanSMS = profile.CanSMS; outProfile.CanFBPost = profile.CanPost; //newProfile.CanArchiveEvidence = profile.CanArchive; //TODO //outProfile.ArchiveFolder = profile.LiveDetails != null ? profile.LiveDetails.ArchivalFolder : string.Empty; outProfile.CountryCode = profile.RegionCode; outProfile.LocationConsent = profile.LocationConsent; outProfile.PostLocationConsent = Globals.CurrentProfile.PostLocationConsent; outProfile.IsTrackingStatusSynced = Globals.CurrentProfile.IsTrackingStatusSynced; outProfile.IsSOSStatusSynced = Globals.CurrentProfile.IsSOSStatusSynced; outProfile.MapView = Globals.CurrentProfile.MapView; outProfile.LastSynced = DateTime.Now; outProfile.IsDataSynced = true;//TODO - Check return(outProfile); }
public MembershipServiceRef.Profile ConvertProfile(ProfileTableEntity profile) { var outProfile = new MembershipServiceRef.Profile(); outProfile.ProfileID = Convert.ToInt64(profile.ProfileId); outProfile.FBGroupName = profile.FBGroupName; outProfile.FBGroupID = profile.FBGroupId; outProfile.RegionCode = profile.CountryCode; outProfile.MobileNumber = profile.MobileNumber; outProfile.CanMail = profile.CanEmail; outProfile.CanSMS = profile.CanSMS; outProfile.CanPost = profile.CanFBPost; outProfile.NotificationUri = profile.NotificationUri; //outProfile.CanArchive = profile.CanArchiveEvidence; //TODO String -> bool //outProfile.ArchiveFolder = profile.ArchivalFolder; outProfile.LocationConsent = profile.LocationConsent; return(outProfile); }
public MembershipServiceRef.Profile ConvertUser(UserTableEntity user) { MembershipServiceRef.Profile profile = new MembershipServiceRef.Profile(); profile.UserID = Convert.ToInt64(user.UserId); profile.Name = user.Name; profile.Email = user.LiveEmail; profile.LiveDetails = new MembershipServiceRef.LiveCred(); profile.FBAuthID = user.FBAuthId; return(profile); }
public UserTableEntity ConvertUser(MembershipServiceRef.Profile profile) { UserTableEntity user = new UserTableEntity(); user.UserId = profile.UserID.ToString(); user.Name = profile.Name; user.LiveEmail = profile.Email; user.LiveAuthId = Globals.User.LiveAuthId; user.FBAuthId = profile.FBAuthID; user.CurrentProfileId = profile.ProfileID.ToString(); return(user); }
public void SyncFullProfileServer2Local(MembershipServiceRef.Profile serverProfile) { string currentProfileId = Globals.User.CurrentProfileId; // For new Profile, Globals.User.CurrentProfileId will be 0 this.SyncUserServer2Local(serverProfile); App.MyProfiles.SyncProfileServer2Local(currentProfileId, serverProfile); App.MyBuddies.SyncBuddiesServer2Local(currentProfileId, serverProfile.MyBuddies); App.MyGroups.SyncGroupsServer2Local(currentProfileId, serverProfile.AscGroups); App.MyProfiles.UpdateIsDataSynced(true); App.MyBuddies.CleanBuddies(); App.MyGroups.CleanGroups(); }
public void SyncProfileServer2Local(string profileId, MembershipServiceRef.Profile serverProfile) { UpdateProfile(profileId, ConvertProfile(serverProfile)); var localProfile = (from ProfileTableEntity p in _dataContext.MyProfilesTable where p.ProfileId == serverProfile.ProfileID.ToString() select p).FirstOrDefault <ProfileTableEntity>(); if (localProfile != null) { localProfile.LastSynced = DateTime.Now; _dataContext.SubmitChanges(); } }
public async Task <string> UpdateUserLocal2Server(bool IsMobileNumberEdit = false, string NewMobileNumber = "", string NewSecurityToken = "") { IsSuccess = true; Message = string.Empty; this.IsInProgress = true; string result = "SUCCESS"; try { MembershipServiceRef.Profile profObjectToBeSynced = App.MyProfiles.ConvertProfile(App.MyProfiles.CurrentProfile); profObjectToBeSynced.Name = Globals.User.Name; profObjectToBeSynced.UserID = Convert.ToInt64(Globals.User.UserId); profObjectToBeSynced.Email = Globals.User.LiveEmail; profObjectToBeSynced.FBAuthID = Globals.User.FBAuthId; profObjectToBeSynced.LiveDetails = new MembershipServiceRef.LiveCred(); profObjectToBeSynced.MyBuddies = App.MyBuddies.GetAllCurrentProfileBuddies(); profObjectToBeSynced.AscGroups = App.MyGroups.GetAllCurrentProfileGroups(); MembershipServiceRef.Profile serverProfile = null; if (IsMobileNumberEdit && NewMobileNumber != string.Empty && NewSecurityToken != String.Empty) { profObjectToBeSynced.MobileNumber = NewMobileNumber; profObjectToBeSynced.SecurityToken = NewSecurityToken; profObjectToBeSynced.RegionCode = Constants.CountryCode; serverProfile = await MembershipServiceWrapper.UpdateProfilePhone(profObjectToBeSynced); } else { serverProfile = await MembershipServiceWrapper.UpdateProfile(profObjectToBeSynced); } if (!ResultInterpreter.IsError(serverProfile.DataInfo)) { this.SyncFullProfileServer2Local(serverProfile); } else { result = "ERROR"; if (ResultInterpreter.IsError(serverProfile.DataInfo, "PROFILENOTFOUND")) { result = "PROFILENOTFOUND"; } else if (ResultInterpreter.IsError(serverProfile.DataInfo, "The Profile is invalid.")) { result = "INVALIDPROFILE"; } else if (ResultInterpreter.IsError(serverProfile.DataInfo, "Invalid Security Token")) { result = "INCORRECTSECURITYCODE"; } } this.IsInProgress = false; this.IsDataLoaded = true; } catch (Exception ex) { result = "ERROR"; IsSuccess = false; Message = ex.Message; } return(result); }
private void SyncUserServer2Local(MembershipServiceRef.Profile profile) { UpdateUser(ConvertUser(profile)); }
public void AddProfile(MembershipServiceRef.Profile newProfile) { AddProfile(ConvertProfile(newProfile)); }