Exemplo n.º 1
0
 public static int ConvertToSortOrder(MovieType movieType)
 {
     return(movieType switch
     {
         MovieType.Movie => 0,
         MovieType.TVSeries => 2,
         MovieType.Anime => 3,
         MovieType.AnimeMovie => 1,
         MovieType.YouTube => 4,
         _ => - 1,
     });
Exemplo n.º 2
0
        public ActionResult Create()
        {
            var viewModel = new MovieFormViewModel
            {
                types     = MovieType.getTypes(),
                languages = MovieLanguage.getLanguages(),
                Watched   = MovieWatched.getWatched()
            };

            return(View(viewModel));
        }
Exemplo n.º 3
0
        public void InsertMovie(int movieID, int userID, MovieType movieType)
        {
            try
            {
                SqlConnection conn = OpenConnection();
                SqlCommand    command;
                switch (movieType)
                {
                case (MovieType.Recommended):
                    command = new SqlCommand("INSERT INTO RecommendedMovie VALUES (@movieID,@userID)", conn);
                    command.Parameters.Add(new SqlParameter("@movieID", movieID));
                    command.Parameters.Add(new SqlParameter("@userID", userID));
                    command.ExecuteNonQuery();
                    break;

                case (MovieType.Saved):
                    command = new SqlCommand("INSERT INTO SavedMovie VALUES (@movieID,@userID)", conn);
                    command.Parameters.Add(new SqlParameter("@movieID", movieID));
                    command.Parameters.Add(new SqlParameter("@userID", userID));
                    command.ExecuteNonQuery();
                    break;

                case (MovieType.Watched):
                    command = new SqlCommand("INSERT INTO WatchedMovie (MovieID, UserID, WatchedDate, UserRating) VALUES (@movieID,@userID,@watchedDate,@userRating)", conn);
                    command.Parameters.Add(new SqlParameter("@movieID", movieID));
                    command.Parameters.Add(new SqlParameter("@userID", userID));
                    command.Parameters.Add(new SqlParameter("@watchedDate", DateTime.Now));
                    command.Parameters.Add(new SqlParameter("@userRating", null));
                    command.ExecuteNonQuery();
                    break;

                default:
                    //throw new Exception();
                    break;
                }
            }
            catch (SqlException Sqle)
            {
                Console.WriteLine("Problema al cargar usuario");
                Console.WriteLine(Sqle.Message);
                //throw;
            }
            catch (Exception e)
            {
                Console.WriteLine("Problema no relacionado a Sql 2");
                Console.WriteLine(e.Message);
                //throw;
            }
            finally
            {
                CloseConnection();
            }
        }
Exemplo n.º 4
0
        public int DeteleMovieType(MovieType movietype)
        {
            var sql        = string.Format(@"delete from [dbo].[MovieType] where id=(@TypeID)");
            var parameters = new List <SqlParameter>
            {
                new SqlParameter("@TypeID", movietype.Id)
            };

            return(DBHelper.ExecuteCommand(sql, parameters.ToArray()));

            throw new System.NotImplementedException();
        }
Exemplo n.º 5
0
    public string GetMoviePath(MovieType _type, int index)
    {
        string path = string.Empty;

        switch (_type)
        {
        case MovieType.Coin:
            path = Movie_Root_Path + "Coin_" + index;
            break;
        }
        return(path);
    }
Exemplo n.º 6
0
        protected void GvShowMovieType_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string typeID    = GvShowMovieType.DataKeys[e.RowIndex].Value.ToString();
            var    movieType = new MovieType();

            movieType.Id = Convert.ToInt32(typeID);

            var movieTypeService = new MovieTypeService();

            movieTypeService.DeteleMovieType(movieType);
            BindMovieType();
        }
        /// <summary>
        /// Получить стоимость проката за день.
        /// </summary>
        /// <param name="movie">Фильм.</param>
        /// <returns>Стоимость проката за день.</returns>
        private static double GetCostPerDay(MovieType movie)
        {
            double costPerDay = movie switch
            {
                MovieType.Regular => 1.5,
                MovieType.NewRelease => 3,
                MovieType.Childrens => 1.5,
                _ => throw new InvalidMovieTypeException(movie)
            };

            return(costPerDay);
        }
