public void ChonCauHoi(String CauHoi)
        {
            var khocauhoi = new JavaScriptSerializer().Deserialize <List <Kho_CauHoi> >(CauHoi);
            var sessetion = (BoDeThi)Session[ComMon.ComMonStants.ChapterStudy];
            var bo_De     = sessetion.BoDeThi1;

            foreach (var item in khocauhoi)
            {
                Modell.CauHoi cau = new Modell.CauHoi();
                cau.Ma_CauHoi  = item.Ma_CauHoi;
                cau.Ma_BoDe    = bo_De.Ma_BoDe;
                cau.Kho_CauHoi = new CauHoiDao().Question(item.Ma_CauHoi);
                bo_De.CauHois.Add(cau);
            }
            sessetion.BoDeThi1 = bo_De;
            Session[ComMon.ComMonStants.ChapterStudy] = sessetion;
        }
        public JsonResult Updatepheduyet(long maDe, string Pheduyet, string lydo)
        {
            var tk = (TaiKhoan)Session[ComMon.ComMonStants.UserLogin];

            if (tk.ChưcVu.Contains("Admin"))
            {
                TracNghiemOnlineDB db = new TracNghiemOnlineDB();
                var Bode = db.Bo_De.Where(x => x.Ma_BoDe.Equals(maDe));
                Bode.ToList()[0].PheDuyet  = Pheduyet;
                Bode.ToList()[0].TrangThai = false;
                db.SaveChanges();
                if (Pheduyet.Equals("Đã duyệt"))
                {
                    try
                    {
                        Bo_De boDeThi = new Bo_De();
                        boDeThi.NoiDung     = Bode.ToList()[0].NoiDung;
                        boDeThi.Ma_Mon      = Bode.ToList()[0].Ma_Mon;
                        boDeThi.ThoiGianThi = Bode.ToList()[0].ThoiGianThi;
                        boDeThi.Ma_NguoiTao = Bode.ToList()[0].Ma_NguoiTao;
                        boDeThi.NguoiDuyet  = tk.TaiKhoan1;
                        boDeThi.TrangThai   = true;
                        boDeThi.Xoa         = true;
                        foreach (var item in Bode.ToList()[0].CauHois)
                        {
                            Modell.CauHoi cauHoi = new Modell.CauHoi();
                            cauHoi.Ma_CauHoi = item.Ma_CauHoi;
                            boDeThi.CauHois.Add(cauHoi);
                        }
                        boDeThi.SoCau = boDeThi.CauHois.Count;
                        db.Bo_De.Add(boDeThi);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        string ess = e.Message;
                    }

                    var de = new TracNghiemOnlineDB().BoMons.Select(x => x).ToList().Last();
                }

                List <Bo_De> bo_Des = new TracNghiemOnlineDB().Bo_De.Where(x => x.Xoa == true && x.NguoiDuyet.Equals(tk.TaiKhoan1) && x.TrangThai == false && x.PheDuyet.Equals("Đang xử lý")).ToList();

                var bode1 = (from n in bo_Des
                             select new
                {
                    Ten = n.NoiDung,
                    MaDe = n.Ma_BoDe,
                    SoCau = n.SoCau,
                    ThoiGian = n.ThoiGianThi,
                    TenMon = n.MonHoc.TenMon,
                    Giaovien = n.GiaoVien.TenGV,
                    Pheduyet = n.PheDuyet,
                    Trangthai = n.TrangThai,
                    Ngay = n.NguoiDuyet,
                }).ToList();
                return(Json(new
                {
                    Bode = bode1
                }, JsonRequestBehavior.AllowGet));;
            }

            else
            {
                TracNghiemOnlineDB db = new TracNghiemOnlineDB();
                var ds = db.DSGV_ThucHien.Find(maDe);
                ds.trangthai = Pheduyet;
                ds.LyDo      = lydo;
                db.SaveChanges();

                if (Pheduyet.Equals("Đã duyệt"))
                {
                    try
                    {
                        var   Bode    = new TracNghiemOnlineDB().Bo_De.Where(x => x.Ma_BoDe == ds.MaDE);
                        Bo_De boDeThi = new Bo_De();
                        boDeThi.NoiDung     = Bode.ToList()[0].NoiDung;
                        boDeThi.Ma_Mon      = Bode.ToList()[0].Ma_Mon;
                        boDeThi.ThoiGianThi = Bode.ToList()[0].ThoiGianThi;
                        boDeThi.Ma_NguoiTao = Bode.ToList()[0].Ma_NguoiTao;
                        boDeThi.NguoiDuyet  = tk.TaiKhoan1;
                        boDeThi.TrangThai   = true;
                        boDeThi.Xoa         = true;
                        foreach (var item in Bode.ToList()[0].CauHois)
                        {
                            Modell.CauHoi cauHoi = new Modell.CauHoi();
                            cauHoi.Ma_CauHoi = item.Ma_CauHoi;
                            boDeThi.CauHois.Add(cauHoi);
                        }
                        boDeThi.SoCau = boDeThi.CauHois.Count;
                        db.Bo_De.Add(boDeThi);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        string ess = e.Message;
                    }

                    var de = new TracNghiemOnlineDB().BoMons.Select(x => x).ToList().Last();
                }

                return(Json(new
                {
                    statust = true,
                }, JsonRequestBehavior.AllowGet));;
            }
        }