Ejemplo n.º 1
0
 void CommandRegisterExecute(Window window)
 {
     if (User != null && Password != null && User.Length > 0 && Password.Length > 0)
     {
         if (serviceClient.CheckUserExist(User))
         {
             MessageBox.Show("Ce LOGIN existe déjà!");
         }
         else
         {
             serviceClient.CreateUser(User, Password);
             MessageBox.Show("Inscription réussie");
             View.MenuWindow MenuW = new View.MenuWindow();
             MenuW.Show();
             int           Id_User = serviceClient.SelectIdByLogin(User);
             MovieNET.User user_co = serviceClient.SelectOneUser(Id_User);
             Messenger.Default.Send(user_co);
             window.Hide();
         }
     }
     else
     {
         if (User == null || User.Length <= 0)
         {
             MessageBox.Show("Le champs LOGIN ne doit pas être vide!");
         }
         if (Password == null || Password.Length <= 0)
         {
             MessageBox.Show("Le champs PASSWORD ne doit pas être vide!");
         }
     }
 }
Ejemplo n.º 2
0
 public ListViewModel()
 {
     CommandViewMovie = new RelayCommand <Page>(CommandViewMovieExecute);
     Messenger.Default.Register <MovieNET.User>(this, (user_co) =>
     {
         ListMovie = serviceClient.SelectAllMovie();
         User_co   = user_co;
     });
 }
Ejemplo n.º 3
0
        public UpdateViewModelTwo()
        {
            CommandUpdate   = new RelayCommand <object>(CommandUpdateExecute, CommandUpdateCanExecute);
            CommandAddActor = new RelayCommand(CommandAddActorExecute, CommandAddActorCanExecute);
            CommandReturn   = new RelayCommand <Page>(CommandReturnExecute);
            Messenger.Default.Register <MovieNET.User>(this, (User_co) =>
            {
                user_co = User_co;
            });
            Messenger.Default.Register <int>(this, (ID_movie) =>
            {
                id_movie      = ID_movie;
                selectedMovie = serviceClient.SelectOneMovie(id_movie);
                if (selectedMovie != null)
                {
                    SelectedMovieType = serviceClient.SelectOneMovieType(selectedMovie.Id_type);
                    SelectedDirector  = serviceClient.SelectOneDirector(selectedMovie.Id_director);
                    SelectedImage     = serviceClient.SelectOneImage(selectedMovie.Id_image);
                    ListActorMovie    = serviceClient.SelectActorByMovie(selectedMovie.Id_movie);

                    MovieTitle        = selectedMovie.Title;
                    MovieSynopsys     = selectedMovie.Synopsis;
                    MovieDurationHour = selectedMovie.Duration.Hours.ToString();
                    MovieDurationMin  = selectedMovie.Duration.Minutes.ToString();
                    MovieDurationSec  = selectedMovie.Duration.Seconds.ToString();
                    id_director       = SelectedDirector.Id_director;
                    id_movitype       = SelectedMovieType.Id_type;
                    Image             = SelectedImage.URL;
                    listMovieType     = serviceClient.SelectAllMovieType();
                    listMovieType.Add(new MovieNET.MovieType()
                    {
                        Id_type = 0, Type = "Autre"
                    });
                    listDirector = serviceClient.SelectAllDirector();
                    ListDirector.Add(new MovieNET.Director()
                    {
                        Id_director = 0, Firstname = "Autre"
                    });
                    listActor = serviceClient.SelectAllActor();
                    for (int i = 0; i < listMovieType.Count; i++)
                    {
                        if (listMovieType[i].Id_type == SelectedMovieType.Id_type)
                        {
                            MovieTypeIndex = i;
                        }
                    }
                    for (int i = 0; i < listDirector.Count; i++)
                    {
                        if (listDirector[i].Id_director == SelectedDirector.Id_director)
                        {
                            DirectorIndex = i;
                        }
                    }
                }
            });
        }
Ejemplo n.º 4
0
 public UpdateViewModel()
 {
     GoUpdateMovie        = new RelayCommand <Page>(GoUpdateMovieExecute);
     CommandSearchByTitle = new RelayCommand(CommandSearchByTitleExecute, CommandSearchByTitleCanExecute);
     CommandSearchByType  = new RelayCommand(CommandSearchByTypeExecute, CommandSearchByTypeCanExecute);
     Messenger.Default.Register <MovieNET.User>(this, (user_co) =>
     {
         ListMovie = serviceClient.SelectAllMovie();
         User_co   = user_co;
     });
 }
