예제 #1
0
        public ErrorType ThemHS
            (string ma, string ten, string gioitinh, string diachi, string email, DateTime namsinh)
        {
            #region Kiem tra rong
            if (string.IsNullOrEmpty(ma) ||
                string.IsNullOrEmpty(ten) ||
                string.IsNullOrEmpty(gioitinh) ||
                string.IsNullOrEmpty(diachi) ||
                string.IsNullOrEmpty(email) ||
                string.IsNullOrEmpty(namsinh.ToShortDateString()))
            {
                return(ErrorType.KI_TU_RONG);
            }
            #endregion

            #region Kiem tra quy dinh
            ThayDoiQuyDinhBLL quydinhbll = new ThayDoiQuyDinhBLL();
            List <ThamSo>     listThamSo = quydinhbll.GetListThamSo();

            decimal tuoiToiDa    = 0;
            decimal tuoiToiThieu = 0;
            foreach (ThamSo ts in listThamSo)
            {
                //tuoi toi thieu
                if (ts.MaThamSo == "TuoiToiDa")
                {
                    tuoiToiDa = (decimal)ts.GiaTri;
                }
                if (ts.MaThamSo == "TuoiToiThieu")
                {
                    tuoiToiThieu = (decimal)ts.GiaTri;
                }
            }
            TimeSpan tuoiHienTai = DateTime.Now - namsinh;
            decimal  tuoi        = tuoiHienTai.Days / 365;
            MessageBox.Show(tuoi + "");
            if (tuoi > tuoiToiDa || tuoi < tuoiToiThieu)
            {
                return(ErrorType.VUOT_MIEN_GIA_TRI);
            }
            #endregion


            DShocsinhAccess ac = new DShocsinhAccess();
            return(ac.ThemHs(ma, ten, gioitinh, diachi, email, namsinh.ToShortDateString()));
        }
예제 #2
0
        public bool SuaHS(string ma, string ten, string gioitinh, string diachi, string email)
        {
            DShocsinhAccess ac = new DShocsinhAccess();

            return(ac.SuaHs(ma, ten, gioitinh, diachi, email));
        }
예제 #3
0
        public bool XoaHs(string ma)
        {
            DShocsinhAccess ac = new DShocsinhAccess();

            return(ac.XoaHS(ma));
        }
예제 #4
0
        public List <HocSinh> GetAllHinhThucKiemTra()
        {
            DShocsinhAccess danhsachhocsinh = new DShocsinhAccess();

            return(danhsachhocsinh.GetAllDShocsinh());
        }