Exemple #1
0
        public ActionResult DiemDanh(int id)
        {
            List <KetQuaHocTap> lst  = new List <KetQuaHocTap>();
            List <SinhVien>     list = new List <SinhVien>();

            ViewBag.id = id;
            using (QLSVDatabaseContext db = new QLSVDatabaseContext())
            {
                var kq = db.KetQuaHocTaps.Where(x => x.LopHocPhanId == id);
                if (kq != null)
                {
                    foreach (var item in kq)
                    {
                        KetQuaHocTap k = new KetQuaHocTap();
                        k = item;
                        lst.Add(k);
                    }
                }

                foreach (var item in lst)
                {
                    SinhVien sv = db.SinhViens.Where(y => y.SinhVienId == item.SinhVienId).FirstOrDefault();
                    list.Add(sv);
                }
                ViewBag.name = db.LopHocPhans.Where(x => x.LopHocPhanId == id).FirstOrDefault();
            }
            return(View(list));
        }
 public IActionResult LuuDiem(KetQuaHocTap data)
 {
     if (data != null)
     {
         this.database.KetQuaHocTap.Update(data);
         this.database.SaveChanges();
     }
     return(Redirect("/KetQuaHocTap/XemDiem"));
 }
        // GET: Home
        public ActionResult Index()
        {
            var diem = new KetQuaHocTap();
            // diem.LoaiDiem = (int)LoaiDiemEnum.CuoiKy;
            var gt = new SinhVien();

            gt.Gioitinh = (GioitinhEnum.Khac);
            return(View());
        }
Exemple #4
0
        public KetQuaHocTap Update(KetQuaHocTap kqht)
        {
            var exting = ketquahoctaprepository.GetById(kqht.KetQuaHocTapId);

            if (exting != null)
            {
                exting.LoaiDiem     = kqht.LoaiDiem;
                exting.SinhVienId   = kqht.SinhVienId;
                exting.LopHocPhanId = kqht.LopHocPhanId;
                ketquahoctaprepository.Update(exting);
            }
            return(null);
        }
Exemple #5
0
        public KetQuaHocTap Update(KetQuaHocTap kqht)
        {
            var exting = ketquahoctaprepository.GetById(kqht.kqhtID);

            if (exting != null)
            {
                exting.ThuongKy     = kqht.ThuongKy;
                exting.GiuaKy       = kqht.GiuaKy;
                exting.CuoiKy       = kqht.CuoiKy;
                exting.LopHocPhanId = kqht.LopHocPhanId;
                exting.SinhVienId   = kqht.SinhVienId;
                ketquahoctaprepository.Update(exting);
            }
            return(null);
        }
Exemple #6
0
 public bool Sua(KetQuaHocTap kqht)
 {
     try
     {
         string query = @" UPDATE dbo.Ketquahoctap SET mahs = '" + kqht.MaHS + "', TBHK1 = '" + kqht.TBHK1 + "' ,HocLuc1 = N'" + kqht.HocLuc1 + "' , TBHK2  = '" + kqht.TBHK2 + "',HocLuc2  = N'" + kqht.HocLuc2 + "', tbcn = '" + kqht.TBCN + "', hocluc = '" + kqht.HocLuc + "' where makqht = '" + kqht.MaKQHT + "'";
         OpenConection();
         ExecuteQueries(query);
         CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         SetEx(ex);
         return(false);
     }
 }
        public ActionResult getDangKy(int idlhp, int idsv)
        {
            KetQuaHocTapService kqhtsv = new KetQuaHocTapService();
            KetQuaHocTap        kq     = new KetQuaHocTap();

            kq.LopHocPhanId = idlhp;
            kq.SinhVienId   = 1;
            kq = kqhtsv.Add(kq);
            if (kq == null)
            {
                return(View());
            }
            var result = Json(kq, JsonRequestBehavior.AllowGet);

            return(result);
        }
        public JsonResult HuyLopHP(int idlhp, int idhk)
        {
            KetQuaHocTapService ser_kqht = new KetQuaHocTapService();
            string       idsv            = User.Identity.GetUserName();
            KetQuaHocTap kqht            = ser_kqht.getKQHT_by_idsv_idlhp(idsv, idlhp);

            ser_kqht.delete(kqht.kqhtID);
            //load lai ds dang ky
            IEnumerable <LopHocPhan> lst = new List <LopHocPhan>();

            lst = sc.GetLopHocPhanByHK(idhk);
            List <KetQuaHocTap> list_kqht = new List <KetQuaHocTap>();
            KetQuaHocTapService kqhtsev   = new KetQuaHocTapService();
            List <DKHP>         lsl       = new List <DKHP>();

            list_kqht = kqhtsev.GetAll().ToList();
            foreach (var item2 in lst)
            {
                foreach (var item in list_kqht)
                {
                    if (item2.LopHocPhanId == item.LopHocPhanId && item.SinhVienId == idsv)
                    {
                        MonHoc mh = ser_mh.getById(item2.MonHocId);
                        DKHP   d  = new DKHP();
                        d.idkqht = item.kqhtID;
                        d.idsv   = item.SinhVienId;
                        d.malhp  = item.LopHocPhanId;
                        d.sotc   = mh.Sotinchi;
                        d.tenmh  = mh.TenMonHoc;;
                        if (item2.TrangThai == EnumsHelper.TrangThaiLHP.Cho_SV_dang_ki)
                        {
                            d.trangthai = "Chờ sinh viên đăng kí";
                        }
                        else if (item2.TrangThai == EnumsHelper.TrangThaiLHP.Chap_Nhan_Mo_Lop)
                        {
                            d.trangthai = "Chấp nhận mở lớp";
                        }
                        else
                        {
                            d.trangthai = "Chờ hủy lớp";
                        }
                        lsl.Add(d);
                    }
                }
            }
            return(Json(lsl, JsonRequestBehavior.AllowGet));
        }
