public Movie GetMovie(int id) { MovieData movieData = movieDS.GetDataById(id); Movie movie = Mapper.Map <Movie>(movieData); return(movie); }
public static MovieData MovieDataFromCsv(string csvLine) { string[] values = csvLine.Split(','); if (values.Count() > 6) { values = Regex.Split(csvLine, ",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))"); } try{ MovieData movieData = new MovieData(); movieData.id = Convert.ToInt32(values[0]); movieData.movieId = Convert.ToInt32(values[1]); movieData.title = Convert.ToString(values[2]); movieData.language = Convert.ToString(values[3]); movieData.duration = Convert.ToString(values[4]); movieData.releaseYear = Convert.ToInt32(values[5]); return(movieData); } catch (Exception ex) { return(new MovieData() { id = -1 }); } }
protected override void Seed(AWO_Team14.DAL.AppDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. GenreData AddGenres = new GenreData(); AddGenres.SeedGenres(context); MovieData AddMovies = new MovieData(); AddMovies.SeedMovies(context); //seed employees EmployeeData AddEmployees = new EmployeeData(); AddEmployees.SeedEmployees(context); //seed customers //CustomerData AddCustomers = new CustomerData(); //AddCustomers.SeedCustomers(context); //UserData AddUsers = new UserData(); //AddUsers.SeedUsers(context); SeedIdentity si = new SeedIdentity(); si.AddAdmin(context); }
static void Main(string[] args) { //Important stuffs var mD = new MovieData(); // Just something pleasant :) Console.WriteLine("This can take at least 30m. Are you sure?(y/n)"); if (Console.ReadLine().Equals("y")) { Console.WriteLine("This is gonna compute for a very long time, you should go and do another task."); //This part is for method #9 } else { Console.WriteLine("Have a nice day :)"); } Console.WriteLine("In order to execute the method, you need to type a number"); int number = Convert.ToInt32(Console.ReadLine()); foreach (var item in mD.GetTopGradeMovies(number)) { Console.WriteLine(item); } Console.ReadLine(); }
// GET: api/Movie/Get/5 public MovieData Get(Guid id) { MovieData movie = new MovieData(); using (MoviesDB db = new MoviesDB()) { Movies movieFromDb = db.Movies.Where(x => x.Id == id).FirstOrDefault(); List <Genres> genres = db.Genres1.Where(x => x.MovieId == id).ToList(); List <StreamSources> streamSources = db.StreamSources1.Where(x => x.MovieId == id).ToList(); movie.Id = movieFromDb.Id; movie.Title = movieFromDb.Title; movie.Cast = movieFromDb.Cast; movie.Country = movieFromDb.Country; movie.CoverPath = movieFromDb.CoverPath; movie.Dabing = movieFromDb.Dabing; movie.Description = movieFromDb.Description; movie.Director = movieFromDb.Director; movie.Lenght = movieFromDb.Lenght; movie.OriginalTitle = movieFromDb.OriginalTitle != null ? movieFromDb.OriginalTitle : movieFromDb.Title; movie.ReleaseDate = movieFromDb.ReleaseDate; foreach (var genre in genres.Where(n => n.MovieId == movieFromDb.Id)) { movie.Genres.Add(genre.GenreType); } foreach (var source in streamSources.Where(n => n.MovieId == movieFromDb.Id)) { movie.StreamSources.Add(source.Source); } } return(movie); }
public List <MovieData> ReadMovieList(string fileName) { var movieList = new List <MovieData>(); using (var reader = new StreamReader(fileName)) { string line = ""; reader.ReadLine(); // throw away header line while ((line = reader.ReadLine()) != null) { var movieData = new MovieData(); string[] values = line.Split(','); movieData.Title = values[0]; int parseInt; if (int.TryParse(values[1], out parseInt)) { movieData.Year = parseInt; } if (int.TryParse(values[2], out parseInt)) { movieData.RTScore = parseInt; } if (int.TryParse(values[3], out parseInt)) { movieData.BoxOfficeGross = parseInt; } movieList.Add(movieData); } } return(movieList); } //End of ReadMovieList()
public ActionResult Edit(int id) { var db = new MovieData(); var review = db.Reviews.Find(id); return(View(review)); }
public IActionResult Index() { MovieData movieData = new MovieData(); movieList = movieData.GetMovieList(); return(View(movieList)); }
public ActionResult metaData(MovieData content) { //Convert the Model to a string to output //if saving this to a Database ideally would //be using something like EntityFramework string test = string.Concat(content.movieId + "," + content.title + "," + content.language + "," + content.duration + "," + content.duration ); try{ //Open the Streamreader for the local file - boolean added to allow amendments to the Database.txt using (StreamWriter Database = new StreamWriter("Database.txt", true)) { //Write the new entry out to the Database.txt file Database.WriteLine(test); } //return success if able to write successfully return(Ok("Movie Successfull Save")); } catch { //return failed if request failed. return(BadRequest("Failed to add Movie to Database")); } }
public MovieData Create(MovieData newMovie) { _context.Add(newMovie); _context.SaveChanges(); _cacheHelper.RemoveFromCache(ALL_MOVIES); return(newMovie); }
public ActionResult Index(string search, string genre) { var searchFilter = _movieRepository.GetMoviesByTitle(search); var genreFilter = _movieRepository.GetMoviesByGenre(genre); var viewModel = new MovieData { Movies = _movieRepository.GetMovies(), GenreList = _genreRepository.GetGenreNames() }; if (!string.IsNullOrEmpty(search)) { viewModel.Movies = searchFilter; } if (!string.IsNullOrEmpty(genre)) { viewModel.Movies = genreFilter; } if (!string.IsNullOrEmpty(search) && !string.IsNullOrEmpty(genre)) { viewModel.Movies = searchFilter.Intersect(genreFilter).ToList(); } return(View(viewModel)); }
protected void Page_Load(object sender, EventArgs e) { MovieUtilities mu = new MovieUtilities(); Repeater1.DataSource = mu.SelectAll(); Repeater1.DataBind(); string id; try { if (Request.QueryString["id"].ToString() != null) { id = Request.QueryString["id"].ToString(); } else { id = "1"; } MovieData md = new MovieData(); GridView1.DataSource = md.getMoviesById(Convert.ToInt32(id)); GridView1.DataBind(); } catch { } }
public IHttpActionResult MovieSubmit(MovieData model) { try { var currentDate = DateTime.Now; if (model.MovieId > 0) { _dataSource.Update(model); } else { var isExists = _dataSource.GetAllData().Any(x => x.Title.ToUpper() == model.Title.ToUpper()); if (isExists) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, "Movie title already exist."))); } _dataSource.Create(model); } return(Ok()); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }
/// <summary> /// 绘制界面 /// </summary> public override void OnInspectorGUI() { if (movieItem == null) { movieItem = target as MovieData; keys = new List <string>(); foreach (var item in movieItem.replaceDict) { keys.Add(item.Key); } } EditorGUILayout.Separator(); EditorGUILayout.BeginVertical("Box"); DrawCutscene(); DrawReplay(); CheckOut(movieItem); EditorGUILayout.EndVertical(); if (isShowdic ? GUILayout.Button(noShowdic) : GUILayout.Button(showdic)) { isShowdic = !isShowdic; } if (isShowdic) { base.OnInspectorGUI(); } }
public void CheckOut(MovieData movieItem) { if (GUILayout.Button("播放")) { movieItem.cutscene.Play(); } replaceobj = EditorGUILayout.ObjectField("replaceobj:", replaceobj, typeof(GameObject), true) as GameObject; if (GUILayout.Button("替换资源")) { movieItem.ReplaceObj("player", replaceobj); } if (GUILayout.Button("生成导出数据资源")) { movieItem.SetMovieReplaceInfos(); } if (GUILayout.Button("导出资源")) { Debug.Log("导出资源"); List <string> paths = new List <string>(); string[] strAtrr = Application.dataPath.Split('/'); string projectName = strAtrr[strAtrr.Length - 2]; GameObject go = movieItem.gameObject; // 确认打包数据抽取 exportPackage(projectName, go, paths, true); } }
//Bind movie details on selection changed private void ddlMovie_SelectedIndexChanged(object sender, EventArgs e) { try { // get "movie id" here int MovieId = int.Parse(ddlMovie.SelectedValue.ToString()); if (MovieId > 0) { MovieData data = new MovieData(); data = new MovieAction().GetMoviesInfo(MovieId); if (data != null) { txtGenre.Text = data.Genre; txtRating.Text = data.Rating.ToString(); txtTitle.Text = data.Title; txtRentedCost.Text = data.RentCost.ToString(); txtYear.Text = data.Year; btnAddMOvie.Enabled = false; // disable Add movie button } } else { //MessageBox.Show("Test"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public IActionResult UpdateMovie(long id, [FromBody] JsonPatchDocument <MovieData> patch) { Movie movie = context.Movies .Include(m => m.Studio) .First(m => m.MovieId == id); MovieData mdata = new MovieData { Movie = movie }; patch.ApplyTo(mdata, ModelState); if (ModelState.IsValid && TryValidateModel(mdata)) { if (movie.Studio != null && movie.Studio.StudioId != 0) { context.Attach(movie.Studio); } context.SaveChanges(); return(Ok(movie)); } else { return(BadRequest(ModelState)); } }
public MovieController() { MovieData objMovie = new MovieData(); movieViewModel.MovieList = objMovie.Getata(); movies = objMovie.Getata();; }
public void UpdateMovie(int id, string title, string director) { Movie MovieToUpdate = new Movie(id, title, director); MovieData md = new MovieData(); md.MovieUpdate(MovieToUpdate); }
public static ObservableCollection <MovieData> GetAllImages() { ObservableCollection <MovieData> result = new ObservableCollection <MovieData>(); try { using (var connection = new SQLiteConnection(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\" + DB_NAME)) { var statement = connection.Prepare("SELECT * FROM " + "Images"); while (!(SQLiteResult.DONE == statement.Step())) { if (statement[0] != null) { MovieData movie = new MovieData(); movie.id = Convert.ToInt32(statement["Id"]); movie.Title = statement["Title"].ToString(); movie.ImageData = (Windows.UI.Xaml.Media.Imaging.BitmapImage)statement["ImageData"]; result.Add(movie); } } return(result); } } catch (Exception ex) { Debug.WriteLine(ex.Message); return(null); } }
protected override void Seed(sp18Team7Final.DAL.AppDbContext context) { GenreData AddGenres = new GenreData(); AddGenres.SeedGenres(context); MovieData AddMovies = new MovieData(); AddMovies.SeedMovies(context); Customers AddCustomers = new Customers(); AddCustomers.SeedCustomers(context); Employees AddEmployees = new Employees(); AddEmployees.SeedEmployees(context); MovieSchedule SeedShowtimes = new MovieSchedule(); SeedShowtimes.SeedShowtimes(context); PricingData SeedPrices = new PricingData(); SeedPrices.SeedPrices(context); }
IEnumerator GetJsonText() { UnityWebRequest www = UnityWebRequest.Get(jsonURL); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log(www.downloadHandler.text); MovieData movieData = JsonUtility.FromJson <MovieData>(www.downloadHandler.text); dataDisplayer.DisplayJsonData(movieData); if (movieData.Poster != "") { imgURL = movieData.Poster; StartCoroutine(GetPoster()); } } }
public static void GetMovieData(ref Dictionary <string, MovieData> __result) { foreach (var movie in allTheMovies.Values) { if (__result.Exists(d => d.Value.Tags.Contains("CMovieID:" + movie.Id))) { if (__result.Find(d => d.Value.Tags.Contains("CMovieID:" + movie.Id)) is KeyValuePair <string, MovieData> md && !PyTK.PyUtils.checkEventConditions(movie.Conditions, Game1.MasterPlayer)) { __result.Remove(md.Key); } continue; } if (!PyTK.PyUtils.checkEventConditions(movie.Conditions, Game1.MasterPlayer)) { continue; } if (movie.FixedMovieID != null) { MovieData fixedData = movie.GetFixedData(); fixedData.ID = movie.FixedMovieID; __result.AddOrReplace(fixedData.ID, fixedData); continue; } } }
/// <summary> /// Updates the movie based on movie ID /// <para>Object of Movie Data and Associated MovieID to update data to</para> /// </summary> /// <returns>Nothing/Void</returns> public void UpdateMovie(MovieData movieData, int movieId) { try { MovieData movie = access.GetDataById(movieId); if (movie != null) { if (movieData.Cast == null && movieData.Classification == null && movieData.Genre == null && movieData.Rating == 0 && movieData.ReleaseDate == 0 && movieData.Title == null) { //Please input some Data //Update all data to null or 0 is not valid data //We can also raise a fault Expection Here //In Case Cast is empty still insert } else { movie.Rating = movieData.Rating; movie.ReleaseDate = movieData.ReleaseDate; movie.Title = movieData.Title; movie.Genre = movieData.Genre; movie.Classification = movieData.Classification; movie.Cast = movieData.Cast; access.UpdateMovie(movie); } } } catch (Exception ex) { LogErrorDetails(ex.Message, "UpdateMovie", ex.InnerException.ToString()); throw new ApplicationException("Error occured while getting data!"); } finally { } }
/// <summary> /// Insert a movie Record in the DataBase /// <para>Object of Movie Data</para> /// </summary> /// <returns>Nothing/Void</returns> public void InsertMovie(MovieData movieData) { try { if (movieData != null) { if (movieData.Cast == null || movieData.Classification == null || movieData.Genre == null || movieData.Rating == 0 || movieData.ReleaseDate == 0 || movieData.Title == null) { //Please input the Data //We can also raise a fault Expection Here //In Case Cast is empty still insert } else { access.InsertMovie(movieData); } } } catch (Exception ex) { LogErrorDetails(ex.Message, "InsertMovie", ex.InnerException.ToString()); throw new ApplicationException("Error occured while getting movies"); } finally { //Dispose unwanted objects here } }
protected override void Seed(MIS333K_Team11_FinalProjectV2.Models.AppUser.AppDbContext context) { // This method will be called after migrating to the latest version. GenreData AddGenres = new GenreData(); AddGenres.SeedGenres(context); MovieData AddMovies = new MovieData(); AddMovies.SeedMovies(context); ManagerData md = new ManagerData(); md.AddManager(context); CustomerData cd = new CustomerData(); cd.AddCustomer(context); EmployeeData ed = new EmployeeData(); ed.AddEmployee(context); // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. }
protected override void Seed(LonghornCinemaFinalProject.DAL.AppDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. MoviePriceData AddMoviePrices = new MoviePriceData(); AddMoviePrices.SeedMoviePrice(context); MovieData AddMovies = new MovieData(); AddMovies.SeedMovies(context); ShowingData AddShowings = new ShowingData(); AddShowings.SeedShowings(context); SeedIdentity Seed = new SeedIdentity(); Seed.AddAdmin(context); UserData AddUsers = new UserData(); AddUsers.SeedUsers(context); }
/// <summary> /// Initializes a new instance of the MovieInfo class. /// </summary> /// <param name="dataSet">Updated dataset.</param> /// <param name="data">MovieData to add to XML.</param> public static void AddRow(DataSet dataSet, MovieData data) { if (dataSet.Tables.Count == 0) { DataTable dt = new DataTable(); // Create empty (for now) table. dt.TableName = "Movies"; // Table name dt.Columns.Add("Name"); dt.Columns.Add("Year"); dt.Columns.Add("Origin"); dt.Columns.Add("Rating"); dt.Columns.Add("Votes"); dataSet.Tables.Add(dt); DataRow row = dataSet.Tables["Movies"].NewRow(); row["Name"] = data.Name; row["Year"] = data.Year; row["Origin"] = data.Origin; row["Rating"] = data.Rating; row["Votes"] = data.Votes; dataSet.Tables["Movies"].Rows.Add(row); } else { DataRow row = dataSet.Tables["Movies"].NewRow(); row["Name"] = data.Name; row["Year"] = data.Year; row["Origin"] = data.Origin; row["Rating"] = data.Rating; row["Votes"] = data.Votes; dataSet.Tables["Movies"].Rows.Add(row); } }
public static MovieData SetMovieDetails(MovieData movieData) { if (movieData.ImdbUrl.IsNotNullOrWhiteSpace()) { var queryHtmlResult = GetHtmlPageData(string.Format("http://{0}", movieData.ImdbUrl)); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(queryHtmlResult); Helpers.TryCatch(() => movieData.ImdbName = doc.DocumentNode.SelectSingleNode(@"//span[@itemprop='name']").InnerText.Trim()); Helpers.TryCatch(() => movieData.Rating = doc.DocumentNode.SelectSingleNode(@"//span[@itemprop='ratingValue']").InnerText.Trim()); Helpers.TryCatch(() => movieData.ImageUrl = doc.DocumentNode.SelectSingleNode(@"//img[@itemprop='image']").Attributes["src"].Value.Trim()); Helpers.TryCatch(() => movieData.Year = doc.DocumentNode.SelectSingleNode(@"//h1[@class='header']/span[@class='nobr']/a").InnerText.Trim()); Helpers.TryCatch(() => doc.DocumentNode.SelectSingleNode(@"//div[@itemprop='description']/p/em").Remove()); Helpers.TryCatch(() => movieData.StoryLine = doc.DocumentNode.SelectSingleNode(@"//div[@itemprop='description']/p").InnerText.Trim()); Helpers.TryCatch(() => { var genreNodes = doc.DocumentNode.SelectNodes(@"//div[@itemprop='genre']/a"); movieData.Genres = new List <string>(); foreach (var node in genreNodes) { movieData.Genres.Add(node.InnerText.Trim()); } }); } return(movieData); }
public async Task <IActionResult> Post(Resources.Movie movieData) { Movie movie = _mapper.Map <Movie>(movieData); await movieRepository.Create(movie); await unitOfWork.CompleteAsync(); movieData.IdMovie = movie.IdMovie; MovieData data = _mapper.Map <MovieData>(movieData); data = await movieDataRepository.Create(data); await unitOfWork.CompleteAsync(); foreach (var genre in movieData.Genres) { await genreRepository.Create(new MovieDataGenre(data.IdMovieData, genre.Id)); } foreach (var language in movieData.Languages) { await languageRepository.Create(new MovieDataLanguage(data.IdMovieData, language.Id)); } await unitOfWork.CompleteAsync(); return(Ok(_mapper.Map <Resources.Movie>(data))); }
public Movie(MovieData movieData) { if (movieData != null) { this.Id = movieData.MovieId; this.Title = movieData.Title; this.Genre = movieData.Genre; this.Classification = movieData.Classification; this.Rating = movieData.Rating; this.ReleaseYear = movieData.ReleaseDate; this.Cast = movieData.Cast; } }
private void BinkConvertToTexture (MovieData movie) { switch (Type) { case BinkPluginType.CPUTexture: Bink.BinkCopyToBuffer (Movie.Bink, m_PixelsHandle.AddrOfPinnedObject (), m_Texture.width * 4, (uint)m_Texture.height, 0, 0, Bink.BINKSURFACE32RA | Bink.BINKNOSKIP); m_Texture.SetPixels32 (m_Pixels, 0); m_Texture.Apply (); break; case BinkPluginType.GPUTexture: if (usingOpenGL()) { BindTextureToBinkFrame (Movie.Bink, m_yTexture.GetNativeTextureID (), m_cBTexture.GetNativeTextureID (), m_cRTexture.GetNativeTextureID (), UseAlpha ? m_aTexture.GetNativeTextureID () : -1, Bink.BINKSURFACE32RA, m_yTexture.width, m_yTexture.height); } break; default: UnityEngine.Debug.LogError (String.Format ("BinkConvertToTexture called with unsupported Type {0}", Type.ToString ())); break; } }