Example #1
0
    private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
    {
        var mitem = await MovieDataSource.GetItemAsync((String)e.NavigationParameter);

        // You must have data inside mitem if you put a breakpint at the below line
        MyItems = mitem;
    }
Example #2
0
        public ReviewModelDTO SubmitReview(

            int movieId,

            ReviewModelDTO review
            )
        {
            try
            {
                using (IMovieDataSource _ds = new MovieDataSource(new MovieDbContext()))
                {
                    ReviewModelDTO currentReview = review;
                    MovieModel     movie         = _ds.GetMovies().Single(m => m.Id == movieId);
                    ReviewModel    rev           = new ReviewModel()
                    {
                        Rating = currentReview.Rating, ReviewText = currentReview.ReviewText, Reviewer = currentReview.Reviewer, Summary = currentReview.Summary, Movie = movie
                    };
                    movie.Reviews.Add(rev);
                    _ds.Save();
                    return(currentReview);
                }
            }
            catch (Exception e)
            {
                throw new FaultException(e.Source + Environment.NewLine + e.Message);
            }
        }
Example #3
0
 public void InitDataSource()
 {
     if (!MovieDataSource.HasDataSource && !MovieDataSource.IsLoadingData)
     {
         MovieDataSource.InitFileLoading();
     }
 }
Example #4
0
 public Store(ICache Cache)
 {
     cache           = Cache;
     entityMapper    = new EntityMapper();
     movieDataSource = new ();
     ReplenishCacheFromSource();
 }
Example #5
0
 public Movie()
 {
     movieDataSource = new MovieDataSource();
     access          = new BusinessAccess();
     errorInfo       = new _FaultData();
     //log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(ConfigurationManager.AppSettings["PathLogConfig"]));
 }
Example #6
0
 public IList <MovieModelDTO> GetMoviesByTitle(string title)
 {
     using (IMovieDataSource _ds = new MovieDataSource(new MovieDbContext()))
     {
         IQueryable <MovieModel> result = _ds.GetMovies().Where(m => m.Title == title);
         return(result.Select(m => new MovieModelDTO()
         {
             Id = m.Id, Title = m.Title
         }).ToList());
     }
 }
Example #7
0
        public VideoFolder LoadParentFiles(VideoFolder Parentdir, IList <DirectoryInfo> SubDirectory, SortType sorttype)
        {
            VideoFolder videoFolder = new VideoFolder(Parentdir, SubDirectory[0].Parent.FullName);
            var         children    = new ObservableCollection <VideoFolder>();

            LoadParentSubDirectories(SubDirectory, children, videoFolder);
            videoFolder.OtherFiles = children;
            GetFolderItems(videoFolder);
            MovieDataSource.InitFileLoading();
            return(videoFolder);
        }
Example #8
0
        private void AddFolderDialog_OnFinished(object sender, EventArgs e)
        {
            var addfiledialogVM = ((sender as AddFolderDialog).DataContext as AddFolderDialogViewModel);

            if (addfiledialogVM.FileHasChange)
            {
                ApplicationService.SaveMovieFolders();
                MovieDataSource.LoadAllFolders(addfiledialogVM.RemovedFolders);
            }
            HasNoFolderAction();
        }
Example #9
0
 public MovieModelDTO GetMovie(int id)
 {
     using (IMovieDataSource _ds = new MovieDataSource(new MovieDbContext()))
     {
         MovieModel result;
         result = _ds.GetMovies().Single(m => m.Id == id);
         return(new MovieModelDTO()
         {
             Id = result.Id, Title = result.Title, ReleaseDate = result.ReleaseDate
         });
     }
 }
Example #10
0
 public IList <MovieModelDTO> GetMovies()
 {
     using (IMovieDataSource _ds = new MovieDataSource(new MovieDbContext()))
     {
         IList <MovieModelDTO> result = _ds.GetMovies().Select(m => new MovieModelDTO()
         {
             Id          = m.Id,
             Title       = m.Title,
             ReleaseDate = m.ReleaseDate
         }).ToList <MovieModelDTO>();
         return(result);
     }
 }
Example #11
0
        public VideoFolder LoadParentFiles(VideoFolder Parentdir, IList <FileInfo> SubFiles, SortType sorttype)
        {
            VideoFolder videoFolder = new VideoFolder(Parentdir, SubFiles[0].Directory.FullName);

            var children = new ObservableCollection <VideoFolder>();

            children = LoadChildrenFiles(videoFolder, SubFiles);
            videoFolder.OtherFiles    = children;
            videoFolder.HasSubFolders = false;
            GetFolderItems(videoFolder);
            MovieDataSource.InitFileLoading();

            return(videoFolder);
        }
Example #12
0
        private void HomePageLocalNoFolder_OnFinished(object sender, RoutedEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            NewFolderModel newFolderModel = e.Source as NewFolderModel;

            if (newFolderModel.NewFolderCollection == null)
            {
                return;
            }
            MovieDataSource.LoadAllFolders();
            ApplicationService.SaveMovieFolders();
        }
Example #13
0
 public IList <ReviewModelDTO> GetReviews(int movieId)
 {
     using (IMovieDataSource _ds = new MovieDataSource(new MovieDbContext()))
     {
         IList <ReviewModel> result = _ds.GetReviews(movieId).ToList();
         return(result.Select(r => new ReviewModelDTO()
         {
             Id = r.Id,
             Rating = r.Rating,
             Reviewer = r.Reviewer,
             ReviewText = r.ReviewText,
             Summary = r.Summary
         }).ToList());
     }
 }