Exemple #9
0
 public bool Them(KetQuaHocTap kqht)
 {
     try
     {
         string query = @"INSERT INTO dbo.KetQuaHocTap
         VALUES  ( '" + kqht.MaKQHT + "' , '" + kqht.MaHS + "' , '" + kqht.TBHK1 + "' ,N'" + kqht.HocLuc1 + "' ,'" + kqht.TBHK2 + "' , N'" + kqht.HocLuc2 + "'  ,  '" + kqht.TBCN + "', N'" + kqht.HocLuc + "')";
         OpenConection();
         ExecuteQueries(query);
         CloseConnection();
         return(true);
     }
     catch (Exception ex)
     {
         SetEx(ex);
         return(false);
     }
 }
        public ActionResult getDangKy(int idlhp)
        {
            List <DKHP>       list_dkhp = new List <DKHP>();
            LopHocPhanService ser_lhp   = new LopHocPhanService();
            List <LopHocPhan> list_lhp  = new List <LopHocPhan>();
            LopHocPhan        lhp       = ser_lhp.getById(idlhp);

            List <KetQuaHocTap> list_kqht = new List <KetQuaHocTap>();
            KetQuaHocTapService kqhtsv    = new KetQuaHocTapService();
            KetQuaHocTap        kq        = new KetQuaHocTap();

            kq.LopHocPhanId = idlhp;
            kq.SinhVienId   = User.Identity.GetUserName();
            kq = kqhtsv.Add(kq);


            MonHocService ser_mh = new MonHocService();
            int           idmon  = lhp.MonHocId;
            MonHoc        mh     = ser_mh.getById(idmon);

            DKHP dkhp = new DKHP();

            dkhp.idkqht = kq.kqhtID;
            dkhp.malhp  = kq.LopHocPhanId;
            dkhp.idsv   = kq.SinhVienId;
            dkhp.malhp  = idlhp;
            dkhp.tenmh  = mh.TenMonHoc;
            dkhp.sotc   = mh.Sotinchi;
            // dkhp.ngaydk = DateTime.Today;
            if (lhp.TrangThai == EnumsHelper.TrangThaiLHP.Cho_SV_dang_ki)
            {
                dkhp.trangthai = "Chờ sinh viên đăng kí";
            }
            else if (lhp.TrangThai == EnumsHelper.TrangThaiLHP.Chap_Nhan_Mo_Lop)
            {
                dkhp.trangthai = "Chấp nhận mở lớp";
            }
            else
            {
                dkhp.trangthai = "Chờ hủy lớp";
            }
            list_dkhp.Add(dkhp);

            return(Json(dkhp, JsonRequestBehavior.AllowGet));
        }
 public SinhVienReponsitoty(KetQuaHocTap _context)
 {
     context = _context;
 }
        private void btOk_Click(object sender, EventArgs e)
        {
            if (type == "Them")
            {
                float diem1 = float.Parse(txtTBHK1.Text.Trim());
                if (diem1 >= 0 && diem1 < 3.5f)
                {
                    hocLuc1 = "Yếu";
                }
                else if (diem1 >= 3.5f && diem1 < 5.5f)
                {
                    hocLuc1 = "Trung Bình";
                }
                else if (diem1 >= 5.5f && diem1 < 8.0f)
                {
                    hocLuc1 = "Khá";
                }
                else
                {
                    hocLuc1 = "Giỏi";
                }


                float diem2 = float.Parse(txtTBHK2.Text.Trim());
                if (diem2 >= 0 && diem2 < 3.5f)
                {
                    hocLuc2 = "Yếu";
                }
                else if (diem2 >= 3.5f && diem2 < 5.5f)
                {
                    hocLuc2 = "Trung Bình";
                }
                else if (diem2 >= 5.5f && diem2 < 8.0f)
                {
                    hocLuc2 = "Khá";
                }
                else
                {
                    hocLuc2 = "Giỏi";
                }

                diemTB = (diem1 + diem2) / 2;
                if (diemTB >= 0 && diemTB < 3.5f)
                {
                    hocLuc = "Yếu";
                }
                else if (diemTB >= 3.5f && diemTB < 5.5f)
                {
                    hocLuc = "Trung Bình";
                }
                else if (diemTB >= 5.5f && diemTB < 8.0f)
                {
                    hocLuc = "Khá";
                }
                else
                {
                    hocLuc = "Giỏi";
                }

                if (txtTBHK1.Text != "" && txtTBHK2.Text != "")
                {
                    KetQuaHocTap kqht = new KetQuaHocTap(txtMaKQHT.Text.Trim(), txtMaHS.Text.Trim(), diem1, hocLuc1.Trim(), diem2, hocLuc2.Trim(), diemTB, hocLuc.Trim());
                    if (dal_kqht.Them(kqht) == true)
                    {
                        FormatData();
                        ShowData();
                        EnableMethod(true);
                        MessageBox.Show("Thêm thành công");
                    }
                    else
                    {
                        Exception ex = dal_kqht.GetEx();
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Bạn cần nhập đủ thông tin ");
                }
            }
            else if (type == "Sua")
            {
                float diem1 = float.Parse(txtTBHK1.Text.Trim());
                if (diem1 >= 0 && diem1 < 3.5f)
                {
                    hocLuc1 = "Yếu";
                }
                else if (diem1 >= 3.5f && diem1 < 5.5f)
                {
                    hocLuc1 = "Trung Bình";
                }
                else if (diem1 >= 5.5f && diem1 < 8.0f)
                {
                    hocLuc1 = "Khá";
                }
                else
                {
                    hocLuc1 = "Giỏi";
                }


                float diem2 = float.Parse(txtTBHK2.Text.Trim());
                if (diem2 >= 0 && diem2 < 3.5f)
                {
                    hocLuc2 = "Yếu";
                }
                else if (diem2 >= 3.5f && diem2 < 5.5f)
                {
                    hocLuc2 = "Trung Bình";
                }
                else if (diem2 >= 5.5f && diem2 < 8.0f)
                {
                    hocLuc2 = "Khá";
                }
                else
                {
                    hocLuc2 = "Giỏi";
                }

                diemTB = (diem1 + diem2) / 2;
                if (diemTB >= 0 && diemTB < 3.5f)
                {
                    hocLuc = "Yếu";
                }
                else if (diemTB >= 3.5f && diemTB < 5.5f)
                {
                    hocLuc = "Trung Bình";
                }
                else if (diemTB >= 5.5f && diemTB < 8.0f)
                {
                    hocLuc = "Khá";
                }
                else
                {
                    hocLuc = "Giỏi";
                }

                if (txtTBHK1.Text != "" && txtTBHK2.Text != "")
                {
                    KetQuaHocTap kqht = new KetQuaHocTap(txtMaKQHT.Text.Trim(), txtMaHS.Text.Trim(), diem1, hocLuc1.Trim(), diem2, hocLuc2.Trim(), diemTB, hocLuc.Trim());
                    if (dal_kqht.Sua(kqht) == true)
                    {
                        FormatData();
                        ShowData();
                        MessageBox.Show("Sửa thành công");
                        EnableMethod(true);
                    }
                    else
                    {
                        Exception ex = dal_kqht.GetEx();
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Bạn cần nhập đủ thông tin phòng ban");
                }
            }
            else if (type == "Xoa")
            {
                if (txtTBHK1.Text != "" && txtTBHK2.Text != "")
                {
                    DialogResult dr = MessageBox.Show("Bạn có muốn xóa khồng?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        dal_kqht.Xoa(txtMaKQHT.Text);
                        EnableMethod(true);
                        ShowData();
                    }
                    else
                    {
                        EnabledData(false);
                        EnableMethod(true);
                    }
                }
            }
        }
 public SinhViensController(KetQuaHocTap context)
 {
     _context = context;
 }
Exemple #14
0
 public KetQuaHocTap Add(KetQuaHocTap kqht)
 {
     return(ketquahoctaprepository.Add(kqht));
 }
 public LopHocPhansController(KetQuaHocTap context)
 {
     _context = context;
 }
Exemple #16
0
 public LopHocPhanReponsitory(KetQuaHocTap _context)
 {
     context = _context;
 }
Exemple #17
0
 public MonHocReponsitory(KetQuaHocTap _context)
 {
     context = _context;
 }
 public CategoryReponsitory(KetQuaHocTap _context)
 {
     context = _context;
 }
 public MonHocsController(KetQuaHocTap context)
 {
     _context = context;
 }
Exemple #20
0
 public KhoasController(KetQuaHocTap context)
 {
     _context = context;
 }