コード例 #1
0
        protected void Button_OK_Click(object sender, EventArgs e)
        {
            GridViewRow row;
            bool        isChecked;
            int         iMaChuyenXe;
            int         iSoLuong = GridView1.Rows.Count;

            for (int i = 0; i < iSoLuong; i++)
            {
                row       = GridView1.Rows[i];
                isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;
                if (isChecked)
                {
                    iMaChuyenXe = Convert.ToInt32(row.Cells[1].Text);

                    // Them PhanHoi
                    PHAN_HOI ph = new PHAN_HOI();
                    ph.MaPhanHoiKhach = iMaPhanHoiKhach;
                    ph.MaChuyen       = iMaChuyenXe;
                    db.PHAN_HOIs.InsertOnSubmit(ph);
                    db.SubmitChanges();
                    ((CheckBox)row.FindControl("chkSelect")).Checked = false;

                    // Update
                    PHAN_HOI_KHACH_HANG phkh = (from x in db.PHAN_HOI_KHACH_HANGs
                                                where x.MaPhanHoi == iMaPhanHoiKhach
                                                select x).Single();
                    phkh.Duyet = 2;
                    db.SubmitChanges();
                }
            }
            GridView_PHANHOI.DataBind();
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     GridView_PHANHOI.DataBind();
 }