protected void btnLuu_Click(object sender, EventArgs e)
        {
            DTOCongNoBanHang dto = new DTOCongNoBanHang();

            dto.MaDH      = lbMaDH.Text;
            dto.MaKH      = int.Parse(lbMaKH.Text);
            dto.MaNV      = int.Parse(txtMaNV.Text);
            dto.NgayTraNo = Convert.ToDateTime(lbNgayTra.Text);
            dto.TienTT    = int.Parse(txtTienTT.Text);

            DAO_Entity dao = new DAO_Entity();

            dao.ThemCongNoBH(dto);

            DTODonDatHang dtodh = new DTODonDatHang();

            dtodh.MaDH = lbMaDH.Text;
            int tong = int.Parse(lbTienTra.Text);
            int no   = int.Parse(txtTienTT.Text);

            dtodh.CongNoDH = tong - no;
            dao.CapNhatCongNo(dtodh);

            if (dtodh.CongNoDH == 0)
            {
                dao.CapNhatTrangThaisauThanhToan(dtodh);
            }

            Response.Redirect("~/QLBoPhan_ThanhPham/QuanLyQuanNo_BH/DanhSachCongNo_BH.aspx");
        }
        protected void btbLuu_Click(object sender, EventArgs e)
        {
            DTOThanhToan dtocn = new DTOThanhToan();

            dtocn.MaDH          = txtMaDH.Text;
            dtocn.MaNV          = int.Parse(txtNhanVien.Text);
            dtocn.NgayThanhToan = Convert.ToDateTime(txtNgayThanhToan.Text);
            dtocn.Sotien        = int.Parse(txtDatCoc.Text);
            dtocn.HanTT         = Convert.ToDateTime(txtHanTT.Text);



            DAO_Entity daokh = new DAO_Entity();

            XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang();

            control.themdatcoc(dtocn);

            DTODonDatHang dtodh = new DTODonDatHang();

            dtodh.MaDH = txtMaDH.Text;
            int tong = int.Parse(txtTong.Text);
            int no   = int.Parse(txtDatCoc.Text);

            dtodh.CongNoDH = tong - no;
            daokh.CapNhatCongNo(dtodh);


            Response.Redirect("~/QLBoPhan_TiepXucKH/TaoDonHang.aspx?MaKH=" + int.Parse(txtMaKH.Text));
        }