public void DataBaseChangeLoginPassword(ChangeLoginPasswordProcedure user) { command = new MySqlCommand($"call zmien_login_haslo({user.UserToChangeLoginPassword}, '{user.Login}', '{user.Password}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); }
private void ChangeOtherUserData() { ChangeDataProcedure user = new ChangeDataProcedure(); ChangeLoginPasswordProcedure loginPassword = new ChangeLoginPasswordProcedure(); string errorMessage = ""; if (!DataValidation.DataValidation.ValidName(tableRowContentList[1].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidSurname(tableRowContentList[2].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidSex(tableRowContentList[4].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidContactNumber(tableRowContentList[5].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidCountry(tableRowContentList[6].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidCity(tableRowContentList[7].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidStreet(tableRowContentList[8].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidHouseNumber(tableRowContentList[9].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidApartmentNumber(tableRowContentList[10].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidPostalCode(tableRowContentList[11].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidLogin(tableRowContentList[12].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidPassword(tableRowContentList[13].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidRole(tableRowContentList[14].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (DbService.DataBaseCheckLogin(tableRowContentList[12].Text)) { errorMessage = "Taki login już istnieje w bazie danych."; AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } user.Name = tableRowContentList[1].Text; user.Surname = tableRowContentList[2].Text; user.Sex = tableRowContentList[4].Text; user.ContactNumber = tableRowContentList[5].Text; user.Country = tableRowContentList[6].Text; user.City = tableRowContentList[7].Text; user.Street = tableRowContentList[8].Text; user.HouseNumber = tableRowContentList[9].Text; user.ApartmentNumber = tableRowContentList[10].Text; user.PostalCode = tableRowContentList[11].Text; user.CurrentUser = choosenUserID; loginPassword.UserToChangeLoginPassword = choosenUserID; loginPassword.Login = tableRowContentList[12].Text; loginPassword.Password = tableRowContentList[13].Text; loginPassword.CurrentUser = signInUser.UserID; DbService.DataBaseChangeUserData(user); DbService.DataBaseChangeLoginPassword(loginPassword); AlertWindow alertWindow2 = new AlertWindow("Zmiana danych przebiegła pomyślnie."); alertWindow2.ShowDialog(); CreateUzytkownicyLista(); }