public EditOrAddAwardWindowVM(ICollectionsEntity collectionEntity, AwardVM award = null)
        {
            _collectionEntity = collectionEntity;
            _award            = award;

            ImageClearButtonVisibility = Visibility.Collapsed;

            if (_award != null)
            {
                if (_award.PerformerId != null)
                {
                    Performer = new PerformerVM(DataLayer.Performer.GetById((Guid)_award.PerformerId));
                }
                if (_award.EntertainmentId != null)
                {
                    Entertainment = new EntertainmentVM(DataLayer.Entertainment.GetById((Guid)_award.EntertainmentId));
                }
                Name       = _award.Name;
                Nomination = _award.Nomination;
                Date       = _award.Date;

                if (_award.Image != null)
                {
                    ImageClearButtonVisibility = Visibility.Visible;
                }
            }
            NameErrorVisibility = Visibility.Hidden;
            DateErrorVisibility = Visibility.Hidden;

            Logger.Info("EditOrAddAwardWindowVM.EditOrAddAwardWindowVM", "Екземпляр EditOrAddAwardWindowVM створений.");
        }
        public PerformerDetailsViewModel(Guid id)
        {
            PerformerViewModel = new PerformerVM(Performer.GetById(id));

            Entertainment[] entertainmentByPerformer = Entertainment.GetEntertainmentByPerformer(PerformerViewModel.PerformerDL);
            if (entertainmentByPerformer != null)
            {
                AvarageCriticPoint = Entertainment.AverageCriticPointForEntertainments(entertainmentByPerformer);
                AvarageUserPoint   = Entertainment.AverageUserPointForEntertainments(entertainmentByPerformer);
            }

            Awards = this.GetAwardByPerfomer();

            EntertainmentVMs = this.GetEntertainmentVMByPerformer();
            Movies           = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.Movie).ToArray();
            Games            = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.Game).ToArray();
            TVSeries         = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.TVSeries).ToArray();
            Albums           = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.Album).ToArray();

            MoviesByDate   = Movies.OrderByDescending((ent) => ent.ReleaseDate).ToArray();
            GamesByDate    = Games.OrderByDescending((ent) => ent.ReleaseDate).ToArray();
            TVSeriesByDate = TVSeries.OrderByDescending((ent) => ent.ReleaseDate).ToArray();
            AlbumsByDate   = Albums.OrderByDescending((ent) => ent.ReleaseDate).ToArray();

            MoviesByCriticPoint   = Movies.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray();
            GamesByCriticPoint    = Games.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray();
            TVSeriesByCriticPoint = TVSeries.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray();
            AlbumsByCriticPoint   = Albums.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray();

            MoviesByUserPoint   = Movies.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray();
            GamesByUserPoint    = Games.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray();
            TVSeriesByUserPoint = TVSeries.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray();
            AlbumsByUserPoint   = Albums.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray();
        }
        public PerformerDetailsWindow(PerformerVM _performer)
        {
            InitializeComponent();

            DataContext = new PerformerDetailsWindowVM(_performer);

            Logger.Info("PerformerDetailsWindow.PerformerDetailsWindow", "Екземпляр PerformerDetailsWindow створений.");
        }
Example #4
0
        public EditOrAddPerformerWindow(ICollectionsEntity entity, PerformerVM performer = null)
        {
            InitializeComponent();

            DataContext = new EditOrAddPerformerWindowVM(entity, performer);

            Logger.Info("EditOrAddPerformerWindow.EditOrAddPerformerWindow", "Екземпляр EditOrAddPerformerWindow створений.");
        }
        public void Add(object item)
        {
            PerformerVM newItem = item as PerformerVM;

            if (newItem != null)
            {
                _performerCollection.Add(newItem);
            }
        }
