Esempio n. 1
0
        public String XepLoaiHocLucMonHoc(float[] arrayDiemTBTungMon, float tongDiem)
        {
            String xepLoai = "";
            float diemTBMonNhoNhat = TimMin(arrayDiemTBTungMon);
            HocLucData m_HLData = new HocLucData();
            DataTable m_DT_DS_HocLuc = m_HLData.LayDsHocLuc();
            String[] maHocLuc = new String[m_DT_DS_HocLuc.Rows.Count];
            float[] diemCanDuoi = new float[m_DT_DS_HocLuc.Rows.Count];
            float[] diemKhongChe = new float[m_DT_DS_HocLuc.Rows.Count];

            int count = 0;
            foreach (DataRow row in m_DT_DS_HocLuc.Rows)
            {
                maHocLuc[count] = row["MaHocLuc"].ToString();
                diemCanDuoi[count] = float.Parse(row["DiemCanDuoi"].ToString());
                diemKhongChe[count] = float.Parse(row["diemKhongChe"].ToString());
                count++;
            }

            for (int i = 0; i < count - 1; i++)
            {
                if (tongDiem >= diemCanDuoi[i])
                {
                    xepLoai = maHocLuc[i];
                    if (diemTBMonNhoNhat <= diemKhongChe[i])
                        xepLoai = maHocLuc[i + 1];
                    break;
                }
            }

            if (xepLoai == "")
                xepLoai = maHocLuc[count - 1].ToString();
            return xepLoai;
        }
Esempio n. 2
0
        public String XepLoaiHLHocKy(String maHocSinh, String maLop, String maHocKy, String maNamHoc)
        {
            Console.WriteLine(@"Ma hoc sinh: " + maHocSinh + "  co ma hoc luc: ...Enter");
            //Lấy ra mã ban theo mã lớp - BEGIN
            string strBan = "CHUA_PHAN_BAN";
            DataTable m_DT_BAN = m_LopData.TimTheoMa(maLop);
            foreach (DataRow row in m_DT_BAN.Rows)
            {
                strBan = row["MaBan"].ToString().Trim();
                break;
            }
            //Lấy ra mã ban theo mã lớp - END
            float diemTBChungCacMonHK = (float)Math.Round(m_DiemCtrl.tinhDiemTrungBinhChungCacMonHocKy(maHocSinh, maLop, maHocKy, maNamHoc), 2);
            DataTable m_DiemTBHKMonHoc = m_KQHKMonHocData.LayDsKQHocKyMonHocTheoBan(maHocSinh, maLop, maHocKy, maNamHoc);
            HocLucData m_HLData = new HocLucData();
            DataTable m_DT_DS_HocLuc = m_HLData.LayDsHocLuc();
            String maHocLucHienTai = "";
            foreach (DataRow row in m_DT_DS_HocLuc.Rows)
            {
                String maHocLuc = row["MaHocLuc"].ToString();
               // maHocLucHienTai = maHocLuc;
                float diemCanTren = float.Parse(row["DiemCanTren"].ToString());
                float diemCanDuoi = float.Parse(row["DiemCanDuoi"].ToString());
                float diemKhongChe = float.Parse(row["diemKhongChe"].ToString());
                if (diemTBChungCacMonHK >= diemCanDuoi && diemTBChungCacMonHK <= diemCanTren)
                //điểm nằm trong khoảng giới hạn
                {

                    if (!isThoaManDKKhac(strBan, diemCanDuoi, diemKhongChe, m_DiemTBHKMonHoc))
                    {
                        //in ra để dò lỗi
                        Console.WriteLine(@"Ma hoc sinh: " + maHocSinh + " ko  co ma hoc luc: " + maHocLuc);
                        continue;
                    }
                    else
                    {
                        maHocLucHienTai = maHocLuc;
                    }
                }

            }
            //in ra để dò lỗi
            Console.WriteLine(@"Ma hoc sinh: " + maHocSinh + "  co ma hoc luc: " + maHocLucHienTai+"  Exit");
            return maHocLucHienTai;
        }