示例#1
0
        // Them chi tiet hoa don
        private void button5_Click(object sender, EventArgs e)
        {
            string m, ms;
            int    sl, dg, tt;

            m  = cbbMaHD.Text.Trim();
            ms = cbbMaSP.Text.Trim();
            sl = int.Parse(txtSoLuong.Text);
            dg = int.Parse(txtDonGia.Text);
            thanhTien();
            tt = int.Parse(txtThanhTien.Text);
            DTOCTHoaDon cthd = new DTOCTHoaDon(m, ms, sl, dg, tt);

            try
            {
                int i = new BUSCTHoaDon().Add(cthd);
                loadLaiSanPham();
                dgvChiTietHoaDon.DataSource = GetCTHD();
                loadSanPham();
                load();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        private void btThemCTHD_Click(object sender, EventArgs e)
        {
            string m, ms;
            int    sl, dg;

            m  = cbbMaHD.Text.Trim();
            ms = cbbMaSP.Text.Trim();
            sl = int.Parse(txtSoLuong.Text);
            dg = int.Parse(txtGia.Text);
            DTOCTHoaDon cthd = new DTOCTHoaDon(m, ms, sl, dg);

            try
            {
                int i = new BUSCTHoaDon().Add(cthd);
                dgvCTHoaDon.DataSource = GetCTHD();
                load();
                xoaCTHD();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }