protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                hienThanhPhamChon();

                if (Session["dsThanhPhamChon"] == null)
                {
                    lbDSChon.Visible       = false;
                    lbTextTongTien.Visible = false;
                    lbTongTien.Visible     = false;
                    lbDSSanpham.Visible    = false;
                    grDSSanPham.Visible    = false;
                    gridDSChon.Visible     = false;
                }
                else
                {
                    lbDSChon.Visible       = true;
                    lbTextTongTien.Visible = true;
                    lbTongTien.Visible     = true;
                    lbDSSanpham.Visible    = true;
                    grDSSanPham.Visible    = true;
                    gridDSChon.Visible     = true;
                }
            }
            catch (Exception)
            {
                Response.Write("<script>alert('Loi tai du lieu!')</script>");
            }

            if (IsPostBack == false)//postback=false: chưa có sự kiện click trên web
            {
                // request: yeu cau. QueryString: lay gia tri cua chuoi tren duong dan
                string       makh        = Request.QueryString["MaKH"].ToString();
                DAO_Entity   daoEntities = new DAO_Entity();
                DTOKhachHang dtoKH       = daoEntities.LayTTKHTheoMa(makh);

                XuLy_TiepNhanDonHang control = new XuLy_TiepNhanDonHang();
                control.LayttKH(makh);

                lbMaKH.Text       = dtoKH.MaKH.ToString();
                txtTen.Text       = dtoKH.TenKH;
                txtNgayTaoDH.Text = DateTime.Now.ToShortDateString();


                List <DTODonDatHang> dsdh = daoEntities.LayDSDHTheoMa(makh);
                GridViewDH.DataSource = dsdh;
                GridViewDH.DataBind();
                grDSSanPham.DataSource = daoEntities.TaoDSSP();
                grDSSanPham.DataBind();
            }
        }