/// <summary> /// when the user wants to log out /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bttnlogout_Click(object sender, EventArgs e) { Program.NotifyObserver(this.Name, ((Button)sender).Name); try { VeritabaniIslemleri database = VeritabaniIslemleri.bagOlustur("SatisVeritabani"); string query = ""; for (int i = 0; i < shoppingCard.items.Count; i++) { query = "insert into SepetTablosu (customerId,urunId,siparisId,urunAdedi ) values(" + user.UserID + "," + shoppingCard.items.ElementAt(i).Value.product.Id + " ,'none' ," + shoppingCard.items.ElementAt(i).Value.quantity + " )"; database.veriKaydet(query); } } catch { } user = null; pnlUserNameClicked.Visible = false; bttnUserName.Text = "Sign In"; shoppingCard.cancelOrder(); btnAdminPaneli.Visible = false; this.MainForm_Activated(this, new EventArgs()); }
/// <summary> /// it delete all things in shopping card /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bttnCancelOrder_Click(object sender, EventArgs e) { Program.NotifyObserver(this.Name, ((Button)sender).Name); shoppingCard.cancelOrder(); MessageBox.Show("Your Card is empty"); }