Exemplo n.º 1
0
 public void Remove(CarOption pItem)
 {
     packages.Remove(pItem);
     count = packages.Count;
     count--;
 }
Exemplo n.º 2
0
 public void Add(CarOption pItem)
 {
     packages.Add(pItem);
        count = packages.Count;
        count++;
 }
Exemplo n.º 3
0
        protected void gvPackages_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (gvPackages.SelectedRow == gvPackages.Rows[0])
            {

                Button poop = (Button)gvPackages.SelectedRow.Cells[0].Controls[0];
                if (poop.Text == "Add")
                {
                    CarOption p = new CarOption(gvPackages.SelectedRow.Cells[1].Text, float.Parse(gvPackages.SelectedRow.Cells[2].Text));
                    p.PackPrice = float.Parse(gvPackages.SelectedRow.Cells[2].Text);
                    p.ID = int.Parse(gvPackages.SelectedRow.Cells[3].Text);
                    selectedPackages.Add(p);
                    poop.Text = "Undo";
                    string sqlQuery = "INSERT INTO SelectedPackages VALUES(" + 1 + ", '" + p.PackDesc + "', '" + p.PackPrice + "')";
                    myConnect.DoUpdate(sqlQuery);
                }
                else if (poop.Text == "Undo")
                {

                    CarOption p = new CarOption(gvPackages.SelectedRow.Cells[1].Text, float.Parse(gvPackages.SelectedRow.Cells[2].Text));
                    selectedPackages.Remove(p);
                    poop.Text = "Add";
                }

            }

            else if (gvPackages.SelectedRow == gvPackages.Rows[1])
            {
                Button poop = (Button)gvPackages.SelectedRow.Cells[0].Controls[0];
                if (poop.Text == "Add")
                {

                    CarOption p = new CarOption(gvPackages.SelectedRow.Cells[1].Text, float.Parse(gvPackages.SelectedRow.Cells[2].Text));

                    p.ID = 2;

                 p.PackPrice = float.Parse(gvPackages.SelectedRow.Cells[2].Text);

                 string sqlQuery = "INSERT INTO SelectedPackages VALUES(" + 2 + ", '" + p.PackDesc + "', '" + p.PackPrice + "')";

                    poop.Text = "Undo";
                }
                else if (poop.Text == "Undo")
                {
                    CarOption p = new CarOption(gvPackages.SelectedRow.Cells[1].Text, float.Parse(gvPackages.SelectedRow.Cells[2].Text));
                    selectedPackages.Remove(p);

                    poop.Text = "Add";
                }

            }

            else
            {
                Button poop = (Button)gvPackages.SelectedRow.Cells[0].Controls[0];
                if (poop.Text == "Add")
                {
                    CarOption p = new CarOption(gvPackages.SelectedRow.Cells[1].Text, float.Parse(gvPackages.SelectedRow.Cells[2].Text));
                    p.ID = int.Parse(gvPackages.SelectedRow.Cells[3].Text);
                    selectedPackages.Add(p);
                    hfSelectedPackages.Value += p.ID;
                    p.PackPrice = float.Parse(gvPackages.SelectedRow.Cells[2].Text);
                    p.ID = int.Parse(gvPackages.SelectedRow.Cells[3].Text);
                    string sqlQuery = "INSERT INTO SelectedPackages VALUES(" + 3 + ", '" + p.PackDesc + "', '" + p.PackPrice + "')";
                    myConnect.DoUpdate(sqlQuery);

                    poop.Text = "Undo";
                }
                else if (poop.Text == "Undo")
                {
                    CarOption p = new CarOption(gvPackages.SelectedRow.Cells[1].Text, float.Parse(gvPackages.SelectedRow.Cells[2].Text));
                    selectedPackages.Remove(p);

                    poop.Text = "Add";
                }
            }
        }