Example #1
0
 private void Btn_Click(object sender, EventArgs e)
 {
     Guna.UI.WinForms.GunaButton btn = sender as Guna.UI.WinForms.GunaButton;
     if (UserName != "")
     {
         string UserName  = this.UserName;
         string ItemName  = btn.Text;
         float  SalePrice = float.Parse(HomeController.PriceItem(ItemName).Tables[0].Rows[0][0].ToString());
         float  Quantity  = 1;
         bool   check     = OrderItemsController.AddCart(UserName, PassWord, ItemName, SalePrice, Quantity, ref err);
         if (check == true)
         {
             MessageBox.Show("Bạn đã thêm " + ItemName + " vào giỏ hàng thành công");
             this.lblShowCart.Text = OrderItemsController.ShowTotalDetails(UserName, PassWord).Tables[0].Rows[0][0].ToString();
         }
         else
         {
             MessageBox.Show("Bạn đã thêm món ăn vào giỏ hàng thất bại");
         }
     }
     else
     {
         DialogResult dialogResult;
         dialogResult = MessageBox.Show("Mời bạn đăng nhập để sử dụng tính năng này", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
         if (dialogResult == DialogResult.OK)
         {
             this.Hide();
             frmSignIn frmSign = new frmSignIn();
             frmSign.ShowDialog();
             this.Close();
         }
     }
 }