Exemplo n.º 8
0
        private dynamic MovieTypeCreate(MovieType type)
        {
            string            createMovieTypeStoredProcedure = @"up_InsertMovieType";
            DynamicParameters dynamicParameters = new DynamicParameters();

            dynamicParameters.Add("@TypeName", type.TypeName);
            using (IDbConnection conn = OpenConnection())
            {
                conn.Execute(createMovieTypeStoredProcedure, dynamicParameters, null, null, CommandType.StoredProcedure);
                return(Response.AsRedirect("/movie-type"));
            }
        }
Exemplo n.º 9
0
        public async Task <IActionResult> PutMovieType(long id, MovieType item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Exemplo n.º 10
0
        public int UpdateMovieType(MovieType movietype)
        {
            var sql        = string.Format(@"update [dbo].[MovieType] set TypeName=(@typename) where Id=(@TypeID)");
            var parameters = new List <SqlParameter>
            {
                new SqlParameter("@TypeID", movietype.Id),
                new SqlParameter("@typename", movietype.TypeName)
            };

            return(DBHelper.ExecuteCommand(sql, parameters.ToArray()));
            //throw new System.NotImplementedException();
        }
Exemplo n.º 11
0
        public void AddMovieType()    //新增
        {
            MovieType morieType = new MovieType()
            {
                TypeName = "警匪"
            };
            var result  = controller.Add(morieType) as RedirectToRouteResult;
            var addItem = db.MovieTypes.Where(t => t.TypeName == "警匪");

            Assert.AreEqual(1, addItem.Count());
            Assert.AreEqual("Index", result.RouteValues["action"]);
        }
Exemplo n.º 12
0
 public bool InsertMovieType(MovieType movieType)
 {
     try
     {
         db.MovieTypes.Add(movieType);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 13
0
        public MovieType ReaderMovieType(SqlDataReader reader)
        {
            MovieType mt = new MovieType();

            if (reader["id"] is DBNull == false)
            {
                mt.Id = Convert.ToByte(reader["id"]);
            }
            if (reader["name"] is DBNull == false)
            {
                mt.Name = Convert.ToString(reader["name"]);
            }
            return(mt);
        }
 public ActionResult MovieTypeEntry(string movieType)
 {
     if (!string.IsNullOrWhiteSpace(movieType))
     {
         MovieType m = new MovieType();
         m.MovieType1 = movieType;
         new DAL.MovieTypeDAL().InsertMovieType(m);
         return(RedirectToAction("Index", "Admin"));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 15
0
        private void ShowLeiXi()
        {
            List <MovieType> mts = bllmt.GetLeixi();
            MovieType        mt  = new MovieType()
            {
                Name = "全部",
                Id   = Convert.ToByte(0)
            };

            mts.Insert(0, mt);
            this.comboBox1.DisplayMember = "name";
            this.comboBox1.ValueMember   = "id";
            this.comboBox1.DataSource    = mts;
        }
Exemplo n.º 16
0
        private void FilldataGridView()
        {
            List <MovieType> mov = mte.GetLeixi();
            MovieType        mo  = new MovieType()
            {
                Name = "全部",
                Id   = Convert.ToByte(0)
            };

            mov.Insert(0, mo);
            this.cmbClass.DisplayMember = "name";
            this.cmbClass.ValueMember   = "id";
            this.cmbClass.DataSource    = mov;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Check for a valid TAS file and add it to the DroppedMovie array
        /// </summary>
        private DroppedMovie[] populateMovieList(string filename)
        {
            MovieType fileType = IsValid(filename);

            if (fileType != MovieType.None)
            {
                DroppedMovie[] temp = new DroppedMovie[Movies.Length + 1];
                Movies.CopyTo(temp, 0);

                temp[Movies.Length].MovieType = fileType;
                temp[Movies.Length].Movie     = LoadMovie(filename, fileType);
                return(temp);
            }
            return(null);
        }
Exemplo n.º 18
0
        public ActionResult Edit(int id)
        {
            IQueryable <Movie> movies = Movie.getMovies().AsQueryable();
            Movie movie = movies.FirstOrDefault(m => m.id == id);

            var viewModel = new MovieFormViewModel
            {
                movie     = movie,
                types     = MovieType.getTypes(),
                languages = MovieLanguage.getLanguages(),
                Watched   = MovieWatched.getWatched()
            };

            return(View("Create", viewModel));
        }
        /// <summary>
        /// Получить период, который не облагается переменной частью платы за прокат фильма.
        /// </summary>
        /// <param name="movieType">Тип фильма.</param>
        /// <returns>Период, который не облагается переменной частью платы за прокат фильма.</returns>
        private static uint GetFreePeriodInDays(MovieType movieType)
        {
            uint freePeriodInDays = movieType switch
            {
                MovieType.Regular => 2,
                MovieType.NewRelease => 0,
                MovieType.Childrens => 3,
                _ => throw new InvalidMovieTypeException(movieType)
            };

            return(freePeriodInDays);
        }

        #endregion
    }
Exemplo n.º 20
0
        /// <summary>
        /// Sets the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>MovieTypeDto.</returns>
        public static MovieTypeDto Set(this MovieType item)
        {
            if (item == null)
            {
                return(null);
            }

            return(new MovieTypeDto
            {
                MovieTypeId = item.MovieTypeId,
                Name = item.Name,
                Type = (byte)item.Type,
                Description = item.Description,
            });
        }
        public IEnumerable <Movie> GetAllMoviesByMovieTypeID(int movieTypeID)
        {
            MovieType m = this.GetMovieType(movieTypeID);

            if (m == null)
            {
                return(null);
            }

            var q = from mov in this.videoDB.Movies
                    where mov.MovieTypeID == movieTypeID
                    orderby mov.MovieID ascending
                    select mov;

            return(q);
        }
Exemplo n.º 22
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            MovieType mt = comboBox1.SelectedItem as MovieType;

            this.Text = mt.Name;
            if (mt.Id == 0)
            {
                mes = mb.GetAllMovie();
            }
            else
            {
                mes = mb.Search(mt.Id);
            }
            movieBindingSource.DataSource = mes;
            this.dataGridView1.Refresh();
        }
 public ActionResult MovieTypeEntryAjax(string movieType)
 {
     Thread.Sleep(10000);
     if (!string.IsNullOrWhiteSpace(movieType))
     {
         MovieType m = new MovieType();
         m.MovieType1 = movieType;
         new DAL.MovieTypeDAL().InsertMovieType(m);
         return(Json("Successfully Inserted", JsonRequestBehavior.AllowGet));
     }
     else
     {
         Response.StatusCode = 400;
         return(Json("Error inserting", JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 24
0
        public void DeleteMovie(int movieID, int userID, MovieType movieType)
        {
            try
            {
                string tableName;
                switch (movieType)
                {
                case (MovieType.Recommended):
                    tableName = "RecommendedMovie";
                    break;

                case (MovieType.Saved):
                    tableName = "SavedMovie";
                    break;

                case (MovieType.Watched):
                    tableName = "WatchedMovie";
                    break;

                default:
                    tableName = null;
                    break;
                }
                SqlConnection conn    = OpenConnection();
                SqlCommand    command = new SqlCommand("DELETE FROM @tableNAme WHERE MovieID = @movieID AND UserID = @userID;", conn);
                command.Parameters.Add(new SqlParameter("@movieID", movieID));
                command.Parameters.Add(new SqlParameter("@userID", userID));
                command.Parameters.Add(new SqlParameter("@tableNAme", tableName));
                command.ExecuteNonQuery();
            }
            catch (SqlException Sqle)
            {
                Console.WriteLine("Problema al cargar usuario");
                Console.WriteLine(Sqle.Message);
                //throw;
            }
            catch (Exception e)
            {
                Console.WriteLine("Problema no relacionado a Sql 2");
                Console.WriteLine(e.Message);
                //throw;
            }
            finally
            {
                CloseConnection();
            }
        }
Exemplo n.º 25
0
        public void CreateReport_ReturnCorrectReport_ForParticularMovieType(MovieType movieType, uint rentDays,
                                                                            double expectedCost, uint score)
        {
            var customer = new Customer("Foo");
            var movie    = new Movie("Bar", movieType);
            var rental   = new Rental(movie, rentDays);

            customer.AddRent(rental);

            var testMovie1 = new MovieForTest {
                Title = movie.Title, Cost = expectedCost
            };

            string expected = this.GetExpectedInfo(customer.Name, expectedCost, score, testMovie1);

            Assert.AreEqual(expected, Report.Create(customer));
        }
Exemplo n.º 26
0
        //public override bool HasAnimeMovie => false;

        public override object StoreData(bool isMovie, TempThread tempThred)
        {
            try {
                var list = TheMovieHelper.SearchQuary(activeMovie.title.name, core);
                if (!GetThredActive(tempThred))
                {
                    return(null);
                }
                ;                                                 // COPY UPDATE PROGRESS
                MovieType mType   = activeMovie.title.movieType;
                string    compare = ToDown(activeMovie.title.name, true, "");
                var       watchMovieSeasonsData = new Dictionary <int, string>();

                if (mType.IsMovie())
                {
                    //string mustContain = mType == MovieType.AnimeMovie ? "/anime-info/" : "/series/";
                    string mustContain = isMovie ? "/movie/" : "/series/";
                    TheMovieHelper.TheMovieTitle[] matching = list.Where(t => ToDown(t.name, true, "") == compare && t.season == -1 && t.href.Contains(mustContain)).ToArray();
                    if (matching.Length > 0)
                    {
                        TheMovieHelper.TheMovieTitle title = matching[0];
                        print("LOADED:::::::::-->>>1 " + title.href);

                        string d     = DownloadString(title.href);
                        int    maxEp = TheMovieHelper.GetMaxEp(d, title.href);
                        if (maxEp == 0 || maxEp == 1)
                        {
                            string rEp = title.href + "/" + (maxEp - 1); //+ "-episode-" + maxEp;
                            watchMovieSeasonsData[-1] = rEp;
                            print("LOADED:::::::::-->>>2 " + rEp);
                        }
                    }
                }
                else
                {
                    var episodes = list.Where(t => !t.isDub && t.season != -1 && ToDown(t.name, true, "") == compare && t.href.Contains("/series/")).ToList().OrderBy(t => t.season).ToArray();

                    for (int i = 0; i < episodes.Length; i++)
                    {
                        watchMovieSeasonsData[episodes[i].season] = episodes[i].href;
                    }
                }
                return(watchMovieSeasonsData);
            }
            catch { return(null); }
        }
Exemplo n.º 27
0
        protected override async Task <MediaSource> GetPlyaingVideoMediaSource()
        {
            var videoUri = VideoUrl;

            MovieType videoContentType = MovieType.Mp4;
            var       tempStream       = await HttpSequencialAccessStream.CreateAsync(
                NiconicoSession.Context.HttpClient
                , videoUri
                );

            if (tempStream is IRandomAccessStreamWithContentType)
            {
                var contentType = (tempStream as IRandomAccessStreamWithContentType).ContentType;

                if (contentType.EndsWith("mp4"))
                {
                    videoContentType = MovieType.Mp4;
                }
                else if (contentType.EndsWith("flv"))
                {
                    videoContentType = MovieType.Flv;
                }
                else if (contentType.EndsWith("swf"))
                {
                    videoContentType = MovieType.Swf;
                }
                else
                {
                    throw new NotSupportedException($"{contentType} is not supported video format.");
                }
            }

            if (videoContentType != MovieType.Mp4)
            {
                _VideoMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromStream(tempStream, false, false);
                var mss = _VideoMSS.GetMediaStreamSource();
                mss.SetBufferedRange(TimeSpan.Zero, TimeSpan.Zero);
                return(MediaSource.CreateFromMediaStreamSource(mss));
            }
            else
            {
                return(MediaSource.CreateFromStream(tempStream, (tempStream as IRandomAccessStreamWithContentType).ContentType));
            }
        }
Exemplo n.º 28
0
        public List <MovieType> GetLeixi()
        {
            List <MovieType> mts = new List <MovieType>();

            using (SqlConnection conn = new SqlConnection(SqlHelper.ConnString))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "SELECT * FROM movieType ";
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    MovieType mt = ReaderMovieType(reader);
                    mts.Add(mt);
                }
            }
            return(mts);
        }
Exemplo n.º 29
0
        public static MovieType GetMobiclipStreamType(string path)
        {
            MovieType streamType = MovieType.Unknown;

            using (FileStream fs = File.OpenRead(path))
            {
                byte[] typeBytes = ParseFile.ParseSimpleOffset(fs, 2, 2);

                if (ParseFile.CompareSegment(typeBytes, 0, MobiclipNdsStream.StreamTypeBytes))
                {
                    streamType = MovieType.NintendoDs;
                }
                else if (ParseFile.CompareSegment(typeBytes, 0, MobiclipWiiStream.StreamTypeBytes))
                {
                    streamType = MovieType.Wii;
                }
            }

            return(streamType);
        }
Exemplo n.º 30
0
        public static ICalculator GetCalculator(MovieType movieType)
        {
            switch (movieType)
            {
            case MovieType.REGULAR:
                return(new RegularMovieCalculator());

            case MovieType.NEWRELEASE:
                return(new NewReleaseMovieCalculator());

            case MovieType.CHILDRENS:
                return(new ChildrensMovieCalculator());

            case MovieType.BLURAY:
                return(new BluRayMovieCalculator());

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 31
0
        public static Price GetPriceByMovieType(MovieType value)
        {
            Price _price = null;

            switch (value)
            {
                case MovieType.CHILDRENS:
                    _price = new ChildrensPrice();
                    break;
                case MovieType.NEW_RELEASE:
                    _price = new NewReleasePrice();
                    break;
                case MovieType.REGULAR:
                    _price = new RegularPrice();
                    break;
                default:
                    throw new Exception("Incorrect Price Code");
            }

            return _price;
        }
Exemplo n.º 32
0
 /// <summary>
 /// Return a format specific object
 /// </summary>
 public TASMovie LoadMovie(string filename, MovieType fileType)
 {
     switch (fileType)
     {
         case MovieType.SMV:
             return new SNES9x(filename);
         case MovieType.FCM:
             return new FCEU(filename);
         case MovieType.GMV:
             return new Gens(filename);
         case MovieType.FMV:
             return new Famtasia(filename);
         case MovieType.VBM:
             return new VisualBoyAdvance(filename);
         case MovieType.M64:
             return new Mupen64(filename);
         case MovieType.MMV:
             return new Dega(filename);
     }
     return null;
 }
Exemplo n.º 33
0
 protected Movie(string title, MovieType movieType)
 {
     Title = title;
     MovieType = movieType;
 }
Exemplo n.º 34
0
        private string _title; //名稱

        #endregion Fields

        #region Constructors

        public Movie(string title, MovieType priceCode)
        {
            _title = title;
            PriceCode = priceCode;
        }
Exemplo n.º 35
0
 /// <summary>
 /// Create a new movie settings object with specified settings
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="type"></param>
 public MovieSettings(string filename, MovieType type)
 {
     Filename = filename;
     Format = type;
 }