Beispiel #1
0
        private void pctrbxAddToBasket_Click(object sender, EventArgs e)
        {
            Program.NotifyObserver(this.Name, ((PictureBox)sender).Name);
            AddedBasketForm form;

            shoppingCard.addProduct(new ItemToPurchase(this.magazine, 1));
            form = new AddedBasketForm(magazine);
            form.Show();
        }
Beispiel #2
0
        /// <summary>
        /// it adds the product to shopping card
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pctrbxAddToBasket_Click(object sender, EventArgs e)
        {
            Program.NotifyObserver(this.Name, ((PictureBox)sender).Name);
            AddedBasketForm form;

            shoppingCard.addProduct(new ItemToPurchase(this.musicCD, Convert.ToInt32(nudquantity.Value)));
            form = new AddedBasketForm(musicCD);
            form.Show();
        }
Beispiel #3
0
 /// <summary>
 /// when this button clicked,
 /// if user == null the login page appear
 /// else the pnlUserNameClicked appear or vice versa
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bttnUserName_Click(object sender, EventArgs e)
 {
     Program.NotifyObserver(this.Name, ((Button)sender).Name);
     if (user == null)
     {
         LoginForm    login  = new LoginForm();
         DialogResult result = login.ShowDialog();
         if (result == DialogResult.Yes)
         {
             bttnUserName.Text = user.Name;
             VeritabaniIslemleri database = VeritabaniIslemleri.bagOlustur("SatisVeritabani");
             string    query = "select * from SepetTablosu where customerId = " + user.UserID + " and siparisId = 'none'";
             DataTable table = database.veriCek(query);
             foreach (DataRow item in table.Rows)
             {
                 query = "select * from UrunlerTablosu where productId = '" + item[1].ToString() + "'";
                 DataTable tablee = database.veriCek(query);
                 shoppingCard.addProduct(new ItemToPurchase(addNewProductFromDatabase.CreateNewItem(tablee.Rows[0]), Convert.ToInt32(item[3])));
             }
             query = "delete from SepetTablosu where customerId = " + user.UserID + " and siparisId = 'none'";
             database.veriKaydet(query);
             query = "delete from ShoppingCartTable where CustomerId = " + user.UserID + " and siparisId = 'none'";
             database.veriKaydet(query);
         }
     }
     else
     {
         if (pnlUserNameClicked.Visible == false)
         {
             pnlUserNameClicked.Visible = true;
         }
         else
         {
             pnlUserNameClicked.Visible = false;
         }
     }
     this.MainForm_Activated(this, new EventArgs());
 }