Esempio n. 1
0
        int userID = 1;//用户ID整个会话都要保存,默认没有登录,即为-1
        //public  bool isLatest;//是否显示最新评论


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Form["movieName"] != null)
                {
                    string message = Request.Form["movieName"];

                    //Response.Write(message);

                    Session["MovieNameToMovieDetails"] = message;
                }
            }


            movieName = Convert.ToString(Session["MovieNameToMovieDetails"]);



            Session["MovieOnShow"] = movieName;
            //*******************************************************************************
            //注意,一定要将这两个量写在if判断的外面,否则每次点击按钮后变16-17行设置的默认值
            //movieName=Session["MovieName"];
            //userID=Session["UserID"];
            //*******************************************************************************
            if (!IsPostBack)
            {
                //HyperLinkBack.NavigateUrl = "~/Main.aspx";
                //得到前页面的电影名
                //movieName = Convert.ToString(Session["MovieNameToDetail"]);
                //将电影名绑定到控件
                LabelMovieName.Text = movieName;

                //根据电影名得到电影对象,从而获取电影详细信息

                MOVIE movie = movieBll.GetMovie(movieName);
                LabelRank.Text    = movie.rank.ToString() + "分";
                LabelRankNum.Text = "已有" + movie.rank_number.ToString() + "人打分";
                //跳转到buy_list
                //HyperLinkBuy.NavigateUrl = "~/";
                //根据电影名得到电影海报的路径
                // ImageMapMovie.ImageUrl = movieBll.GetPicture(movieName);
                string moviePicture = string.Empty;
                moviePicture = movieBll.GetMoviePicture(movieName);
                //绑定电影图片到控件
                ImageMovieDetail.ImageUrl = moviePicture;

                //根据电影名 得到电影的详细信息
                LabelMovieDetails.Text = movie.introduction;

                //根据电影院名得到电影院最新评论列表,默认显示最新列表
                //isLatest = true;
                List <Comment> comment = movieBll.GetLatestComments(movieName);
                //CommentGridView.DataSource = comment;
                //CommentGridView.DataBind();
                DisplayMovieComment(comment);
                //设置返回前页链接
            }
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     movieName = (string)Session["MovieNameToMovieComment"];
     userID    = (int)Session["UserID"];
     if (!IsPostBack)
     {
         LabelMovieName.Text = movieName;
         MOVIE movie = movieBll.GetMovie(movieName);
         LabelRank.Text    = movie.rank.ToString() + "分";
         LabelRankNum.Text = "已有" + movie.rank_number.ToString() + "人打分";
         string moviePicture = string.Empty;
         moviePicture = movieBll.GetMoviePicture(movieName);
         //绑定电影图片到控件
         ImageMovieDetail.ImageUrl = moviePicture;
         LabelMovieDetails.Text    = movie.introduction;
     }
 }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断是否登录
            if (Request.Cookies["UserEmail"] == null)
            {
                Response.Write("<div class='msgboxbg'>" + "<div class='mainmsgbox'>" + "<div class='msgcon'>您还没有登录,请先登录!</div>" + " <a href='LogIn.aspx'> <div class='tip'>返回</div></a>" + " </div></div></div>");
            }
            else
            {
                //获取登录状态 email标志
                string  GetEmail   = Request.Cookies["UserEmail"].Value;
                UersBLL newUserBll = new UersBLL();
                //获取ID值
                int userID = newUserBll.GetUserId(GetEmail);

                //MessageBox.Show(userID.ToString());
                if (userID >= 0)
                {
                    List <MOVIE> movies = new List <MOVIE>();
                    movies = newUserBll.GetcollectionByUserId(userID);


                    int pageNum = movies.Count() / 9;
                    int pageAdd = ((movies.Count()) % 9 != 0) ? 1 : 0;
                    pageNum += pageAdd;



                    string pageHtml = "<div class='slides_container'>";
                    //foreach (MOVIE movie in movies)
                    //{
                    //  Response.Write(movie.actor);
                    //根据数据计算具体的页数
                    //int pageNum = 45;
                    int   index = 0;
                    MOVIE movie = new MOVIE();
                    for (int j = 0; j < pageNum; j++)
                    {
                        int pageMax = 9;
                        //if (j <= pageNum )
                        //{
                        //    pageMax = 9;
                        //}
                        //else
                        //{
                        //     pageMax = movies.Count() % 9;
                        //}
                        string singlePageHtml = "";


                        for (int i = 0; i < pageMax; i++)
                        {
                            if (index < movies.Count())
                            {
                                movie = movies.ElementAt(index);
                                index++;
                            }
                            else
                            {
                                break;
                            }
                            string moviePicture = _movieBll.GetMoviePicture(movie.name);

                            singlePageHtml += FormHtml(moviePicture,
                                                       movie.name, Convert.ToInt32(movie.rank_number),
                                                       movie.director, movie.actor);
                        }
                        pageHtml += FormPageFrame(singlePageHtml);
                    }

                    pageHtml += "</div>"
                                + FormPagePoint(pageNum) + "";
                    // Response.Write(pageHtml);
                    //MessageBox.Show(pageHtml);
                    Response.Write(pageHtml);

                    //  writeToHtml(pageHtml);
                    //}
                    //MessageBox.Show(movies.Count().ToString());
                }
                else
                {
                    Response.Write("<div class='msgboxbg'>" + "<div class='mainmsgbox'>" + "<div class='msgcon'>用户不存在!</div>" + " <a href='LogIn.aspx'> <div class='tip'>重新填写</div></a>" + " </div></div></div>");
                }
            }
        }