Exemplo n.º 1
0
        void InsertDummyData(IVenueDao dao)
        {
            CreateTestData();

            foreach (var item in items)
            {
                dao.Insert(item);
            }
        }
        public Venue SaveVenue(Venue venue)
        {
            IVenueDao dao = DALFactory.CreateVenueDao(database);

            if (venue.Id != null && venue.Id > 0)
            {
                dao.Update(venue);
                return(venue);
            }
            venue = dao.Insert(venue);
            return(venue);
        }
        public void TestInsert()
        {
            IDatabase db  = DALFactory.CreateDatabase();
            IVenueDao dao = DALFactory.CreateVenueDao(db);
            Venue     v   = new Venue();

            v.Description      = "UNIT-TEST";
            v.Latitude         = 2;
            v.Longitude        = 2;
            v.ShortDescription = "NO";
            v.Address          = "TestAddress";

            dao.Insert(v);

            Assert.AreEqual(dao.findAll().Count, 3);
        }
Exemplo n.º 4
0
        private static void CreateVenues()
        {
            Console.WriteLine("Insert Venues ");

            Random    rand     = new Random();
            IVenueDao venueDao = DALFactory.CreateVenueDao(DALFactory.CreateDatabase());

            for (int i = 1; i <= 60; i++)
            {
                Venue v = new Venue();
                v.Address          = "My Random Place " + i;
                v.Description      = "This is Random Stage No " + i;
                v.ShortDescription = "Random Stage " + i;
                v.Latitude         = (int)(48.30613 * 1000000);
                v.Longitude        = (int)(14.286813 * 1000000);
                v.Latitude         = v.Latitude + rand.Next(1, 100);
                v.Longitude        = v.Longitude + rand.Next(1, 100);

                venueDao.Insert(v);
            }
        }