Ejemplo n.º 1
0
        public static bool saveMovie(string url)
        {
            bool success = false;
            MovieSpider ms = new MovieSpider();
            string html = File.ReadAllText(url);
            int movieID = ms.getMovieID(url);
            string movieName = ms.getMovieName(html);
            string coverURL = ms.getCoverURL(html);
            string director = ms.getDirector(html);
            string protagonist = ms.getProtagonist(html);
            string movieType = ms.getMovieType(html);
            DateTime releaseDate = ms.getReleaseDate(html);
            string runTime = ms.getRunTime(html);

            Movie movie = new Movie()
            {
                MovieID = movieID,
                MovieName = movieName,
                CoverURL = coverURL,
                Director = director,
                Protagonist = protagonist,
                Type = movieType,
                ReleaseDate = releaseDate,
                RunTime = runTime
            };

            IDAL.IMovie movieDal = DALFactory.DataAccess.createDalMovie();
            if (movieDal.getMovieById(movieID) == null)
            {
                success = movieDal.addMovie(movie);
            }
            return success;
        }
Ejemplo n.º 2
0
        private void addMovie(object sender, RoutedEventArgs e)
        {
            Movie movie = new Movie();
            movie.Title = titleText.Text;
            movie.Synopsis = synopsisText.Text;
            int year;
            if (int.TryParse(yearText.Text, out year)) {
                movie.Year = year;
            } else
            {
                movie.Year = 0;
            }

            repo.Add(movie);

            refreshListBox();
        }
Ejemplo n.º 3
0
        protected void btn_tianJia_Click(object sender, EventArgs e)
        {
            Model.Movie movie  = new Model.Movie();
            string      name   = m_name.Text.Trim();
            string      direct = m_direct.Text.Trim();
            string      star   = m_star.Text.Trim();
            string      state  = m_state.Text.Trim();
            string      voice  = ddl_voice.Text.ToString();
            string      type   = getType();
            double      grade  = Convert.ToSingle(m_grade.Text.Trim());
            string      detail = txtarea.Value.ToString();
            string      time   = m_time.Value;
            int         minute = int.Parse(m_minute.Text.Trim());

            // string
            //Utility.JavaScript.Alert(grade.ToString()+time, this);
            if (File1.HasFile)
            {
                int length = File1.PostedFile.ContentLength;

                Stream s   = File1.PostedFile.InputStream;
                byte[] bts = new byte[length];
                s.Read(bts, 0, length);
                //string str = Encoding.Default.GetString(bts);
                //Utility.JavaScript.Alert(str,this);
                movie.M_name   = name;
                movie.M_direct = direct;
                movie.M_star   = star;
                movie.M_state  = state;
                movie.M_voice  = voice;
                movie.M_type   = type;
                movie.M_grade  = grade;
                movie.M_detail = detail;
                movie.M_time   = time;
                movie.M_minute = minute;
                movie.M_image  = bts;
                if (BLL.MovieManage.InsertMovie(movie))
                {
                    Utility.JavaScript.Alert("添加成功", this);
                }
            }
        }
Ejemplo n.º 4
0
 private static void addMovie()
 {
     Console.WriteLine();
     Movie movie = new Movie();
     Console.WriteLine();
     Console.WriteLine("Add what movie? (Title)");
     movie.Title = getInput();
     Console.WriteLine();
     Console.WriteLine("Enter movie synopsis:");
     movie.Synopsis = getInput();
     Console.WriteLine();
     Console.WriteLine("What year was the movie made?");
     try {
         movie.Year = int.Parse(getInput());
     }
     catch
     {
         movie.Year = 0;
     }
     repo.Add(movie);
     Console.WriteLine();
     // Echos movie ID for reference and confirmation
     Console.WriteLine("'" + movie.Title + "' added. ID is: " + repo.GetByTitle(movie.Title).ID);
 }