Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LopHoc lh = new LopHoc();
            if (Request.QueryString["action"] == "nhapdiem")
            {
                string action = Request.QueryString["nhapdiem"];
                string malop  = Request.QueryString["malop"];
                Session["malop"] = malop;

                lh.MaLop = Session["malop"].ToString();
            }
            lh.MaLop = Session["malop"].ToString();
            GiaoVien gv   = new GiaoVien();
            int      magv = int.Parse(Session["magv"].ToString());
            monhoc  = gvDAL.GetMaMonHoc(magv, lh.MaLop);
            gv.MaGV = magv;
            DSHocSinh.DataSource = gvDAL.GetDanhSachHSLopNhapDiem(Session["malop"].ToString(), magv, monhoc);
            DSHocSinh.DataBind();
            kiemtratb();
        }
        lbTenLop.Text = gvDAL.LayTenLop(Session["malop"].ToString());
        lbMonHoc.Text = gvDAL.LayTenMonHoc(monhoc);
    }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string maHS    = dgvHocSinh.CurrentRow.Cells["MaHS"].Value.ToString();
            string maKythi = txtID.Text;
            var    check   = (from hs in db.DSHocSinhs
                              where hs.MaHS == maHS && hs.MaKiThi == maKythi
                              select hs).SingleOrDefault();

            if (check == null)
            {
                DSHocSinh hs = new DSHocSinh();
                hs.MaHS    = maHS;
                hs.MaKiThi = txtID.Text;

                db.DSHocSinhs.InsertOnSubmit(hs);
                try
                {
                    db.SubmitChanges();
                    ReloadKyThi();
                }

                catch
                {
                    MessageBox.Show("Thêm học sinh thất bại");
                }
            }
            else
            {
                MessageBox.Show("Đã tồn tại thí sinh trong kỳ thi");
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        LopHoc lh = new LopHoc();

        if (Request.QueryString["action"] == "nhapdiem")
        {
            string action = Request.QueryString["nhapdiem"];
            string malop  = Request.QueryString["malop"];
            Session["malop"] = malop;

            lh.MaLop = Session["malop"].ToString();
        }

        if (Request.QueryString["action"] == "nhapdiem1")
        {
            string action = Request.QueryString["nhapdiem1"];
            string mahs   = Request.QueryString["mahs"];
            Session["mahs"] = mahs;
            lophoc          = Session["malop"].ToString();
            lbMaHS.Text     = mahs;
        }
        Session["malop"] = lophoc;
        lh.MaLop         = Session["malop"].ToString();
        GiaoVien gv   = new GiaoVien();
        int      magv = int.Parse(Session["MaGV"].ToString());

        gv.MaGV = magv;

        DSHocSinh.DataBind();
    }
Ejemplo n.º 4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string maKT = txtID.Text;

            DSHocSinh hs = (from h in db.DSHocSinhs
                            where h.MaKiThi == dgvKyThi.CurrentRow.Cells["MaKiThi"].Value.ToString() &&
                            h.MaHS == dgvKyThi.CurrentRow.Cells["MaHS2"].Value.ToString()
                            select h).SingleOrDefault();

            db.DSHocSinhs.DeleteOnSubmit(hs);
            try
            {
                db.SubmitChanges();
                ReloadKyThi();
            }
            catch
            {
                MessageBox.Show("Lỗi xóa thí sinh");
            }
        }