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(); }