예제 #1
0
 public Alumno Add(Alumno student, TypeFormat typeFormat)
 {
     try
     {
         student.DateRegistry = DateTime.Now;
         Log.Debug("Fecha actual calculada");
         student.Edad = Age.AreAge(student.DateBorn, student.DateRegistry);
         IStudentDao  = ChangeFormat(typeFormat);
         Log.Debug("Formato pasado la capa Dao");
         return(IStudentDao.Add(student));
     }
     catch (ArgumentNullException e)
     {
         Log.Error("Falta una instancia" + e);
         throw;
     }
     catch (FileNotFoundException) { throw; }
     catch (FileLoadException)
     {
         throw;
     }
     catch (FormatException)
     {
         throw;
     }
 }
예제 #2
0
        public void TxtAddTest(int id, string name, string surname, int edad, string dni, string datebirth)
        {
            log.Info(System.Reflection.MethodBase.GetCurrentMethod().Name + " iniciado");

            Student student = new Student(id, name, surname, edad, dni, datebirth);

            AbstarctFactory formatfactory = new FormatFactory();
            IStudentDao     stddao        = formatfactory.CreateStudentFormat("txt");

            Student studenttest = stddao.Add(student);

            studenttest.FechaNacimiento = student.FechaNacimiento;

            log.Info("studenttest G: " + studenttest.Student_Guid + ", stuednt G:" + student.Student_Guid);

            log.Info("studenttest: " + studenttest.FechaNacimiento + ", stuednt:" + student.FechaNacimiento);
            log.Info("studenttest: " + studenttest.Nombre + ", stuednt:" + student.Nombre);
            log.Info("studenttest: " + studenttest.Edad + ", stuednt:" + student.Edad);
            log.Info("studenttest: " + studenttest.HoraRegistro + ", stuednt:" + student.HoraRegistro);
            log.Info("studenttest: " + studenttest.IdAlumno + ", stuednt:" + student.IdAlumno);
            log.Info("studenttest: " + studenttest.Apellido + ", stuednt:" + student.Apellido);
            log.Info("studenttest: " + studenttest.SavedFormat + ", stuednt:" + student.SavedFormat);
            log.Info("studenttest: " + studenttest.Dni + ", stuednt:" + student.Dni);

            Assert.IsTrue(student.Equals(studenttest));

            log.Info(System.Reflection.MethodBase.GetCurrentMethod().Name + " terminado");
        }
예제 #3
0
 public CourseSelectBlo(ICourseDao courseDao,
                        IStudentDao studentDao,
                        ICourseValidation courseValidation)
 {
     _courseDao        = courseDao;
     _studentDao       = studentDao;
     _courseValidation = courseValidation;
 }
예제 #4
0
        public static void SaveData(IStudentDao studentDao)
        {
            var repository = studentDao.GetAll();

            using var sw = new StreamWriter("data.txt", false);
            foreach (var student in repository)
            {
                sw.WriteLine(student.ToString());
            }
        }
예제 #5
0
 public StudentDaoTests()
 {
     student = new Student()
     {
         StudentId   = 12,
         Name        = "Lolo",
         Surname     = "Manolo",
         DateOfBirth = Convert.ToDateTime("10/02/2010")
     };
     studentDao = new StudentDao();
 }
예제 #6
0
        public static void ReadData(IStudentDao studentDao)
        {
            using var sr = new StreamReader("data.txt");
            string line;

            while ((line = sr.ReadLine()) != null)
            {
                var structure = line.Split(',');

                studentDao.Save(new Student
                {
                    Surname     = structure[0],
                    Name        = structure[1],
                    SecondName  = structure[2],
                    Course      = int.Parse(structure[3]),
                    Spec        = Converter.GetSpecialty(structure[4]),
                    GroupNumber = int.Parse(structure[5])
                });
            }
        }
 public StudentController(NHibernate.ISessionFactory sessionFactory)
 {
     // TODO: Complete member initialization
     this.sessionFactory = sessionFactory;
     studentDao = new StudentDao(sessionFactory);
 }
예제 #8
0
 public StudentBLController(IStudentDao studentDao)
 {
     _studentDao = studentDao;
 }
예제 #9
0
 public MainWindow()
 {
     InitializeComponent();
     studentDao = StudentDao.GetInstance();
 }
예제 #10
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="studentDao"></param>
 public StudentServiceImpl(IStudentDao studentDao)
 {
     _studentDao = studentDao;
 }
예제 #11
0
 public StudentFacade(IStudentDao student)
 {
     studentDao = student ?? throw new ArgumentException(nameof(student));
 }
예제 #12
0
 public StudentManager(IStudentDao studentDao)
 {
     _studentDao = studentDao;
 }
예제 #13
0
 public ValuesController(IStudentDao <Student> studentDao)
 {
     this.studentDao = studentDao;
 }
예제 #14
0
 public StudentRepository()
 {
     this.studentDao = new StudentDao();
 }