Example #1
0
 private void BtnThanhtoan_Click(object sender, EventArgs e)
 {
     if (db.CheckGiohang() == 0)
     {
         MessageBox.Show("Bạn chưa thêm SP vào giỏ hàng!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         try
         {
             db.Taodonhang(db.getmakh(email), db.Tongtien(db.getmakh(email)), Convert.ToDateTime(lbNgaydat.Text), Convert.ToDateTime(lbNgaygiao.Text));
             MessageBox.Show("Đặt hàng thành công!", "Thông báo!");
             btnThanhtoan.Enabled = false;
             db.ResertGiohang();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }