public void bringAdv(object sender, EventArgs e) { List <string> adv = Advertisment.getAdv(aID); Aname_create_pnl4_txt.Text = adv[1]; type_create_pnl4_ddl.Text = adv[2]; for (int i = 0; i < type_create_pnl4_ddl.Items.Count; i++) { if (type_create_pnl4_ddl.Items[i].ToString() == adv[2]) { type_create_pnl4_ddl.SelectedIndex = i; } } if (adv[2] == "Lending") { recieve_create_pnl4_lbl.Text = "Price"; } else if (adv[2] == "Donation") { recieve_create_pnl4_lbl.Text = "Deposit"; } else { recieve_create_pnl4_lbl.Text = "Items"; } recieve_create_pnl4_txt.Text = adv[3]; from_create_pnl4_txt.Text = adv[4]; to_create_pnl4_txt.Text = adv[5]; if (adv[6] == "1") { allow_create_pnl4_chk.Checked = true; } else { allow_create_pnl4_chk.Checked = false; } for (int i = 0; i < policy_create_pnl4_ddl.Items.Count; i++) { if (policy_create_pnl4_ddl.Items[i].ToString() == adv[7]) { policy_create_pnl4_ddl.SelectedIndex = i; } } pID = Products.itemsPerAdv(aID); index = 0; bringProduct(sender, e); }
private void view_my_pnl5_btn_Click(object sender, EventArgs e) { if (list_my_pnl5_lv.SelectedItems.Count == 0) { return; } int index = 0; for (int i = 0; i < list_my_pnl5_lv.Items.Count; i++) { if (list_my_pnl5_lv.Items[i].Selected) { index = i; } } Form1 f1 = new Form1(); f1.Text = "View Package"; f1.Controls.Clear(); f1.BackColor = Color.FromArgb(26, 32, 40); f1.StartPosition = FormStartPosition.CenterScreen; f1.FormBorderStyle = FormBorderStyle.FixedDialog; f1.AutoScroll = true; f1.Show(); f1.Size = new Size(888, 400); f1.Visible = true; Label adv_show_lbl = new Label(); adv_show_lbl.Font = new Font("Century Gothic", 8); adv_show_lbl.ForeColor = Color.White; adv_show_lbl.Location = new Point(12, 21); adv_show_lbl.Size = new Size(300, 400); f1.Controls.Add(adv_show_lbl); Label items_show_lbl = new Label(); items_show_lbl.Font = new Font("Century Gothic", 8); items_show_lbl.ForeColor = Color.White; items_show_lbl.Location = new Point(385, 21); items_show_lbl.Size = new Size(430, 400); f1.Controls.Add(items_show_lbl); List <string> adv = Advertisment.getAdv(Convert.ToInt32(list_my_pnl5_lv.Items[index].SubItems[4].Text)); adv_show_lbl.Text = "Name: " + adv[1] + "\n\n"; adv_show_lbl.Text += "Publish Date: " + adv[0] + "\n\n"; adv_show_lbl.Text += "Type: " + adv[2] + "\n\n"; if (adv[2] == "Lending") { adv_show_lbl.Text += "Price: " + adv[3] + "\n\n"; } else if (adv[2] == "Donation") { adv_show_lbl.Text += "Deposit: " + adv[3] + "\n\n"; } else { adv_show_lbl.Text += "Items: " + adv[3] + "\n\n"; } adv_show_lbl.Text += "From: " + adv[4] + " - "; adv_show_lbl.Text += adv[5] + "\n\n"; if (adv[6] == "1") { adv_show_lbl.Text += "Canceling allowed \n\n"; } else { adv_show_lbl.Text += "Canceling not allowed \n\n"; } adv_show_lbl.Text += "Confirmation policy: " + adv[7] + "\n\n"; items_show_lbl.Text = ""; List <int> items = Products.itemsPerAdv(Convert.ToInt32(list_my_pnl5_lv.Items[index].SubItems[4].Text)); for (int i = 0; i < items.Count; i++) { List <string> item = Products.getProduct(items[i]); int num = i + 1; items_show_lbl.Text += "Product" + num + ": Name: " + item[0] + ", Category: " + item[1] + ", Sub-Category: " + item[2]; List <string> fields = Products.getfields(item[1]); string[] values = item[3].Split('^'); for (int j = 0; j < fields.Count; j++) { if (values[j] != "") { items_show_lbl.Text += ", " + fields[j] + ": " + values[j]; } } items_show_lbl.Text += "\n\n"; } }