Ejemplo n.º 5
0
 public ProfilViewModel()
 {
     CommandUpdatePass = new RelayCommand(CommandUpdatePassExecute);
     CommandDeleteUser = new RelayCommand <Page>(CommandDeleteUserExecute);
     Messenger.Default.Register <MovieNET.User>(this, (user_co) =>
     {
         User_co            = user_co;
         MovieNET.User user = serviceClient.SelectOneUser(User_co.Id_user);
         user_name          = User_co.Login;
     });
 }
Ejemplo n.º 6
0
 void CommandUpdatePassExecute()
 {
     MovieNET.User user = serviceClient.SelectOneUser(User_co.Id_user);
     if (OldPass == user.Password)
     {
         serviceClient.ModifyUser(User_co.Id_user, user.Login, NewPass);
         MessageBox.Show("Votre mot de passe a été modifié");
         OldPass = "";
         NewPass = "";
     }
     else
     {
         MessageBox.Show("Le mot de passe actuel est incorrect");
     }
 }
Ejemplo n.º 7
0
 public MenuViewModel()
 {
     CommandLogout    = new RelayCommand <Window>(CommandLogoutExecute);
     CommandList      = new RelayCommand(CommandListExecute);
     CommandAdd       = new RelayCommand(CommandAddExecute);
     CommandDelete    = new RelayCommand(CommandDeleteExecute);
     CommandUpdate    = new RelayCommand(CommandUpdateExecute);
     CommandSearch    = new RelayCommand(CommandSearchExecute);
     CommandProfil    = new RelayCommand(CommandProfilExecute);
     OnClosingCommand = new RelayCommand(OnClosingCommandExecute);
     Messenger.Default.Register <MovieNET.User>(this, (user_co) =>
     {
         User_co = user_co;
         Msg     = "\nBonjour " + User_co.Login + ",\n\nBienvenue dans \nl'application \nMovie Net";
     });
 }
Ejemplo n.º 8
0
 public AddViewModel()
 {
     CommandAdd      = new RelayCommand <object>(CommandAddExecute, CommandAddCanExecute);
     CommandAddActor = new RelayCommand(CommandAddActorExecute, CommandAddActorCanExecute);
     listMovieType   = serviceClient.SelectAllMovieType();
     listMovieType.Add(new MovieNET.MovieType()
     {
         Id_type = 0, Type = "Autre"
     });
     listDirector = serviceClient.SelectAllDirector();
     ListDirector.Add(new MovieNET.Director()
     {
         Id_director = 0, Firstname = "Autre"
     });
     listActor = serviceClient.SelectAllActor();
     Messenger.Default.Register <MovieNET.User>(this, (user_co) =>
     {
         User_co = user_co;
     });
 }
Ejemplo n.º 9
0
        public FilmViewModel()
        {
            CommandAddComment = new RelayCommand(CommandAddCommentExecute);
            CommandReturn     = new RelayCommand <Page>(CommandReturnExecute);
            Messenger.Default.Register <MovieNET.User>(this, (user_co) =>
            {
                User_co = user_co;
            });

            Messenger.Default.Register <int>(this, (ID_movie) =>
            {
                id_movie      = ID_movie;
                MovieSelected = serviceClient.SelectOneMovie(id_movie);
                if (MovieSelected != null)
                {
                    MovieType          = serviceClient.SelectOneMovieType(MovieSelected.Id_type);
                    MovieDirector      = serviceClient.SelectOneDirector(MovieSelected.Id_director);
                    MovieImage         = serviceClient.SelectOneImage(MovieSelected.Id_image);
                    MovieTitle         = MovieSelected.Title;
                    MovieSynopsis      = MovieSelected.Synopsis;
                    MovieDurationHours = MovieSelected.Duration.Hours;
                    MovieDurationMin   = MovieSelected.Duration.Minutes;
                    MovieDurationSec   = MovieSelected.Duration.Seconds;
                    ListActor          = serviceClient.SelectActorByMovie(id_movie);
                    ListComment        = serviceClient.SelectCommentByMovie(id_movie);
                    rating             = serviceClient.SelectRating(id_movie);

                    Title     = MovieTitle;
                    Synopsis  = MovieSynopsis;
                    Image     = MovieImage.URL;
                    Director  = MovieDirector.Firstname;
                    LDirector = MovieDirector.Lastname;
                    Type      = MovieType.Type;
                    Note      = rating;
                }
            });
        }