private void ValidateLastName() { bool isValidLastName; tbLastName.BorderBrush = Brushes.Transparent; isValidLastName = ValidationData.ValidateNameComplete(tbLastName.Text); if (isValidLastName) { tbLastName.BorderBrush = Brushes.Green; playerEdit.LastName = ValidationData.DeleteSpaceWord(tbLastName.Text); } else { tbLastName.BorderBrush = Brushes.Red; isValidData = false; imgErrorLastName.Visibility = Visibility.Visible; } isUpdateData = true; }
private void RegisterPlayer(object sender, RoutedEventArgs routedEventArgs) { bool isValidData = ValidateDataPlaye(); if (isValidData) { string name = tbName.Text; string lastName = tbLastName.Text; string nickname = tbNickname.Text; string email = tbEmail.Text; string password = Security.Encrypt(pbPassword.Password); int codeConfirmation = ValidationData.GenerateConfirmationCode(); ServiceAccount account = new ServiceAccount(); account.PasswordAccount = password; account.Email = email; account.ConfirmationCode = codeConfirmation; ServicePlayer accountPlayer = new ServicePlayer(); accountPlayer.NickName = nickname; accountPlayer.NamePlayer = ValidationData.DeleteSpaceWord(name); accountPlayer.LastName = ValidationData.DeleteSpaceWord(lastName); accountPlayer.StatusPlayer = "Active"; accountPlayer.ScoreObtained = 0; try { InstanceContext instanceContext = new InstanceContext(this); PlayerManagerClient validatePlayer = new PlayerManagerClient(instanceContext); validatePlayer.SearchNicknamePlayer(nickname); bool isValidRepeatNickname = responseBoolean; validatePlayer.SearchEmailPlayer(email); bool isValidRepeatEmail = responseBoolean; if (isValidRepeatEmail && isValidRepeatNickname) { OpenMessageBox(Properties.Resources.RegisteredEmailNicknameMessage, Properties.Resources.RepeatedDataMessageTitle, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Warning); } else { if (isValidRepeatEmail) { OpenMessageBox(Properties.Resources.RegisteredEmailMessage, Properties.Resources.RepeatedDataMessageTitle, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Warning); } else { if (isValidRepeatNickname) { OpenMessageBox(Properties.Resources.RegisteredNicknameMessage, Properties.Resources.RepeatedDataMessageTitle, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Warning); } else { EmailConfirmation emailConfirmation = new EmailConfirmation(); emailConfirmation.AccountReceived(account); emailConfirmation.PlayerReceived(accountPlayer); emailConfirmation.SendConfirmationCodePlayer(); emailConfirmation.Show(); this.Close(); } } } } catch (EndpointNotFoundException exception) { TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); LogException.ErrorConnectionService(); } } else { OpenMessageBox(Properties.Resources.IncorrectDataMessage, Properties.Resources.IncorrectDataMessageTitle, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Warning); } }
private void ReportPlayer(object sender, RoutedEventArgs routedEventArgs) { ServiceReportMisConduct serviceReportMisConduct = new ServiceReportMisConduct(); serviceReportMisConduct.IdReportedPlayer = nicknameReported; serviceReportMisConduct.IdReportingPlayer = nickname; string dataContext = ValidationData.DeleteSpaceWord(tbContext.Text); if (dataContext.Length > Number.NumberValue(NumberValues.ZERO)) { serviceReportMisConduct.AdditionalContext = dataContext; } string typeReport = null; if (rbTypeOne.IsChecked == true) { typeReport = Properties.Resources.VerbalMotive; } else { if (rbTypeTwo.IsChecked == true) { typeReport = Properties.Resources.OffensiveMotive; } else { if (rbTypeThree.IsChecked == true) { typeReport = Properties.Resources.HateMotive; } } } if (!string.IsNullOrEmpty(typeReport)) { serviceReportMisConduct.TypeReport = typeReport; try { InstanceContext instanceContext = new InstanceContext(this); ReportPlayerClient reportPlayerClient = new ReportPlayerClient(instanceContext); reportPlayerClient.ReportPlayer(serviceReportMisConduct); if (isReportPlayer) { OpenMessageBox(Properties.Resources.ReportPlayerMessage, Properties.Resources.TitleRegisterReportMessage, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Information); } else { OpenMessageBox(Properties.Resources.ReportPlayerErrorMessage, Properties.Resources.TitleRegisterReportMessage, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Error); } Play.ReportPlayerReceived(isReportPlayer); this.Close(); } catch (EndpointNotFoundException exception) { TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); LogException.ErrorConnectionService(); } } else { OpenMessageBox(Properties.Resources.TypeReportErrorMessage, Properties.Resources.IncorrectDataMessageTitle, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Error); } }