private void showAdButton_Click(object sender, EventArgs e) { showAdPanel.Visible = true; string id; if (listViewHomePage.SelectedItems.Count > 0) { id = listViewHomePage.SelectedItems[0].SubItems[0].Text; } else { MessageBox.Show("Choose an ad."); return; } showAdPanel.Visible = true; AdHandler handler = new AdHandler(); Product product = handler.getSelectedAd(id); titleTextBox.Text = product.Title; descriptionTextBox.Text = product.Desc; priceTextBox.Text = product.Price; typeTextBox.Text = product.Type; categoryTextBox.Text = Database.getCategoryNameById(Convert.ToInt32(product.CategoryId)); dateTextBox.Text = product.Date; ownerTextBox.Text = product.Owner.Username; phoneTextBox.Text = product.Owner.Phone.ToString(); emailTextBox.Text = product.Owner.Email; if (Arxikh.user != null) { handler.addToViewHistoryIfDoesntExist(product); } }