示例#1
0
        private void btnJson_Click(object sender, EventArgs e)
        {
            IStudentDAO iStudentDAO = new StudentDAO();
            Student     student     = new Student();

            student.StudentId   = Int32.Parse(txtStudentId.Text);
            student.Name        = txtName.Text;
            student.Surname     = txtSurname.Text;
            student.DateOfBirth = DateTime.Parse(txtDateOfBirth.Text).Date;
            IAbstractFileFactory fileFactory = new JsonFactory();
            var  file       = fileFactory.CreateFile();
            bool fileExists = file.CheckFileExists();

            if (fileExists != true)
            {
                file.CreateFile();
            }
            iStudentDAO.Add(student, Common.Models.EnumTypeFactory.JSON);
        }