public UserPreviewDataView DataBaseShowUserPreview(int userID) { command = new MySqlCommand($"CALL wyswietl_dane_uzytkownika_podglad('{userID}')", this.conection); reader = command.ExecuteReader(); UserPreviewDataView userPreviewData = new UserPreviewDataView(); if (reader.HasRows) { while (reader.Read()) { userPreviewData.Pesel = reader.GetValue(0).ToString(); userPreviewData.Name = reader.GetValue(1).ToString(); userPreviewData.Surname = reader.GetValue(2).ToString(); userPreviewData.DateOfBirth = DateTime.Parse(reader.GetValue(3).ToString()); userPreviewData.Sex = char.Parse(reader.GetValue(4).ToString()); userPreviewData.ContactNumber = reader.GetValue(5).ToString(); userPreviewData.Country = reader.GetValue(6).ToString(); userPreviewData.City = reader.GetValue(7).ToString(); userPreviewData.Street = reader.GetValue(8).ToString(); userPreviewData.HouseNumber = reader.GetValue(9).ToString(); userPreviewData.ApartmentNumber = reader.GetValue(10).ToString(); userPreviewData.PostalCode = reader.GetValue(11).ToString(); userPreviewData.Login = reader.GetValue(12).ToString(); userPreviewData.Password = reader.GetValue(13).ToString(); userPreviewData.Role = char.Parse(reader.GetValue(14).ToString()); } } reader.Close(); return(userPreviewData); }
private void ShowChoosenUserData() { userPreviewData = DbService.DataBaseShowUserPreview(choosenUserID); tableRowContentList[0].Text = userPreviewData.Pesel; tableRowContentList[1].Text = userPreviewData.Name; tableRowContentList[2].Text = userPreviewData.Surname; tableRowContentList[3].Text = userPreviewData.DateOfBirth.ToString("MM/dd/yyyy"); tableRowContentList[4].Text = userPreviewData.Sex.ToString(); tableRowContentList[5].Text = userPreviewData.ContactNumber; tableRowContentList[6].Text = userPreviewData.Country; tableRowContentList[7].Text = userPreviewData.City; tableRowContentList[8].Text = userPreviewData.Street; tableRowContentList[9].Text = userPreviewData.HouseNumber; tableRowContentList[10].Text = userPreviewData.ApartmentNumber; tableRowContentList[11].Text = userPreviewData.PostalCode; tableRowContentList[12].Text = userPreviewData.Login; tableRowContentList[13].Text = userPreviewData.Password; tableRowContentList[14].Text = userPreviewData.Role.ToString(); }