public void DataBaseChangeUserData(ChangeDataProcedure user) { command = new MySqlCommand($"call zmien_imie('{user.Name}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_kod_pocztowy('{user.PostalCode}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_kraj_zamieszkania('{user.Country}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_miasto('{user.City}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_nazwisko('{user.Surname}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_numer_domu('{user.HouseNumber}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_numer_kontaktowy('{user.ContactNumber}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_numer_lokalu('{user.ApartmentNumber}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_plec('{user.Sex}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); command = new MySqlCommand($"call zmien_ulice('{user.Street}', {user.CurrentUser});", this.conection); adapter.InsertCommand = command; adapter.InsertCommand.ExecuteNonQuery(); command.Dispose(); }
private void ChangeUserData() { ChangeDataProcedure user = new ChangeDataProcedure(); 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; } 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 = signInUser.UserID; DbService.DataBaseChangeUserData(user); AlertWindow alertWindow2 = new AlertWindow("Zmiana danych przebiegła pomyślnie."); alertWindow2.ShowDialog(); CreateDaneOsobowe(); }
private void ChangeStudentData() { ChangeStudentDataProcedure changedFieldOfStudy = new ChangeStudentDataProcedure(); ChangeDataProcedure changedStudent = new ChangeDataProcedure(); FieldOfStudyCheckProcedure field = new FieldOfStudyCheckProcedure(); string errorMessage = ""; if (!DataValidation.DataValidation.ValidName(tableRowContentList[2].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidSurname(tableRowContentList[3].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidSex(tableRowContentList[5].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidContactNumber(tableRowContentList[6].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidCountry(tableRowContentList[7].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidCity(tableRowContentList[8].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidStreet(tableRowContentList[9].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidHouseNumber(tableRowContentList[10].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidApartmentNumber(tableRowContentList[11].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidPostalCode(tableRowContentList[12].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidStudyField(tableRowContentList[13].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidSemestr(tableRowContentList[14].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } if (!DataValidation.DataValidation.ValidDegree(tableRowContentList[15].Text, out errorMessage)) { AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } field.StudyField = tableRowContentList[13].Text; field.Semestr = int.Parse(tableRowContentList[14].Text); field.Degree = int.Parse(tableRowContentList[15].Text); if (!DbService.DataBaseCheckFieldOfStudy(field)) { errorMessage = "Nie istnieje kierunek lub nie ma takiego semestru na danym stopniu studiów."; AlertWindow alertWindow = new AlertWindow(errorMessage); alertWindow.ShowDialog(); return; } changedStudent.Name = tableRowContentList[2].Text; changedStudent.Surname = tableRowContentList[3].Text; changedStudent.Sex = tableRowContentList[5].Text; changedStudent.ContactNumber = tableRowContentList[6].Text; changedStudent.Country = tableRowContentList[7].Text; changedStudent.City = tableRowContentList[8].Text; changedStudent.Street = tableRowContentList[9].Text; changedStudent.HouseNumber = tableRowContentList[10].Text; changedStudent.ApartmentNumber = tableRowContentList[11].Text; changedStudent.PostalCode = tableRowContentList[12].Text; changedStudent.CurrentUser = choosenUserID; changedFieldOfStudy.StudentID = int.Parse(tableRowContentList[0].Text); changedFieldOfStudy.StudyField = tableRowContentList[13].Text; changedFieldOfStudy.Semestr = int.Parse(tableRowContentList[14].Text); changedFieldOfStudy.Degree = int.Parse(tableRowContentList[15].Text); changedFieldOfStudy.CurrentUser = signInUser.UserID; DbService.DataBaseChangeUserData(changedStudent); DbService.DataBaseChangeFieldOfStudyStudent(changedFieldOfStudy); AlertWindow alertWindow2 = new AlertWindow("Zmiana danych przebiegła pomyślnie."); alertWindow2.ShowDialog(); }
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(); }