public AdministrationVM(IAdministrationServices service, IIOService ioService)
 {
     this.administrationService = service;
     this.ioService = ioService;
     this.currentArtistAdministration = new ArtistAdministrationVM(this.administrationService, ioService);
     this.currentCatagoryAdministration = new CatagoryAdministrationVM(this.administrationService);
     this.currentVenueAdministration = new VenueAdministrationVM(this.administrationService);
     this.currentPerformanceAdministration = new PerformanceAdministrationVM(this.administrationService);
     Login = new RelayCommand((c) =>
     {
         var box = c as PasswordBox;
         var password = box.Password;
         user = service.CheckUser(UserName, password);
         if(user != null)
         {
             LoggedIn = true;
             LoginFailedMessage = "";
             RaisePropertyChangedEvent(nameof(LoggedIn));
         }
         else
         {
             LoginFailedMessage = "UserId or Password is invalid";
             RaisePropertyChangedEvent(nameof(LoginFailedMessage));
         }
     });
 }
예제 #2
0
 public AdministrationVM(IAdministrationServices service, IIOService ioService)
 {
     this.administrationService            = service;
     this.ioService                        = ioService;
     this.currentArtistAdministration      = new ArtistAdministrationVM(this.administrationService, ioService);
     this.currentCatagoryAdministration    = new CatagoryAdministrationVM(this.administrationService);
     this.currentVenueAdministration       = new VenueAdministrationVM(this.administrationService);
     this.currentPerformanceAdministration = new PerformanceAdministrationVM(this.administrationService);
     Login = new RelayCommand((c) =>
     {
         var box      = c as PasswordBox;
         var password = box.Password;
         user         = service.CheckUser(UserName, password);
         if (user != null)
         {
             LoggedIn           = true;
             LoginFailedMessage = "";
             RaisePropertyChangedEvent(nameof(LoggedIn));
         }
         else
         {
             LoginFailedMessage = "UserId or Password is invalid";
             RaisePropertyChangedEvent(nameof(LoginFailedMessage));
         }
     });
 }
        public PerformanceVM(Venue v, Performance p1, Performance p2, Performance p3, Performance p4, Performance p5, IAdministrationServices service, PerformanceAdministrationVM parent)
        {
            this.Artists = new ObservableCollection <Artist>();
            this.administrationService = service;
            this.parent = parent;
            venue       = v;
            Col1        = p1;
            Col2        = p2;
            Col3        = p3;
            Col4        = p4;
            Col5        = p5;

            this.Artists.Clear();
            IList <Artist> arts = administrationService.GetArtists();

            foreach (Artist artist in arts)
            {
                Artists.Add(artist);
            }

            RemoveEntryCol1 = new RelayCommand(c => {
                Col1.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol1));
                RaisePropertyChangedEvent(nameof(ArtistNameCol1));
                RaisePropertyChangedEvent(nameof(CountryCol1));
                RaisePropertyChangedEvent(nameof(CatagoryCol1));
                RaisePropertyChangedEvent(nameof(ColorCol1));
            });
            RemoveEntryCol2 = new RelayCommand(c => {
                Col2.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol2));
                RaisePropertyChangedEvent(nameof(ArtistNameCol2));
                RaisePropertyChangedEvent(nameof(CountryCol2));
                RaisePropertyChangedEvent(nameof(CatagoryCol2));
                RaisePropertyChangedEvent(nameof(ColorCol2));
            });
            RemoveEntryCol3 = new RelayCommand(c => {
                Col3.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol3));
                RaisePropertyChangedEvent(nameof(ArtistNameCol3));
                RaisePropertyChangedEvent(nameof(CountryCol3));
                RaisePropertyChangedEvent(nameof(CatagoryCol3));
                RaisePropertyChangedEvent(nameof(ColorCol3));
            });
            RemoveEntryCol4 = new RelayCommand(c => {
                Col4.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol4));
                RaisePropertyChangedEvent(nameof(ArtistNameCol4));
                RaisePropertyChangedEvent(nameof(CountryCol4));
                RaisePropertyChangedEvent(nameof(CatagoryCol4));
                RaisePropertyChangedEvent(nameof(ColorCol4));
            });
            RemoveEntryCol5 = new RelayCommand(c => {
                Col5.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol5));
                RaisePropertyChangedEvent(nameof(ArtistNameCol5));
                RaisePropertyChangedEvent(nameof(CountryCol5));
                RaisePropertyChangedEvent(nameof(CatagoryCol5));
                RaisePropertyChangedEvent(nameof(ColorCol5));
            });

            SendEmailCol1 = new RelayCommand(c =>
            {
                IList <Performance> toSend = new List <Performance>();
                toSend.Add(Col1);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol2 = new RelayCommand(c =>
            {
                IList <Performance> toSend = new List <Performance>();
                toSend.Add(Col2);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol3 = new RelayCommand(c =>
            {
                IList <Performance> toSend = new List <Performance>();
                toSend.Add(Col3);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol4 = new RelayCommand(c =>
            {
                IList <Performance> toSend = new List <Performance>();
                toSend.Add(Col4);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol5 = new RelayCommand(c =>
            {
                IList <Performance> toSend = new List <Performance>();
                toSend.Add(Col5);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
        }
        public PerformanceVM(Venue v, Performance p1, Performance p2, Performance p3, Performance p4, Performance p5,IAdministrationServices service, PerformanceAdministrationVM parent)
        {
            this.Artists = new ObservableCollection<Artist>();
            this.administrationService = service;
            this.parent = parent;
            venue = v;
            Col1 = p1;
            Col2 = p2;
            Col3 = p3;
            Col4 = p4;
            Col5 = p5;

            this.Artists.Clear();
            IList<Artist> arts = administrationService.GetArtists();
            foreach (Artist artist in arts)
            {
                Artists.Add(artist);
            }

            RemoveEntryCol1 = new RelayCommand(c => {
                Col1.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol1));
                RaisePropertyChangedEvent(nameof(ArtistNameCol1));
                RaisePropertyChangedEvent(nameof(CountryCol1));
                RaisePropertyChangedEvent(nameof(CatagoryCol1));
                RaisePropertyChangedEvent(nameof(ColorCol1));
            });
            RemoveEntryCol2 = new RelayCommand(c => {
                Col2.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol2));
                RaisePropertyChangedEvent(nameof(ArtistNameCol2));
                RaisePropertyChangedEvent(nameof(CountryCol2));
                RaisePropertyChangedEvent(nameof(CatagoryCol2));
                RaisePropertyChangedEvent(nameof(ColorCol2));
            });
            RemoveEntryCol3 = new RelayCommand(c => {
                Col3.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol3));
                RaisePropertyChangedEvent(nameof(ArtistNameCol3));
                RaisePropertyChangedEvent(nameof(CountryCol3));
                RaisePropertyChangedEvent(nameof(CatagoryCol3));
                RaisePropertyChangedEvent(nameof(ColorCol3));
            });
            RemoveEntryCol4 = new RelayCommand(c => {
                Col4.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol4));
                RaisePropertyChangedEvent(nameof(ArtistNameCol4));
                RaisePropertyChangedEvent(nameof(CountryCol4));
                RaisePropertyChangedEvent(nameof(CatagoryCol4));
                RaisePropertyChangedEvent(nameof(ColorCol4));
            });
            RemoveEntryCol5 = new RelayCommand(c => {
                Col5.Artist = null;
                RaisePropertyChangedEvent(nameof(ArtistCol5));
                RaisePropertyChangedEvent(nameof(ArtistNameCol5));
                RaisePropertyChangedEvent(nameof(CountryCol5));
                RaisePropertyChangedEvent(nameof(CatagoryCol5));
                RaisePropertyChangedEvent(nameof(ColorCol5));
            });

            SendEmailCol1 = new RelayCommand(c =>
            {
                IList<Performance> toSend = new List<Performance>();
                toSend.Add(Col1);
                administrationService.SendMail(toSend,toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol2 = new RelayCommand(c =>
            {
                IList<Performance> toSend = new List<Performance>();
                toSend.Add(Col2);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol3 = new RelayCommand(c =>
            {
                IList<Performance> toSend = new List<Performance>();
                toSend.Add(Col3);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol4 = new RelayCommand(c =>
            {
                IList<Performance> toSend = new List<Performance>();
                toSend.Add(Col4);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
            SendEmailCol5 = new RelayCommand(c =>
            {
                IList<Performance> toSend = new List<Performance>();
                toSend.Add(Col5);
                administrationService.SendMail(toSend, toSend);
                AppMessages.ShowSuccessMessage.Send("Mail sent");
            });
        }