Example #1
0
        /////////////////////////////////////////////////////////////////////////////////

        #region [ Serialization Procedures ]

        public void SaveIntoFile(string filename)
        {
            if (VideoStore == null)
            {
                return;
            }

            Out.Begin();

            /////////////////////////////////////////////////////////////////////////////

            Out.Title("Serializing video store data...");

            try
            {
                // To serialize data we must first open a stream for writing.
                // In this case, use a file stream.
                //
                using (FileStream fs = new FileStream(filename, FileMode.Create))
                {
                    VideoStore.Serialize(fs);
                }
            }
            catch (Exception ex)
            {
                Out.WriteLine(ex);
            }

            /////////////////////////////////////////////////////////////////////////////

            Out.End();
        }
Example #2
0
        private static void Strategy()
        {
            VideoStore videoStore = new VideoStore();

            videoStore.Store("Graduation", new Mp4Compressor(), new BlackAndWhiteFilter());
            videoStore.Store("Party", new AviCompressor(), new HighContrastFilter());
        }
        public IActionResult Get()
        {
            var videoStore = new VideoStore("Video Store Good Times");

            _efCoreApiDbContext.VideoStores.Add(videoStore);
            _efCoreApiDbContext.SaveChanges();
            return(Ok(videoStore));
        }
Example #4
0
        public void VideoStoreSetup()
        {
            idtMock = Substitute.For <IDatateTime>();

            Rental = new Rentals(idtMock);

            sut = new VideoStore(Rental);
        }
Example #5
0
 public void CreateUser(VideoStore.Business.Entities.User pUser)
 {
     using(TransactionScope lScope = new TransactionScope())
     using (VideoStoreEntityModelContainer lContainer = new VideoStoreEntityModelContainer())
     {
         lContainer.Users.AddObject(pUser);
         lContainer.SaveChanges();
         lScope.Complete();
     }
 }
Example #6
0
        static void Main(string[] args)
        {
            var date    = new DateTimes();
            var rentals = new Rentals(date);

            var VidStore = new VideoStore(rentals);

            VidStore.Movies = VidStore.FillMovieStorage();
            SUTVideoStoreConsole VideoStore = new SUTVideoStoreConsole(VidStore, rentals);

            VideoStore.StarMenu();
        }
Example #7
0
        public void Setup()
        {
            rentals  = Substitute.For <IRentals>();
            dateStub = Substitute.For <IDateTime>();
            sut      = new VideoStore(rentals);

            movie1 = new Movies()
            {
                Id = 0, Title = "Kalle Anka", Genre = "Animation"
            };
            NotitleOnMovie = new Movies()
            {
                Id = 0, Title = "", Genre = "Comedy"
            };

            customer1 = new Customer()
            {
                FirstName = "KallePer", movies = movie1, SSN = "1994-12-05"
            };
        }
Example #8
0
        /////////////////////////////////////////////////////////////////////////////////

        public void LoadFromFile(string filename)
        {
            Out.Begin();

            /////////////////////////////////////////////////////////////////////////////

            Out.Title("Deserializing video store data...");

            VideoStore = null;

            try
            {
                // Open the file containing the data that we want to deserialize.
                //
                using (FileStream fs = new FileStream(filename, FileMode.Create))
                {
                    VideoStore = VideoRentalOutlet.Deserialize(fs);
                }
            }
            catch (Exception ex)
            {
                Out.WriteLine(ex);
            }

            if (VideoStore == null)
            {
                return;
            }

            Out.WriteLine(VideoStore.FullInfo());
            Out.WriteLine(VideoStore.MovieExemplars.FullInfo());
            Out.WriteLine(VideoStore.Movies.FullInfo());
            Out.WriteLine(VideoStore.Customers.FullInfo());

            /////////////////////////////////////////////////////////////////////////////

            Out.End();
        }
Example #9
0
 protected override void OnStartup(StartupEventArgs e)
 {
     SimpleIoc.Default.Register <IDialogService>(() => new DialogService(new DialogLocator()));
     SimpleIoc.Default.Register <IVideoStore>(() => VideoStore.GetService());
     SimpleIoc.Default.Register <IVideoClubRules>(() => new VideoClubRules());
 }
Example #10
0
        static void Main(string[] args)
        {
            VideoStore   videoStore   = new VideoStore();
            RentalsMovie rentalsMovie = new RentalsMovie();
            int          Choice       = 0;

            while (Choice != 6)
            {
                Console.WriteLine();
                Console.WriteLine(" välja nummer de alternativ");
                Console.WriteLine("------------------------");
                Console.WriteLine("1- Get Customers ");
                Console.WriteLine("2- Add New Custmors");
                Console.WriteLine("3- Add New Movie");
                Console.WriteLine("4- Rent Movie");
                Console.WriteLine("5- Get Rentals For SSN");
                Console.WriteLine("6- Exit");
                try
                {
                    Choice = Convert.ToInt32(Console.ReadLine());
                }
                catch (Exception)
                {
                    Console.WriteLine("Ogiltig markering. Vänligen returnera ditt val.");
                }
                Console.WriteLine("Du valde: " + Choice);

                switch (Choice)
                {
                case 1:
                    var get = videoStore.GetCustomers();
                    get.ForEach(c => Console.WriteLine(c.Name, c.SSn));

                    Console.ReadLine();
                    break;

                case 2:
                    Console.WriteLine("Enter Movie Title :");
                    var title = Console.ReadLine();
                    Console.WriteLine("Enter SSN :");
                    var ssn = Console.ReadLine();
                    videoStore.RegisterCustomer(title, ssn);
                    break;

                case 3:
                    Console.WriteLine("Write Movie Title");
                    var   inp = Console.ReadLine();
                    Movie m   = new Movie {
                        MovieTitle = inp
                    };

                    videoStore.AddMovie(m);
                    break;

                case 4:
                    Console.WriteLine("Enter Movie Title :");
                    var Mov = Console.ReadLine();
                    Console.WriteLine("Enter SSN :");
                    var ssnM = Console.ReadLine();
                    videoStore.RentMovie(Mov, ssnM);
                    break;

                case 5:
                    Console.WriteLine("Enter SSN :");
                    var ssnMRent = Console.ReadLine();
                    rentalsMovie.GetRentalsFor(ssnMRent);
                    break;

                default:
                    Console.WriteLine("Tryck Inter för att fortsätta.......");
                    Console.ReadLine();
                    break;
                }
                Console.Clear();
            }
        }
Example #11
0
 public VideoController(VideoStore store)
 {
     this.store = store;
 }
Example #12
0
 public Videos(VideoStore videoStore)
 {
     _videoStore = videoStore;
 }
Example #13
0
 public void CreateUser(VideoStore.Business.Entities.User pUser)
 {
     ServiceLocator.Current.GetInstance<IPublisherService>().Publish(
         VideoStore.Common.CommandFactory.Instance.GetEntityInsertCommand<User>(pUser)
     );
 }
Example #14
0
 public void SetUp()
 {
     rentalMock = Substitute.For <IRentals>();
     iDateTime  = Substitute.For <IDateTime>();
     sut        = new VideoStore(rentalMock, iDateTime);
 }
Example #15
0
 public VideoHub(VideoStore videoStore)
 {
     this.videoStore = videoStore;
 }
Example #16
0
 static void Main(string[] args)
 {
     //För att vi kör dependency injection så skall vi ha det såhär
     var Call = new VideoStore(new RentedMovies(new MyDatTime()));
 }