Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (IsPostBack == false)
                {
                    if (Request.QueryString["MaDH"] != null)
                    {
                        string        maDH  = Request.QueryString["MaDH"].ToString();
                        DTODonDatHang dtoDH = daoEntities.LayDonHangTraHang(maDH);
                        lbMaDH.Text  = dtoDH.MaDH.ToString();
                        lbMaKH.Text  = dtoDH.MaKH.ToString();
                        lbTenKH.Text = dtoDH.TenKH.ToString();


                        List <DTOChiTietDH> dsChiTietDonHang = daoEntities.LayDSChiTietDH(maDH);
                        gridChiTietDonHang.DataSource = dsChiTietDonHang;
                        gridChiTietDonHang.DataBind();

                        gridDSCanTra.DataSource = dsChiTietDonHang;
                        gridDSCanTra.DataBind();

                        int tongtien = 0;
                        foreach (DTOChiTietDH dtoCT in dsChiTietDonHang)
                        {
                            tongtien += dtoCT.ThanhTien;
                        }
                        lbTongTienDaDat.Text = tongtien.ToString();
                    }
                }
            }
            catch
            {
                Response.Write("<script>alert('Loi tai du lieu!')</script>");
            }
        }
        public void Xulytrahang(string ma)
        {
            DAO_Entity dao = new DAO_Entity();

            dao.LayDonHangTraHang(ma);
        }