示例#1
0
 public CategoryViewModel(IManager manager)
 {
     this.manager = manager;
     this.category = new Category();
     this.SaveCommand = new RelayCommand(o => UpdateCategory());
     ConfigureValidation();
 }
示例#2
0
文件: ViewerImpl.cs 项目: amigobv/UFO
        /// <summary>
        /// Gets all artists by category.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">Invalid Country provided</exception>
        public IList<Artist> GetAllArtistsByCategory(Category category)
        {
            if (category == null ||
                category.Id == null)
                throw new ArgumentNullException("Invalid Country provided");

            return artistDao.FindByCategoryId(category.Id);
        }
示例#3
0
 public Restriction()
 {
     Id = 0;
     Start = new DateTime();
     End = new DateTime();
     Venue = null;
     Category = null;
 }
示例#4
0
 public Restriction(int id, DateTime start, DateTime end, Venue venue, Category category)
 {
     Id = id;
     Start = start;
     End = end;
     Venue = venue;
     Category = category;
 }
示例#5
0
        public CategoryViewModel(Category category, IManager manager)
        {
            this.manager = manager;

            if (category == null)
                this.category = new Category();
            else
                this.category = category;
            this.SaveCommand = new RelayCommand(o => UpdateCategory());
            ConfigureValidation();
        }
示例#6
0
文件: ArtistTest.cs 项目: amigobv/UFO
        private void CreateTestData()
        {
            var cat = new Category(COMEDY_ID, COMEDY_LABEL);
            var categoryDao = new CategoryDao(database);
            categoryDao.Insert(cat);

            items = new List<Artist>();
            items.Add(new Artist(ARTIST1_ID, ARTIST1_NAME, ARTIST1_COUNTRY, ARTIST1_MAIL, "", "", "", "", cat, false));
            items.Add(new Artist(ARTIST2_ID, ARTIST2_NAME, ARTIST2_COUNTRY, ARTIST2_MAIL, "", "", "", "", cat, false));
            items.Add(new Artist(ARTIST3_ID, ARTIST3_NAME, ARTIST3_COUNTRY, ARTIST3_MAIL, "", "", "", "", cat, false));
        }
示例#7
0
        public bool Insert(Category o)
        {
            if (o == null ||
                o.Id == null ||
                o.Label == null)
                return false;

            var command = _database.CreateCommand(SQL_INSERT);
            _database.DefineParameter(command, "@id", DbType.String, o.Id);
            _database.DefineParameter(command, "@label", DbType.String, o.Label);
            

            return _database.ExecuteNonQuery(command) == 1;
        }
示例#8
0
文件: Artist.cs 项目: amigobv/UFO
 public Artist(int id, string name, string country, string email, string description,
               string homepage, string picture, string video, Category category, bool deleted)
 {
     Id = id;
     Name = name;
     Country = country;
     Email = email;
     Homepage = homepage;
     Description = description;
     VideoUrl = video;
     PictureUrl = picture;
     Category = category;
     IsDeleted = deleted;
 }
示例#9
0
        private void CreateTestData()
        {
            var loc = new Location(LOCATION_ID, LOCATION);
            var locationDao = new LocationDao(database);
            locationDao.Insert(loc);

            var venue = new Venue(VENUE_ID, VENUE_LABEL, VENUE_SPECTATORS, loc, 0, 0);
            var venueDao = new VenueDao(database);
            venueDao.Insert(venue);

            var category = new Category(CATEGORY_ID, CATEGORY_LABEL);
            var categoryDao = new CategoryDao(database);
            categoryDao.Insert(category);

            items = new List<Restriction>();
            items.Add(new Restriction(1, RESTRICTION1_START, RESTRICTION1_STOP, venue, category));
            items.Add(new Restriction(2, RESTRICTION2_START, RESTRICTION2_STOP, venue, category));
            items.Add(new Restriction(3, RESTRICTION3_START, RESTRICTION3_STOP, venue, category));
            items.Add(new Restriction(4, RESTRICTION4_START, RESTRICTION4_STOP, venue, category));
        }
示例#10
0
        private void CreateTestData()
        {
            var loc = new Location(LOCATION_ID, LOCATION);
            var locationDao = new LocationDao(database);
            locationDao.Insert(loc);

            var venue = new Venue(VENUE_ID, VENUE_LABEL, VENUE_SPECTATORS, loc, 0, 0);
            var venueDao = new VenueDao(database);
            venueDao.Insert(venue);

            var category = new Category(CATEGORY_ID, CATEGORY_LABEL);
            var categoryDao = new CategoryDao(database);
            categoryDao.Insert(category);

            var artist = new Artist(ARTIST_ID, ARTIST_NAME, ARTIST_COUNTRY, ARTIST_MAIL, "", "", "", "", category, false);
            var artistDao = new ArtistDao(database);
            artistDao.Insert(artist);

            items = new List<Performance>();
            items.Add(new Performance(1, PERFORMANCE1_START, artist, venue));
            items.Add(new Performance(2, PERFORMANCE2_START, artist, venue));
            items.Add(new Performance(3, PERFORMANCE3_START, artist, venue));
            items.Add(new Performance(4, PERFORMANCE4_START, artist, venue));
        }
示例#11
0
 public List<Artist> GetAllArtistsByCategory(Category category)
 {
     return new List<Artist>(viewBL.GetAllArtistsByCategory(category));
 }
示例#12
0
        public void UpdateCategory(Category category)
        {
            if (category == null)
                throw new ArgumentNullException("Invalid category");

            if (categoryDao.FindById(category.Id) != null)
            {
                if (!categoryDao.Update(category))
                    throw new CategoryException("Cannot update category!");
            }
            else
            {
                CreateCategory(category);
            }
        }
示例#13
0
        public void RemoveCategory(Category category)
        {
            if (category == null)
                throw new ArgumentNullException("Invalid category!");

            if (!categoryDao.Delete(category.Id))
                throw new CategoryException("Cannot remove category!");
        }
示例#14
0
        public void CreateCategory(Category category)
        {
            if (category == null)
                throw new ArgumentNullException("Invalid category!");

            if (!categoryDao.Insert(category))
                throw new CategoryException("Cannot insert category!");
        }
示例#15
0
        public bool CategoryExists(Category category)
        {
            if (category == null)
                return false;

            return categoryDao.FindById(category.Id) != null;
        }