예제 #1
0
        public int DiemCaNhan(string type, string mssv, int namhoc, string hocky)
        {
            var daodg = new DAO.DiemDanhGiaRenLuyenDAO();
            var diem  = daodg.GetAllByMSSV(mssv, namhoc, hocky);

            if (diem != null)
            {
                if (type == "DiemSVDG")
                {
                    return(diem.Sum(x => x.DiemSVDG ?? 0));
                }
                if (type == "DiemLT")
                {
                    return(diem.Sum(x => x.DiemLT ?? 0));
                }
                if (type == "DiemCVHT")
                {
                    return(diem.Sum(x => x.DiemCVHT ?? 0));
                }
            }
            return(0);
        }
예제 #2
0
        public bool UpdateChuyenDiem(string namhoc, string hocky, string type)
        {
            var nam = int.Parse(namhoc.Split('-')[0].ToString());
            var dao = new DAO.DiemDanhGiaRenLuyenDAO();
            var lst = dao.GetAllByMSSV(nam, hocky);

            foreach (var item in lst)
            {
                if (type == "GV1")
                {
                    item.DiemCVHT = item.DiemLT;
                }
                else if (type == "GV2")
                {
                    item.DiemCVHT = item.DiemSVDG;
                }
                else
                {
                    item.DiemLT = item.DiemSVDG;
                }
            }
            return(dao.SaveToDatabase());
        }