Exemplo n.º 1
0
        private void add_create_pnl4_btn_Click(object sender, EventArgs e)
        {
            //validation
            string valid = Advertisment.validation(Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text);

            if (valid != "")
            {
                MessageBox.Show(valid);
                return;
            }
            if (items.Count == 0)
            {
                MessageBox.Show("must add at least 1 item");
                return;
            }


            int allow = 0;

            if (allow_create_pnl4_chk.Checked)
            {
                allow = 1;
            }
            int advNum = Advertisment.add(username, DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year, Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text, allow, policy_create_pnl4_ddl.Items[policy_create_pnl4_ddl.SelectedIndex].ToString());

            for (int i = 0; i < items.Count; i = i + 4)
            {
                Products.add(advNum, items[i], items[i + 1], items[i + 2], items[i + 3], null);
            }
            items.Clear();
            MessageBox.Show("success");

            clearAdv();
        }
Exemplo n.º 2
0
        private void my_adv_bar_btn_Click(object sender, EventArgs e)
        {
            panel6_pnl.Visible = false;
            panel5_pnl.Visible = true;
            panel3_pnl.Visible = false;
            panel4_pnl.Visible = false;

            Advertisment.allAdv(list_my_pnl5_lv, username);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        private void Aupdate_pnl4_btn_Click(object sender, EventArgs e)
        {
            string valid = Advertisment.validation(Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text);

            if (aID == -1)
            {
                return;
            }
            if (valid != "")
            {
                MessageBox.Show(valid);
                return;
            }

            int allow = 0;

            if (allow_create_pnl4_chk.Checked)
            {
                allow = 1;
            }
            Advertisment.update(aID, DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year, Aname_create_pnl4_txt.Text, type_create_pnl4_ddl.Items[type_create_pnl4_ddl.SelectedIndex].ToString(), recieve_create_pnl4_txt.Text, from_create_pnl4_txt.Text, to_create_pnl4_txt.Text, allow, policy_create_pnl4_ddl.Items[policy_create_pnl4_ddl.SelectedIndex].ToString());
            MessageBox.Show("success");
        }
Exemplo n.º 5
0
        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";
            }
        }