Example #6
0
        public PerformerDetailsWindowVM(PerformerVM performer)
        {
            _performer = performer;

            if (performer.Image == null)
            {
                _noImage = File.ReadAllBytes(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\noImage.png");
            }

            Logger.Info("PerformerDetailsWindowVM.PerformerDetailsWindowVM", "Екземпляр PerformerDetailsWindowVM створений.");
        }
        internal void SearchButtonClick()
        {
            _performerCollection.Clear();

            Performer[] performers = Performer.GetByName(PartOfNameForSearch, PerformerVM.PerformerTypeUkrStringToEngEnum(SelectedType));
            if (performers != null)
            {
                foreach (var performer in performers)
                {
                    _performerCollection.Add(new PerformerVM(performer));
                }
            }
        }
Example #8
0
 public PerformerAndEntertainmentViewModel(EntertainmentVM entertainmentViewModel = null, PerformerVM performerViewModel = null)
 {
     if (entertainmentViewModel != null)
     {
         PerformerOrEntertainment = entertainmentViewModel;
         ContentType = Content.Entertainment;
     }
     if (performerViewModel != null)
     {
         PerformerOrEntertainment = performerViewModel;
         ContentType = Content.Performer;
     }
 }
        internal bool OkButtonClick()
        {
            _isError = false;

            if (Name == null || Name == String.Empty)
            {
                NameErrorVisibility = Visibility.Visible;
                _isError            = true;
            }
            else
            {
                NameErrorVisibility = Visibility.Hidden;
            }

            if (_isError)
            {
                return(false);
            }

            if (PerformerVM.PerformerTypeUkrStringToEngEnum(PerformerTypeUkr) != Performer.Type.Person)
            {
                Surname = null;
            }

            if (_performer == null)
            {
                PerformerVM perfomer = new PerformerVM(Name, Surname, (Performer.Type)PerformerVM.PerformerTypeUkrStringToEngEnum(PerformerTypeUkr),
                                                       DateOfBirth, Image == null ? null : File.ReadAllBytes(Image), Summary);
                perfomer.PerformerDL.Save();
                _collectionEntity.Add(perfomer);
            }
            else
            {
                _performer.PerformerType = (Performer.Type)PerformerVM.PerformerTypeUkrStringToEngEnum(PerformerTypeUkr);
                _performer.Name          = Name;
                _performer.Surname       = Surname;
                _performer.DateOfBirth   = DateOfBirth;
                if (Image != null && Image != String.Empty)
                {
                    _performer.Image = File.ReadAllBytes(Image);
                }
                else if (_clearImage)
                {
                    _performer.Image = null;
                }
                _performer.Summary = Summary;

                _performer.PerformerDL.Save();
            }
            return(true);
        }
Example #10
0
        public async Task <IActionResult> PerformerDetails(int ID)
        {
            var response = await _eventiApi.GetPerformerAsync(ID);

            var entity = response.Content;
            var model  = new PerformerVM
            {
                ID   = entity.ID,
                Name = entity.Name,
                PerformerCategory = entity.PerformerCategory
            };

            return(View(model));
        }
        private string GetPerformersStringByRole(PerformerInEntertainment.Role role)
        {
            Performer[] performers = Performer.GetPerformerByEntertainmentAndRole(_entertainment.EntertainmentDL, role);
            if (performers == null)
            {
                return(null);
            }

            string result = "";

            foreach (var performer in performers)
            {
                PerformerVM performerVM = new PerformerVM(performer);
                result += performerVM.ToString();
                result += ", ";
            }
            return(result.Remove(result.Length - 2, 2));
        }
Example #12
0
 internal void DeleteButtonClick()
 {
     foreach (PerformerInEntertainmentVM performerInEntertainment in _performerInEntertainmentCollection)
     {
         if (performerInEntertainment.PerformerComparison(AddedSelectedPerformer))
         {
             _deletedPerformerCollection.Add(AddedSelectedPerformer);
             break;
         }
     }
     for (int i = 0; i < _addedPerformerCollection.Count; i++)
     {
         if (PerformerVM.Comparison(_addedPerformerCollection[i], AddedSelectedPerformer))
         {
             _addedPerformerCollection.Remove(_addedPerformerCollection[i]);
             break;
         }
     }
 }
Example #13
0
 internal void AddButtonClick()
 {
     foreach (PerformerVM performer in _addedPerformerCollection)
     {
         if (PerformerVM.Comparison(performer, PerformerViewModel.SelectedPerformer))
         {
             return;
         }
     }
     for (int i = 0; i < _deletedPerformerCollection.Count; i++)
     {
         if (PerformerVM.Comparison(_deletedPerformerCollection[i], PerformerViewModel.SelectedPerformer))
         {
             _deletedPerformerCollection.Remove(_deletedPerformerCollection[i]);
             break;
         }
     }
     _addedPerformerCollection.Add(PerformerViewModel.SelectedPerformer);
 }
Example #14
0
        public async Task <IActionResult> PerformerSave(PerformerVM model)
        {
            var request = new PerformerUpsertRequest()
            {
                Name = model.Name,
                PerformerCategory = model.PerformerCategory
            };


            if (model.ID == 0)
            {
                await _eventiApi.CreatePerformerAsync(request);
            }
            else
            {
                await _eventiApi.UpdatePerformerAsync(model.ID, request);
            }

            return(Redirect("/Administrator/Home/Index"));
        }
Example #15
0
        public PerformerMiniViewModel(PerformerVM performer, PerformerInEntertainment.Role role)
        {
            _performer = performer;

            Role = role;

            Entertainment[] entertainmentByPerformer = Entertainment.GetEntertainmentByPerformer(performer.PerformerDL);
            if (entertainmentByPerformer != null)
            {
                AvaragePerformerPoint = Entertainment.AverageCriticPointForEntertainments(entertainmentByPerformer);
            }

            if (role == PerformerInEntertainment.Role.MovieCast)
            {
                Entertainment[] lastThreeActorsEntertainments = Entertainment.GetLastThreeEntertainmentByActor(performer.PerformerDL);
                if (lastThreeActorsEntertainments != null)
                {
                    List <EntertainmentVM> result = new List <EntertainmentVM>();
                    foreach (var entertainment in lastThreeActorsEntertainments)
                    {
                        result.Add(new EntertainmentVM(entertainment));
                    }
                    LastThreePerformersEntertainments = result.ToArray();
                }
            }
            if (role == PerformerInEntertainment.Role.AlbumSinger)
            {
                Entertainment[] lastThreeActorsEntertainments = Entertainment.GetLastThreeEntertainmentBySinger(performer.PerformerDL);
                if (lastThreeActorsEntertainments != null)
                {
                    List <EntertainmentVM> result = new List <EntertainmentVM>();
                    foreach (var entertainment in lastThreeActorsEntertainments)
                    {
                        result.Add(new EntertainmentVM(entertainment));
                    }
                    LastThreePerformersEntertainments = result.ToArray();
                }
            }
        }
        public PerformerUserControlVM(Performer.Type?type = null)
        {
            PerformerTypesComboBoxVisibility = Visibility.Visible;
            AddButtonVisibility    = Visibility.Visible;
            EditButtonVisibility   = Visibility.Visible;
            DeleteButtonVisibility = Visibility.Visible;

            if (type != null)
            {
                _selectedType = PerformerVM.PerformerTypeToUkrString((Performer.Type)type);
            }

            Performer[] performers = Performer.GetRandomFirstTen(type);
            if (performers != null)
            {
                foreach (var performer in performers)
                {
                    _performerCollection.Add(new PerformerVM(performer));
                }
            }

            Logger.Info("PerformerUserControlVM.PerformerUserControlVM", "Екземпляр PerformerUserControlVM створений.");
        }
        public EditOrAddPerformerWindowVM(ICollectionsEntity collectionEntity, PerformerVM performer = null)
        {
            _collectionEntity = collectionEntity;
            _performer        = performer;

            ImageClearButtonVisibility = Visibility.Collapsed;

            if (_performer != null)
            {
                PerformerTypeUkr = _performer.PerformerTypeUkr;
                Name             = _performer.Name;
                Surname          = _performer.Surname;
                DateOfBirth      = _performer.DateOfBirth;
                Summary          = _performer.Summary;

                if (_performer.Image != null)
                {
                    ImageClearButtonVisibility = Visibility.Visible;
                }
            }
            NameErrorVisibility = Visibility.Hidden;

            Logger.Info("EditOrAddPerformerWindowVM.EditOrAddPerformerWindowVM", "Екземпляр EditOrAddPerformerWindowVM створений.");
        }
Example #18
0
        public IActionResult PerformerCreate()
        {
            var model = new PerformerVM();

            return(View(model));
        }