コード例 #1
0
        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);
            }
        }
コード例 #2
0
        private void listViewHomePage_SelectedIndexChanged(object sender, EventArgs e)
        {
            // string id = null;

            if (listViewHomePage.SelectedItems.Count > 0)
            {
                id = listViewHomePage.SelectedItems[0].SubItems[0].Text;
            }
            else
            {
                return;
            }

            AdHandler handler = new AdHandler();
            Product   product = handler.getSelectedAd(id);

            if (Arxikh.user != null && (product.Owner.Id == Arxikh.user.Id))
            {
                editAd.Visible = true;
                selectedId     = id;
            }
            else
            {
                editAd.Visible = false;
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string id = null;

            if (listViewHistoryPage.SelectedItems.Count > 0)
            {
                id = listViewHistoryPage.SelectedItems[0].SubItems[0].Text;
            }
            else
            {
                MessageBox.Show("Choose an ad.");
                return;
            }

            AdHandler handler = new AdHandler();
            Product   product = handler.getSelectedAd(id);

            Database.removeEntryFromViewHistroy(product);
            refreshViewHistory();
        }