private void btnDangNhap_Click(object sender, EventArgs e)
 {
     try
     {
         int soluong = int.Parse(txtSoLuong.Text);
         hd.CapNhatSL(ma, manuoc, soluong);
         this.Close();
     }
     catch
     {
         MessageBox.Show("Lỗi");
     }
 }
Beispiel #2
0
        private void btnDM_Click(object sender, EventArgs e)
        {
            Button  btnDM  = sender as Button;
            TextBox txt    = sender as TextBox;
            string  MaNuoc = ((sender as Button).Tag as NUOC).MANUOC;

            if (hd.KTraNuocTonTai(ma, MaNuoc) == true)
            {
                hd.ThemNuocVaoHD(ma, MaNuoc, 1, nuoc.GetDonGiaNuoc(MaNuoc));
                dgvCTHD.DataSource = hd.GetCTHD(ma);
                txtTongTien.Text   = hd.TinhTong(ma).ToString();
            }
            else
            {
                int sl = hd.GetSL(ma, MaNuoc) + 1;
                hd.CapNhatSL(ma, MaNuoc, sl);
                dgvCTHD.DataSource = hd.GetCTHD(ma);
                txtTongTien.Text   = hd.TinhTong(ma).ToString();
            }
        }