Example #1
0
        public ErrorType TaoBaoCaoTongKetHocKy(string maHocKy, string maNamHoc)
        {
            LopBLL     lopbll  = new LopBLL();
            List <Lop> listLop = lopbll.GetListLop();
            BaoCaoTongKetHocKyAccess hockyac = new BaoCaoTongKetHocKyAccess();

            return(hockyac.TaoBaoCaoTongKetHocKy(maHocKy, maNamHoc, listLop));
        }
Example #2
0
        /// <summary>
        /// Tao moi 1 record
        /// </summary>
        /// <param name="lop"></param>
        /// <returns>-1 : Input rỗng</returns>
        /// <returns> 0 : Trùng</returns>
        /// <returns> 1 : Thành công</returns>
        /// <returns>2 : Exception</returns>
        public int Create(Lop lop)
        {
            if (lop == null)
            {
                return(-1);
            }
            LopDAO context = new LopDAO();

            try
            {
                LopBLL contextL = new LopBLL();
                lop.MaLop = contextL.CreateMaLop(lop.MaKhoa, lop.NienKhoa, lop.MaHDT);
                context.Create(lop);
                return(1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(2);
            }
        }
        public string CreateMaSV(string maLop)
        {
            SinhVienBLL contextSV  = new SinhVienBLL();
            LopBLL      contextL   = new LopBLL();
            HeDaoTaoBLL contextHDT = new HeDaoTaoBLL();

            try
            {
                Lop Lop = contextL.GetById(maLop);
                if (Lop != null)
                {
                    string stt = "";
                    int    dem = contextSV.GetByMaLop(maLop).Count;
                    if (dem >= 100)
                    {
                        stt = dem.ToString().Trim();
                    }
                    else if (dem < 100 && dem >= 10)
                    {
                        stt = "0" + dem.ToString().Trim();
                    }
                    else
                    {
                        stt = "00" + dem.ToString().Trim();
                    }
                    string ma = "N" + Lop.NienKhoa.Substring(2, 2) + Lop.MaHDT.Substring(0, 1) + Lop.MaHDT.Substring(2, 1) + Lop.MaKhoa.Substring(0, 2) + stt;
                    return(ma);
                }
                return(null);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
        }