Example #14
0
        private void LoadParentSubDirectories(IList <DirectoryInfo> parentSubDir,
                                              ObservableCollection <VideoFolder> existingchildren, VideoFolder parentdir)
        {
            for (int i = 0; i < parentSubDir.Count; i++)
            {
                if (parentSubDir[i] == null)
                {
                    continue;
                }
                VideoFolder child        = LoadDirInfo(parentdir, parentSubDir[i]);
                var         originalcopy = MovieDataSource.GetExistingCopy(child);
                if (originalcopy != null)
                {
                    child = originalcopy;
                    child.SetParentDirectory(parentdir);
                }

                existingchildren.Add(child);
            }
            if (parentSubDir.Count > 0)
            {
                parentdir.HasSubFolders = true;
            }
        }
Example #15
0
        public void RemoveFromDataSource(VideoFolder existingVideoFolder)
        {
            if (existingVideoFolder == null)
            {
                return;
            }
            switch (existingVideoFolder.FileType)
            {
            case FileType.Folder:
                MovieDataSource.InitFileLoading();

                break;

            case FileType.File:
                if (MovieDataSource.DataSource.ContainsKey(existingVideoFolder.FullName))
                {
                    MovieDataSource.DataSource.Remove(existingVideoFolder.FullName);
                }
                break;

            default:
                break;
            }
        }
 public MovieService()
 {
     _dataSource = new MovieDataSource();
 }
Example #17
0
 public DataRepository(MovieDataSource dataSrc, CacheHelper cacheHelper)
 {
     _dataSrc     = dataSrc;
     _cacheHelper = cacheHelper;
 }
Example #18
0
 public Repository()
 {
     AutoMapper.Configure();
     Database = new MovieDataSource();
 }
Example #19
0
        static void Main(string[] args)
        {
            Application.Init();
            var top = Application.Top;

            // Creates a menubar, the item "New" has a help menu.
            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => { top.Running = false; })
                })
            });

            top.Add(menu);


            // Creates the top-level window to show
            var win = new Window(new Rect(0, 1, top.Frame.Width, top.Frame.Height - 1), "Movie Db");

            top.Add(win);

            // Add some controls
            var txtSearchLbl      = new Label(3, 1, "Movie Name: ");
            var txtSearch         = new TextField(15, 1, 30, "");
            var forKidsOnly       = new CheckBox(3, 3, "For Kids?");
            var minimumRatingLbl  = new Label(25, 3, "Minimum Rating: ");
            var minimumRatingTxt  = new TextField(41, 3, 10, "");
            var searchBtn         = new Button(3, 5, "Filter");
            var allMoviesListView = new ListView(new Rect(4, 8, top.Frame.Width, 200), MovieDataSource.GetList(forKidsOnly.Checked, 0).ToList());

            searchBtn.Clicked = () =>
            {
                double rating   = 0;
                var    isDouble = double.TryParse(minimumRatingTxt.Text.ToString(), out rating);
                if (!string.IsNullOrEmpty(minimumRatingTxt.Text.ToString()) && !isDouble)
                {
                    MessageBox.ErrorQuery(30, 6, "Error", "Rating must be number");
                    minimumRatingTxt.Text = ustring.Empty;
                    return;
                }

                win.Remove(allMoviesListView);
                if (string.IsNullOrEmpty(txtSearch.Text.ToString()) || string.IsNullOrEmpty(minimumRatingTxt.Text.ToString()))
                {
                    allMoviesListView = new ListView(new Rect(4, 8, top.Frame.Width, 200),
                                                     MovieDataSource.GetList(forKidsOnly.Checked, rating).ToList());
                    win.Add(allMoviesListView);
                }
                else
                {
                    win.Remove(allMoviesListView);
                    win.Add(new ListView(new Rect(4, 8, top.Frame.Width, 200),
                                         MovieDataSource.GetList(forKidsOnly.Checked, rating)
                                         .Where(x =>
                                                x.Name.Contains(txtSearch.Text.ToString(), StringComparison.OrdinalIgnoreCase)
                                                ).ToList()));
                }
            };
            win.Add(
                txtSearchLbl,
                txtSearch,
                forKidsOnly,
                minimumRatingLbl,
                minimumRatingTxt,
                searchBtn,
                new Label(3, 7, "-------------Search Result--------------")
                );

            var exp = Movie.IsSuitableForChildren.Compile();

            if (!exp(new Movie()))
            {
            }

            Application.Run();
        }
Example #20
0
 public DataAccess()
 {
     movieDataSource = new MovieDataSource();
 }
 public DataSourceAdapter()
 {
     _dataSource = new MovieDataSource();
 }
Example #22
0
 public DataRepository(MovieDataSource dataSrc)
 {
     this.dataSrc = dataSrc;
 }
Example #23
0
 public void GetAllData()
 {
     var movieDataSource = new MovieDataSource();
     var allMovies = movieDataSource.GetAllData();
     Assert.IsTrue(allMovies.Any());
 }
 public MovieController()
 {
     _dataSource = new MovieDataSource();
 }