Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["kw"] == null)
            {
                Response.Redirect("./Movie.aspx");
            }
            string              kw            = Request.QueryString["kw"];
            List <actorInfo>    actorInfos    = actorServices.Query(kw);
            List <directorInfo> directorInfos = dirService.Query(kw);
            List <filmInfo>     filmInfos     = filmsService.Query(kw);
            StringBuilder       sb            = new StringBuilder();

            if (filmInfos != null || actorInfos != null || directorInfos != null)
            {
                List <int> filmList = new List <int>();
                if (filmInfos != null)
                {
                    foreach (var i in filmInfos)
                    {
                        if (filmList.IndexOf(i.filmId) == -1)
                        {
                            filmList.Add(i.filmId);
                        }
                        else
                        {
                            continue;
                        }
                        sb.Append("<div class='item-body'>");
                        sb.Append("<img src='" + i.filmPic + "' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\"/>");
                        sb.Append("<div class='item-body-container'>");
                        sb.Append("<a href='./Film.aspx?id=" + i.filmId + "'><h1>" + i.filmName + "</h1></a>");
                        sb.Append("<div class='item-ename'>" + i.filmEName + "</div>");
                        sb.Append("<div class='item-info'>");
                        sb.Append("<i>" + i.filmRating + "</i>");
                        sb.Append("<div>" + i.filmMode + "</div>");
                        sb.Append("<div>" + i.filmReleaseDate + "上映</div>");
                        sb.Append("</div></div></div>");
                    }
                }
                if (directorInfos != null)
                {
                    foreach (var d in directorInfos)
                    {
                        List <DirService.classicFilm> classics = dirService.GetClassicFilms(d.dirId);
                        foreach (var i in classics)
                        {
                            if (filmList.IndexOf(i.filmId) == -1)
                            {
                                filmList.Add(i.filmId);
                            }
                            else
                            {
                                continue;
                            }
                            sb.Append("<div class='item-body'>");
                            sb.Append("<img src='" + i.filmPic + "' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\"/>");
                            sb.Append("<div class='item-body-container'>");
                            sb.Append("<a href='./Film.aspx?id=" + i.filmId + "'><h1>" + i.filmName + "</h1></a>");
                            sb.Append("<div class='item-ename'>" + i.filmEName + "</div>");
                            sb.Append("<div class='item-info'>");
                            sb.Append("<i>" + i.filmRating + "</i>");
                            sb.Append("<div>" + i.filmMode + "</div>");
                            sb.Append("<div>" + i.filmReleaseDate + "上映</div>");
                            sb.Append("</div></div></div>");
                        }
                    }
                }
                if (actorInfos != null)
                {
                    foreach (var a in actorInfos)
                    {
                        List <ActorsService.classicFilm> classics = actorServices.GetClassicFilms(a.actorId);
                        if (classics == null)
                        {
                            break;
                        }
                        foreach (var i in classics)
                        {
                            if (filmList.IndexOf(i.filmId) == -1)
                            {
                                filmList.Add(i.filmId);
                            }
                            else
                            {
                                continue;
                            }
                            sb.Append("<div class='item-body'>");
                            sb.Append("<img src='" + i.filmPic + "' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\"/>");
                            sb.Append("<div class='item-body-container'>");
                            sb.Append("<a href='./Film.aspx?id=" + i.filmId + "'><h1>" + i.filmName + "</h1></a>");
                            sb.Append("<div class='item-ename'>" + i.filmEName + "</div>");
                            sb.Append("<div class='item-info'>");
                            sb.Append("<i>" + i.filmRating + "</i>");
                            sb.Append("<div>" + i.filmMode + "</div>");
                            sb.Append("<div>" + i.filmReleaseDate + "上映</div>");
                            sb.Append("</div></div></div>");
                        }
                    }
                }
            }
            else
            {
                sb.Append("<div class='query-error'>");
                sb.Append("<h1>很抱歉,没找到相关的电影</h1>");
                sb.Append("</div>");
            }
            filmList = sb.ToString();
            sb.Clear();
            if (actorInfos != null || filmInfos != null)
            {
                if (actorInfos != null)
                {
                    foreach (var i in actorInfos)
                    {
                        List <ActorsService.classicFilm> classics = actorServices.GetClassicFilms(i.actorId);
                        sb.Append("<div class='item-body'>");
                        sb.Append("<img src='" + i.actorPic + "' onclick=\"window.open('./Celebrity.aspx?actor=" + i.actorId + "','_self')\"/>");
                        sb.Append("<div class='item-body-container'>");
                        sb.Append("<a href='./Celebrity.aspx?actor=" + i.actorId + "'><h1>" + i.actorName + "</h1></a>");
                        sb.Append("<div class='item-ename'>" + i.actorEName + "</div>");
                        sb.Append("<div class='celebrity-info'>代表作:");
                        if (classics != null)
                        {
                            foreach (var c in classics)
                            {
                                sb.Append("《" + c.filmName + "》 ");
                            }
                        }
                        sb.Append("</div></div></div>");
                    }
                }
                if (filmInfos != null)
                {
                    foreach (var f in filmInfos)
                    {
                        List <ActorsService.actorIntroduction> actors = actorServices.GetActorIntroductions(f.filmId);
                        foreach (var i in actors)
                        {
                            List <ActorsService.classicFilm> classics = actorServices.GetClassicFilms(i.actorId);
                            sb.Append("<div class='item-body'>");
                            sb.Append("<img src='" + i.actorPic + "' onclick=\"window.open('./Celebrity.aspx?actor=" + i.actorId + "','_self')\"/>");
                            sb.Append("<div class='item-body-container'>");
                            sb.Append("<a href='./Celebrity.aspx?actor=" + i.actorId + "'><h1>" + i.actorName + "</h1></a>");
                            sb.Append("<div class='item-ename'>" + i.actorEName + "</div>");
                            sb.Append("<div class='celebrity-info'>代表作:");
                            if (classics != null)
                            {
                                foreach (var c in classics)
                                {
                                    sb.Append("《" + c.filmName + "》 ");
                                }
                            }
                            sb.Append("</div></div></div>");
                        }
                    }
                }
            }
            else
            {
                sb.Append("<div class='query-error'>");
                sb.Append("<h1>很抱歉,没找到相关的演员</h1>");
                sb.Append("</div>");
            }
            actorList = sb.ToString();
            sb.Clear();
            if (directorInfos != null || filmInfos != null)
            {
                if (directorInfos != null)
                {
                    foreach (var i in directorInfos)
                    {
                        List <DirService.classicFilm> classics = dirService.GetClassicFilms(i.dirId);
                        sb.Append("<div class='item-body'>");
                        sb.Append("<img src='" + i.dirPic + "' onclick=\"window.open('./Celebrity.aspx?director=" + i.dirId + "','_self')\"/>");
                        sb.Append("<div class='item-body-container'>");
                        sb.Append("<a href='./Celebrity.aspx?director=" + i.dirId + "'><h1>" + i.dirName + "</h1></a>");
                        sb.Append("<div class='item-ename'>" + i.dirEName + "</div>");
                        sb.Append("<div class='celebrity-info'>代表作:");
                        if (classics != null)
                        {
                            foreach (var c in classics)
                            {
                                sb.Append("《" + c.filmName + "》 ");
                            }
                        }
                        sb.Append("</div></div></div>");
                    }
                }
                if (filmInfos != null)
                {
                    foreach (var f in filmInfos)
                    {
                        DirService.dirIntroduction       i        = dirService.GetDirIntroduction(f.filmId);
                        List <ActorsService.classicFilm> classics = actorServices.GetClassicFilms(i.dirId);
                        sb.Append("<div class='item-body'>");
                        sb.Append("<img src='" + i.dirPic + "' onclick=\"window.open('./Celebrity.aspx?director=" + i.dirId + "','_self')\"/>");
                        sb.Append("<div class='item-body-container'>");
                        sb.Append("<a href='./Celebrity.aspx?director=" + i.dirId + "'><h1>" + i.dirName + "</h1></a>");
                        sb.Append("<div class='item-ename'>" + i.dirEName + "</div>");
                        sb.Append("<div class='celebrity-info'>代表作:");
                        if (classics != null)
                        {
                            foreach (var c in classics)
                            {
                                sb.Append("《" + c.filmName + "》 ");
                            }
                        }
                        sb.Append("</div></div></div>");
                    }
                }
            }
            else
            {
                sb.Append("<div class='query-error'>");
                sb.Append("<h1>很抱歉,没找到相关的导演</h1>");
                sb.Append("</div>");
            }
            dirList = sb.ToString();
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["director"] == null && Request.QueryString["actor"] == null)
            {
                Response.Redirect("./Celebrity.aspx?director=1");
            }
            int id = Request.QueryString["director"] != null?int.Parse(Request.QueryString["director"]) : int.Parse(Request.QueryString["actor"]);

            StringBuilder sb = new StringBuilder();

            if (Request.QueryString["director"] != null)
            {
                dir   = dirService.GetDirectory(id);
                actor = null;
                List <DirService.classicFilm> classicFilms = new List <DirService.classicFilm>();
                classicFilms = dirService.GetClassicFilms(id);
                if (classicFilms != null)
                {
                    foreach (var i in classicFilms)
                    {
                        if (classicFilms.IndexOf(i) >= 3)
                        {
                            break;
                        }
                        sb.Append("<div class='banner-body-classic-item' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\">");
                        sb.Append("<img src='" + i.filmPic + "' />");
                        sb.Append("<div class='banner-body-classic-item-label'>");
                        sb.Append("<span>" + i.filmName + "</span>");
                        sb.Append("</div></div>");
                    }
                }
                ClassicList = sb.ToString();
                int  count = 0;
                bool flag  = false;
                sb.Clear();
                sb.Append("<div class='container-module-body-info-row'>");
                for (int i = 0; i < 7; i++)
                {
                    if (count != 0 && count % 2 == 0 && flag)
                    {
                        flag = false;
                        sb.Append("</div>");
                        sb.Append("<div class='container-module-body-info-row'>");
                    }
                    switch (i)
                    {
                    case 0:
                        if (dir.dirAlias != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>别&emsp;&emsp;名</span>");
                            sb.Append("<div><span>" + dir.dirAlias + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 1:
                        if (dir.dirGender != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>性&emsp;&emsp;别</span>");
                            sb.Append("<div><span>" + dir.dirGender + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 2:
                        if (dir.dirCountry != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>国&emsp;&emsp;籍</span>");
                            sb.Append("<div><span>" + dir.dirCountry + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 3:
                        if (dir.dirBirthday != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>出生日期</span>");
                            sb.Append("<div><span>" + dir.dirBirthday + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 4:
                        if (dir.dirPlaceOfBirth != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>出生地点</span>");
                            sb.Append("<div><span>" + dir.dirPlaceOfBirth + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 5:
                        if (dir.dirIdentity != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>身&emsp;&emsp;份</span>");
                            sb.Append("<div><span>" + dir.dirIdentity + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 6:
                        if (dir.dirHeight != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>身&emsp;&emsp;高</span>");
                            sb.Append("<div><span>" + dir.dirHeight + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;
                    }
                }
                sb.Append("</dir>");
                InfoList = sb.ToString();
                sb.Clear();
                string current = classicFilms != null ? classicFilms[0].filmReleaseDate.Substring(0, 4) : "";
                sb.Append("<li class='layui-timeline-item'>");
                sb.Append("<i class='layui-icon layui-timeline-axis layui-icon-play'></i>");
                sb.Append("<div class='layui-timeline-content layui-text'>");
                sb.Append("<h3 class='layui-timeline-title'>" + current + "年</h3>");
                sb.Append("<div class='timeline-item-main'>");
                if (classicFilms != null)
                {
                    foreach (var i in classicFilms)
                    {
                        string currentDate = i.filmReleaseDate.Substring(0, 4);
                        if (currentDate != current)
                        {
                            current = currentDate;
                            sb.Append("</div></div></li>");
                            sb.Append("<li class='layui-timeline-item'>");
                            sb.Append("<i class='layui-icon layui-timeline-axis layui-icon-play'></i>");
                            sb.Append("<div class='layui-timeline-content layui-text'>");
                            sb.Append("<h3 class='layui-timeline-title'>" + current + "年</h3>");
                            sb.Append("<div class='timeline-item-main'>");
                        }
                        sb.Append("<div class='timeline-item-main-item' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\">");
                        sb.Append("<img src='" + i.filmPic + "'/>");
                        sb.Append("<p class='timeline-item-main-item-title'>" + i.filmName + "</p>");
                        sb.Append("<p>导演</p>");
                        sb.Append("</div>");
                    }
                }
                sb.Append("</div></div></li>");
                FilmsList = sb.ToString();
            }
            else
            {
                actor = actorsService.GetActor(id);
                dir   = null;
                List <ActorsService.classicFilm> classicFilms = new List <ActorsService.classicFilm>();
                classicFilms = actorsService.GetClassicFilms(id);
                if (classicFilms != null)
                {
                    foreach (var i in classicFilms)
                    {
                        if (classicFilms.IndexOf(i) >= 3)
                        {
                            break;
                        }
                        sb.Append("<div class='banner-body-classic-item' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\">");
                        sb.Append("<img src='" + i.filmPic + "' />");
                        sb.Append("<div class='banner-body-classic-item-label'>");
                        sb.Append("<span>" + i.filmName + "</span>");
                        sb.Append("</div></div>");
                    }
                }
                ClassicList = sb.ToString();
                int  count = 0;
                bool flag  = false;
                sb.Clear();
                sb.Append("<div class='container-module-body-info-row'>");
                for (int i = 0; i < 9; i++)
                {
                    if (count != 0 && count % 2 == 0 && flag)
                    {
                        flag = false;
                        sb.Append("</div>");
                        sb.Append("<div class='container-module-body-info-row'>");
                    }
                    switch (i)
                    {
                    case 0:
                        if (actor.actorAlias != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>别&emsp;&emsp;名</span>");
                            sb.Append("<div><span>" + actor.actorAlias + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 1:
                        if (actor.actorGender != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>性&emsp;&emsp;别</span>");
                            sb.Append("<div><span>" + actor.actorGender + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 2:
                        if (actor.actorCountry != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>国&emsp;&emsp;籍</span>");
                            sb.Append("<div><span>" + actor.actorCountry + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 3:
                        if (actor.actorBirthday != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>出生日期</span>");
                            sb.Append("<div><span>" + actor.actorBirthday + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 4:
                        if (actor.actorPlaceOfBirth != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>出生地点</span>");
                            sb.Append("<div><span>" + actor.actorPlaceOfBirth + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 5:
                        if (actor.actorIdentity != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>身&emsp;&emsp;份</span>");
                            sb.Append("<div><span>" + actor.actorIdentity + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 6:
                        if (actor.actorHeight != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>身&emsp;&emsp;高</span>");
                            sb.Append("<div><span>" + actor.actorHeight + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 7:
                        if (actor.actorAgency != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>经纪公司</span>");
                            sb.Append("<div><span>" + actor.actorAgency + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;

                    case 8:
                        if (actor.actorGraduatedSchool != null)
                        {
                            sb.Append("<div class='container-module-body-info-item'>");
                            sb.Append("<span class='container-module-body-info-title'>毕业学校</span>");
                            sb.Append("<div><span>" + actor.actorGraduatedSchool + "</span></div></div>");
                            count++;
                            flag = true;
                        }
                        break;
                    }
                }
                sb.Append("</dir>");
                InfoList = sb.ToString();
                sb.Clear();
                string current = classicFilms != null?classicFilms[0].filmReleaseDate.Substring(0, 4):"";
                sb.Append("<li class='layui-timeline-item'>");
                sb.Append("<i class='layui-icon layui-timeline-axis layui-icon-play'></i>");
                sb.Append("<div class='layui-timeline-content layui-text'>");
                sb.Append("<h3 class='layui-timeline-title'>" + current + "年</h3>");
                sb.Append("<div class='timeline-item-main'>");
                if (classicFilms != null)
                {
                    foreach (var i in classicFilms)
                    {
                        string currentDate = i.filmReleaseDate.Substring(0, 4);
                        if (currentDate != current)
                        {
                            current = currentDate;
                            sb.Append("</div></div></li>");
                            sb.Append("<li class='layui-timeline-item'>");
                            sb.Append("<i class='layui-icon layui-timeline-axis layui-icon-play'></i>");
                            sb.Append("<div class='layui-timeline-content layui-text'>");
                            sb.Append("<h3 class='layui-timeline-title'>" + current + "年</h3>");
                            sb.Append("<div class='timeline-item-main'>");
                        }
                        sb.Append("<div class='timeline-item-main-item' onclick=\"window.open('./Film.aspx?id=" + i.filmId + "','_self')\">");
                        sb.Append("<img src='" + i.filmPic + "'/>");
                        sb.Append("<p class='timeline-item-main-item-title'>" + i.filmName + "</p>");
                        sb.Append("<p>演员</p>");
                        sb.Append("</div>");
                    }
                }
                sb.Append("</div></div></li>");
                FilmsList = sb.ToString();
            }
        }