static void Main(string[] args)
 {
     #region StartApp
     PersonDirectory pDirectory = new PersonDirectory();
     pDirectory.Start();
     #endregion
 } //end main
Exemplo n.º 2
0
        public static PersonDirectory getPersons(string stringSql)
        {
            PersonDirectory personDirectory = new PersonDirectory();
            string          sql             = stringSql;
            OleDbCommand    command         = new OleDbCommand(sql, connect);

            try
            {
                connect.Open();
                OleDbDataReader rd = command.ExecuteReader();

                while (rd.Read())
                {
                    personDirectory.Persons.Add(new Person()
                    {
                        Id   = Convert.ToInt32(rd["id"]),
                        Nome = rd["nome"].ToString(),
                        Rg   = rd["rg"].ToString(),
                        Cpf  = rd["cpf"].ToString(),
                        Nasc = rd["nasc"].ToString().Replace("00:00:00", ""),
                        Re   = rd["re"].ToString(),
                        End  = rd["end"].ToString()
                    });
                }
                return(personDirectory);
            }
            catch (Exception e) {
                Console.WriteLine("Ocorreu o Seguinte erro ao tentar a consulta na base de dados:\n" + e.Message);
                return(personDirectory);
            }
            finally {
                connect.Close();
            }
        }
Exemplo n.º 3
0
        public void PersonDirectoryTestJson()
        {
            List <Person> persons = new List <Person>
            {
                new Student("nabeel", "234342"),
                new Student("yin", "3423423"),
                new Faculty("andruid", "professor"),
                new Student("bill", "4234"),
                new Student("sashi", "545454"),
                new Student("jon", "53453453")
            };
            PersonDirectory p = new PersonDirectory(persons);

            SimplTypesScope simplTypesScope = SimplTypesScope.Get("personDir", typeof(Person),
                                                                  typeof(Faculty), typeof(Student), typeof(PersonDirectory));

            TestMethods.TestSimplObject(p, simplTypesScope, Format.Json);
        }