/// <summary> /// To the azure model. /// </summary> /// <param name="user">The user.</param> /// <returns>UserAzure.</returns> public static UserAzure ToAzureModel(this User user) { var azureModel = new UserAzure(); user.CopyTo(azureModel); azureModel.CompletedMissionIdsString = user.CompletedMissionIds.JoinToString(); azureModel.FailedMissionIdsString = user.FailedMissionIds.JoinToString(); azureModel.SetActiveMissions(user.ActiveMissionIds); azureModel.Sex = (int?)user.Sex; azureModel.KindScale = user.KindScale; azureModel.Level = user.Level; azureModel.LevelPoints = user.LevelPoints; azureModel.HomeCoordinate = user.HomeCoordinate.ConvertToAzureCoordinate(); azureModel.BaseEastCoordinate = user.BaseEastCoordinate.ConvertToAzureCoordinate(); azureModel.BaseNorthCoordinate = user.BaseNorthCoordinate.ConvertToAzureCoordinate(); azureModel.BaseSouthCoordinate = user.BaseSouthCoordinate.ConvertToAzureCoordinate(); azureModel.BaseWestCoordinate = user.BaseWestCoordinate.ConvertToAzureCoordinate(); azureModel.RadarCoordinate = user.RadarCoordinate.ConvertToAzureCoordinate(); azureModel.OutpostCoordinate = user.OutpostCoordinate.ConvertToAzureCoordinate(); azureModel.SetMissionSets(user.MissionSetIds); azureModel.ActiveMissionSetIdsString = user.ActiveMissionSetIds.JoinToString(); azureModel.CompletedMissionSetIdsString = user.CompletedMissionSetIds.JoinToString(); azureModel.BoughtHintIdsString = user.BoughtHintIds.JoinToString(); azureModel.CoinsCount = user.CoinsCount; return(azureModel); }
/// <summary> /// Froms the azure model. /// </summary> /// <param name="azureModel">The azure model.</param> /// <returns>User.</returns> public static User FromAzureModel(this UserAzure azureModel) { if (azureModel == null) { return(null); } var domainModel = new User(); azureModel.CopyTo(domainModel); domainModel.CompletedMissionIds = azureModel.CompletedMissionIdsString.SplitStringByDelimiter(); domainModel.FailedMissionIds = azureModel.FailedMissionIdsString.SplitStringByDelimiter(); domainModel.ActiveMissionIds = azureModel.GetActiveMissions(); domainModel.MissionSetIds = azureModel.GetMissionSets(); domainModel.ActiveMissionSetIds = azureModel.ActiveMissionSetIdsString.SplitStringByDelimiter(); domainModel.CompletedMissionSetIds = azureModel.CompletedMissionSetIdsString.SplitStringByDelimiter(); domainModel.BoughtHintIds = azureModel.BoughtHintIdsString.SplitStringByDelimiter(); domainModel.Sex = (Sex?)azureModel.Sex; domainModel.KindScale = (byte?)azureModel.KindScale; domainModel.Level = (byte?)azureModel.Level; domainModel.LevelPoints = (ushort?)azureModel.LevelPoints; domainModel.HomeCoordinate = azureModel.HomeCoordinate.ConvertToGeoCoordinate(); domainModel.BaseEastCoordinate = azureModel.BaseEastCoordinate.ConvertToGeoCoordinate(); domainModel.BaseNorthCoordinate = azureModel.BaseNorthCoordinate.ConvertToGeoCoordinate(); domainModel.BaseSouthCoordinate = azureModel.BaseSouthCoordinate.ConvertToGeoCoordinate(); domainModel.BaseWestCoordinate = azureModel.BaseWestCoordinate.ConvertToGeoCoordinate(); domainModel.RadarCoordinate = azureModel.RadarCoordinate.ConvertToGeoCoordinate(); domainModel.OutpostCoordinate = azureModel.OutpostCoordinate.ConvertToGeoCoordinate(); domainModel.CoinsCount = azureModel.CoinsCount; return(domainModel); }
private async void LogIn_Clicked(object sender, EventArgs e) { try { var azure = new UserAzure(); var users = await azure.GetUsers(); var userr = new User(); //bool Success = true; foreach (var user in users) { if (user.Email == emailEntry.Text && user.Password == passwordEntry.Text) { await DisplayAlert("Registration", "Successfully logged in!", "OK"); //Success = true; OnThresholdReached(EventArgs.Empty); } } emailEntry.Text = String.Empty; passwordEntry.Text = String.Empty; //Success = false; await DisplayAlert("Registration", "Logging in unsuccessfull!", "OK"); } catch (Exception ex) { Debug.WriteLine("Wyjatek przy logowaniu: " + ex); } }
private List <UserAzure> GeneratePersonQualityLinks(User user) { if (user.PersonQualitiesWithScores == null) { return(new List <UserAzure>()); } return (user.PersonQualitiesWithScores.Where(t => !string.IsNullOrEmpty(t.PersonQualityId)) .GroupBy(p => p.PersonQualityId) .Select( t => UserAzure.CreateLinkToPersonQuality(user.Id, t.First().PersonQualityId, t.First().Score)) .ToList()); }
async private void Button_Clicked(object sender, EventArgs e) { bool Success = true; var azure = new UserAzure(); var users = azure.GetUsers(); var userr = new User(); foreach (var user in users.Result) { if (user.UserName == usernameEntry.Text) { await DisplayAlert("Registration", "Username is already in use!", "OK"); usernameEntry.Text = String.Empty; Success = false; break; } if (user.Email == emailEntry.Text) { await DisplayAlert("Registration", "E-mail is already in use!", "OK"); emailEntry.Text = String.Empty; Success = false; break; } } if (passwordEntry != password2Entry) { await DisplayAlert("Regitration", "Passwords don't match!", "OK"); passwordEntry.Text = String.Empty; password2Entry.Text = String.Empty; Success = false; } if (Success == true) { userr.Email = emailEntry.Text; userr.Password = passwordEntry.Text; userr.UserName = usernameEntry.Text; await azure.AddUser(userr); await DisplayAlert("Registration", "Registration completed successfully!", "OK"); OnThresholdReached(EventArgs.Empty); } }
public UserViewModel() { azureServices = DependencyService.Get <UserAzure>(); Users = new ObservableCollection <User>(); LoadUsersCommand = new Command(async() => await ExecuteLoadUsersCommand()); }