private string BuildSurveyResultsTable(int surveyid) { try { StringBuilder sb = new StringBuilder(); ISurveyRepository srep = new EntitySurveyRepository(); Survey survey = srep.GetSurvey(surveyid); if (survey == null) return String.Empty; // Get the answered surveys IAnsweredSurveyRepository answeredsurveyrespository = new EntityAnsweredSurveyRepository(); IEnumerable<AnsweredSurvey> answeredsurveys = answeredsurveyrespository.GetBySurveyID(surveyid); sb.AppendLine("<table style=\"border-spacing:0;border-collapse:collapse;\" class=\"surveytable\">"); sb.AppendLine("<tr class=\"surveyrow\">"); sb.AppendLine("<td class=\"gridtext\">" + survey.SurveyName + "</td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:100px;\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:100px;\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:100px;\"></td>"); sb.AppendLine("</tr>"); sb.AppendLine("<tr class=\"surveysubheadrow\">"); sb.AppendLine("<td class=\"gridtext\">Total Answered Survey Count: " + answeredsurveys.Count().ToString() + "</td>"); sb.AppendLine("<td class=\"gridtext\" colspan=\"2\">Selected</td>"); sb.AppendLine("<td class=\"gridtext\" colspan=\"2\">Deselected</td>"); sb.AppendLine("<td class=\"gridtext\" colspan=\"2\">Unanswered</td>"); sb.AppendLine("</tr>"); // Loop through each question and question option ISurveyQuestionRepository qrep = new EntitySurveyQuestionRepository(); ISurveyQuestionOptionRepository orep = new EntitySurveyQuestionOptionRepository(); IAnsweredSurveyQuestionOptionRepository aorep = new EntityAnsweredSurveyQuestionOptionRepository(); List<SurveyQuestion> questions = qrep.GetSurveyQuestions(survey.SurveyID).ToList(); foreach (SurveyQuestion question in questions) { sb.AppendLine("<tr class=\"questionrow\">"); sb.AppendLine("<td class=\"gridtext\">" + question.SurveyQuestionText + "</td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("</tr>"); // Loop through each question option List<SurveyQuestionOption> options = orep.GetSurveyQuestionOptions(question.SurveyQuestionID).ToList(); foreach (SurveyQuestionOption option in options) { // Add the number of selected/unselected double selectedcount = 0; double deselectedcount = 0; double unansweredcount = 0; IEnumerable<AnsweredSurveyQuestionOption> aoptions = aorep.GetBySurveyQuestionOptionId(option.SurveyQuestionOptionID); foreach (AnsweredSurveyQuestionOption aoption in aoptions) { if (aoption.IsSelected) selectedcount += 1.0; else deselectedcount += 1.0; } unansweredcount = Convert.ToDouble(answeredsurveys.Count()) - selectedcount - deselectedcount; int selectedwidth = 0; int deselectedwidth = 0; int unansweredwidth = 0; if (answeredsurveys.Count() > 0) { selectedwidth = Convert.ToInt32((selectedcount / Convert.ToDouble(answeredsurveys.Count())) * 90); deselectedwidth = Convert.ToInt32((deselectedcount / Convert.ToDouble(answeredsurveys.Count())) * 90); unansweredwidth = Convert.ToInt32((unansweredcount / Convert.ToDouble(answeredsurveys.Count())) * 90); } sb.AppendLine("<tr class=\"optionrow\">"); sb.AppendLine("<td class=\"gridtext\" style=\"padding-left:15px;\">" + option.SurveyQuestionOptionText + "</td>"); sb.AppendLine("<td class=\"gridtext\">" + selectedcount.ToString() + "</td>"); sb.AppendLine("<td class=\"gridtext\">"); sb.Append(@"<div style=""width:" + selectedwidth.ToString() + @"px;height:8px;background-color:#00CC00;"" /> "); sb.AppendLine("</td>"); sb.AppendLine("<td class=\"gridtext\">" + deselectedcount.ToString() + "</td>"); sb.AppendLine("<td class=\"gridtext\">"); sb.Append(@"<div style=""width:" + deselectedwidth.ToString() + @"px;height:8px;background-color:#0000CC;"" /> "); sb.AppendLine("<td class=\"gridtext\">" + unansweredcount.ToString() + "</td>"); sb.AppendLine("<td class=\"gridtext\">"); sb.Append(@"<div style=""width:" + unansweredwidth.ToString() + @"px;height:8px;background-color:#CC0000;"" /> "); sb.AppendLine("</td>"); sb.AppendLine("</tr>"); } } sb.Append("</table>"); return sb.ToString(); } catch { return String.Empty; } }
private string BuildSurveyTableNoLinks(Survey survey) { try { StringBuilder sb = new StringBuilder(); string root = Request.Url.OriginalString.Substring(0, Request.Url.OriginalString.ToLower().LastIndexOf("/survey/")); if (!root.EndsWith("/")) root += "/"; sb.AppendLine("<table style=\"border-spacing:0;border-collapse:collapse;\" class=\"surveytable\">"); sb.AppendLine("<tr class=\"surveyrow\">"); sb.AppendLine("<td class=\"gridtext\">" + survey.SurveyName + "</td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:110px;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:25px;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:45px;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:35px;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"width:55px;\"></td>"); sb.AppendLine("</tr>"); // Loop through each question and question option ISurveyQuestionRepository qrep = new EntitySurveyQuestionRepository(); ISurveyQuestionOptionRepository orep = new EntitySurveyQuestionOptionRepository(); List<SurveyQuestion> questions = qrep.GetSurveyQuestions(survey.SurveyID).ToList(); foreach (SurveyQuestion question in questions) { sb.AppendLine("<tr class=\"questionrow\">"); string selectionmode = " (Single Select)"; if (question.AllowMultiSelect) selectionmode = " (Multi Select)"; sb.AppendLine("<td class=\"gridtext\">" + question.SurveyQuestionText + selectionmode + "</td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("</tr>"); // Loop through each question option List<SurveyQuestionOption> options = orep.GetSurveyQuestionOptions(question.SurveyQuestionID).ToList(); foreach (SurveyQuestionOption option in options) { sb.AppendLine("<tr class=\"optionrow\">"); sb.AppendLine("<td class=\"gridtext\" style=\"padding-left:15px;\">" + option.SurveyQuestionOptionText + "</td>"); sb.AppendLine("<td class=\"gridtext\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("<td class=\"gridtext\" style=\"text-align:center;\"></td>"); sb.AppendLine("</tr>"); } } sb.Append("</table>"); return sb.ToString(); } catch { return String.Empty; } }
public string Player_GetCurrentSchedule(int playerid) { try { IImageRepository imagerep = new EntityImageRepository(); IPlayerRepository playerrep = new EntityPlayerRepository(); IPlayerGroupScheduleRepository playergroupschedulerep = new EntityPlayerGroupScheduleRepository(); IPlayListRepository playlistrep = new EntityPlayListRepository(); IPlayListVideoXrefRepository playlistvideoxrefrep = new EntityPlayListVideoXrefRepository(); IScreenScreenContentXrefRepository screenscreencontentxrefrep = new EntityScreenScreenContentXrefRepository(); IScreenContentRepository screencontentrep = new EntityScreenContentRepository(); IScreenContentTypeRepository screencontenttyperep = new EntityScreenContentTypeRepository(); IScreenRepository screenrep = new EntityScreenRepository(); ISlideShowRepository slideshowrep = new EntitySlideShowRepository(); ISlideShowImageXrefRepository slideshowimagexrefrep = new EntitySlideShowImageXrefRepository(); ISlideShowMusicXrefRepository slideshowmusicxrefrep = new EntitySlideShowMusicXrefRepository(); ISurveyRepository surveyrep = new EntitySurveyRepository(); ISurveyQuestionRepository surveyquestionrep = new EntitySurveyQuestionRepository(); ISurveyQuestionOptionRepository surveyquestionoptionrep = new EntitySurveyQuestionOptionRepository(); IVideoRepository videorep = new EntityVideoRepository(); IMusicRepository musicrep = new EntityMusicRepository(); // returns the summarized schedule information for the player List<Image> images = new List<Image>(); List<PlayerGroupSchedule> playergroupschedules = new List<PlayerGroupSchedule>(); List<PlayList> playlists = new List<PlayList>(); List<PlayListVideoXref> playlistvideoxrefs = new List<PlayListVideoXref>(); List<ScreenContent> screencontents = new List<ScreenContent>(); List<ScreenScreenContentXref> screenscreencontentxrefs = new List<ScreenScreenContentXref>(); List<Screen> screens = new List<Screen>(); List<SlideShow> slideshows = new List<SlideShow>(); List<SlideShowImageXref> slideshowimagexrefs = new List<SlideShowImageXref>(); List<SlideShowMusicXref> slideshowmusicxrefs = new List<SlideShowMusicXref>(); List<Survey> surveys = new List<Survey>(); List<SurveyQuestion> surveyquestions = new List<SurveyQuestion>(); List<SurveyQuestionOption> surveyquestionoptions = new List<SurveyQuestionOption>(); List<Video> videos = new List<Video>(); List<Music> musics = new List<Music>(); StringBuilder sb = new StringBuilder(); sb.Append("<xml>"); // Player Schedule Info -------------------------------------------------------------------------------------- // Get the PlayerGroupID - Player should only exist in one Player Group Player player = playerrep.GetPlayer(playerid); if (player == null) throw new Exception("No player found."); // Get the PlayerGroupSchedule for this player playergroupschedules = playergroupschedulerep.GetPlayerGroupSchedulesByPlayerGroup(player.PlayerGroupID).ToList(); if (playergroupschedules == null || playergroupschedules.Count == 0) throw new Exception("No schedule found for this player."); sb.Append("<PlayerGroupSchedules>"); foreach (PlayerGroupSchedule playergroupschedule in playergroupschedules) { sb.Append("<PlayerGroupSchedule "); sb.Append("PlayerGroupScheduleID=\"" + playergroupschedule.PlayerGroupScheduleID.ToString() + "\" "); sb.Append("PlayerGroupID=\"" + playergroupschedule.PlayerGroupID.ToString() + "\" "); sb.Append("ScreenID=\"" + playergroupschedule.ScreenID.ToString() + "\" "); sb.Append("Day=\"" + playergroupschedule.Day.ToString() + "\" "); sb.Append("Hour=\"" + playergroupschedule.Hour.ToString() + "\" "); sb.Append("Minute=\"" + playergroupschedule.Minute.ToString() + "\" "); sb.Append(" />"); // Add the screen to the screens list screens.Add(screenrep.GetScreen(playergroupschedule.ScreenID)); } sb.Append("</PlayerGroupSchedules>"); // Screens -------------------------------------------------------------------------------------- screens = screens.Distinct().ToList(); sb.Append("<Screens>"); foreach (Screen screen in screens) { sb.Append("<Screen "); sb.Append("ScreenID=\"" + screen.ScreenID.ToString() + "\" "); sb.Append("AccountID=\"" + screen.AccountID.ToString() + "\" "); sb.Append("ScreenName=\"" + Utility.EncodeXMLString(screen.ScreenName) + "\" "); sb.Append("SlideShowID=\"" + screen.SlideShowID.ToString() + "\" "); sb.Append("PlayListID=\"" + screen.PlayListID.ToString() + "\" "); string interactive = "true"; if (!screen.IsInteractive) interactive = "false"; sb.Append("IsInteractive=\"" + interactive + "\" "); sb.Append("ButtonImageID=\"" + screen.ButtonImageID.ToString() + "\" "); sb.Append(" />"); // Save the SlideShow if (screen.SlideShowID != 0) slideshows.Add(slideshowrep.GetSlideShow(screen.SlideShowID)); // Save the PlayList if (screen.PlayListID != 0) playlists.Add(playlistrep.GetPlayList(screen.PlayListID)); // Save the screen button image if (screen.ButtonImageID != 0) images.Add(imagerep.GetImage(screen.ButtonImageID)); // Save the ScreenContentXrefs List<ScreenScreenContentXref> sscxrefs = screenscreencontentxrefrep.GetScreenScreenContentXrefs(screen.ScreenID).ToList(); foreach (ScreenScreenContentXref sscxref in sscxrefs) { // Save to the xref screenscreencontentxrefs.Add(sscxref); } } sb.Append("</Screens>"); // ScreenScreenContentXrefs ----------------------------------------------------------------------------- sb.Append("<ScreenScreenContentXrefs>"); foreach (ScreenScreenContentXref sscxref in screenscreencontentxrefs) { sb.Append("<ScreenScreenContentXref "); sb.Append("ScreenScreenContentXrefID=\"" + sscxref.ScreenScreenContentXrefID.ToString() + "\" "); sb.Append("ScreenID=\"" + sscxref.ScreenID.ToString() + "\" "); sb.Append("ScreenContentID=\"" + sscxref.ScreenContentID.ToString() + "\" "); sb.Append("DisplayOrder=\"" + sscxref.DisplayOrder.ToString() + "\" "); sb.Append(" />"); // Save the screen content screencontents.Add(screencontentrep.GetScreenContent(sscxref.ScreenContentID)); } sb.Append("</ScreenScreenContentXrefs>"); // ScreenContents ------------------------------------------------------------------------------------- screencontents = screencontents.Distinct().ToList(); sb.Append("<ScreenContents>"); foreach (ScreenContent sc in screencontents) { ScreenContentType sctype = screencontenttyperep.GetScreenContentType(sc.ScreenContentTypeID); sb.Append("<ScreenContent "); sb.Append("ScreenContentID=\"" + sc.ScreenContentID.ToString() + "\" "); sb.Append("ScreenContentTypeID=\"" + sc.ScreenContentTypeID.ToString() + "\" "); sb.Append("ScreenContentTypeName=\"" + Utility.EncodeXMLString(sctype.ScreenContentTypeName) + "\" "); sb.Append("ScreenContentName=\"" + Utility.EncodeXMLString(sc.ScreenContentName) + "\" "); sb.Append("ScreenContentTitle=\"" + Utility.EncodeXMLString(sc.ScreenContentTitle) + "\" "); sb.Append("ThumbnailImageID=\"" + sc.ThumbnailImageID.ToString() + "\" "); sb.Append("CustomField1=\"" + Utility.EncodeXMLString(sc.CustomField1) + "\" "); sb.Append("CustomField2=\"" + Utility.EncodeXMLString(sc.CustomField2) + "\" "); sb.Append("CustomField3=\"" + Utility.EncodeXMLString(sc.CustomField3) + "\" "); sb.Append("CustomField4=\"" + Utility.EncodeXMLString(sc.CustomField4) + "\" "); sb.Append(" />"); // Add the Thumbnail Image if (sc.ThumbnailImageID != 0) images.Add(imagerep.GetImage(sc.ThumbnailImageID)); // If Image, add the image if (sc.ScreenContentTypeID == 1000000 && !String.IsNullOrEmpty(sc.CustomField1)) images.Add(imagerep.GetImage(Convert.ToInt32(sc.CustomField1))); // If Slideshow, add the slideshow if (sc.ScreenContentTypeID == 1000001 && !String.IsNullOrEmpty(sc.CustomField1)) slideshows.Add(slideshowrep.GetSlideShow(Convert.ToInt32(sc.CustomField1))); // If Video, add the video if (sc.ScreenContentTypeID == 1000002 && !String.IsNullOrEmpty(sc.CustomField1)) videos.Add(videorep.GetVideo(Convert.ToInt32(sc.CustomField1))); // If PlayList, add the playlist if (sc.ScreenContentTypeID == 1000003 && !String.IsNullOrEmpty(sc.CustomField1)) playlists.Add(playlistrep.GetPlayList(Convert.ToInt32(sc.CustomField1))); // If Survey, add the survey and its image if (sc.ScreenContentTypeID == 1000007 && !String.IsNullOrEmpty(sc.CustomField1)) { Survey survey = surveyrep.GetSurvey(Convert.ToInt32(sc.CustomField1)); images.Add(imagerep.GetImage(survey.SurveyImageID)); surveys.Add(survey); } } sb.Append("</ScreenContents>"); // Surveys --------------------------------------------------------------------------------- surveys = surveys.Distinct().ToList(); sb.Append("<Surveys>"); foreach (Survey sv in surveys) { sb.Append("<Survey "); sb.Append("SurveyID=\"" + sv.SurveyID + "\" "); sb.Append("SurveyName=\"" + Utility.EncodeXMLString(sv.SurveyName) + "\" "); sb.Append("SurveyImageID=\"" + sv.SurveyImageID + "\" "); sb.Append(" />"); List<SurveyQuestion> svqs = surveyquestionrep.GetSurveyQuestions(sv.SurveyID).ToList(); foreach (SurveyQuestion svq in svqs) { surveyquestions.Add(svq); } } sb.Append("</Surveys>"); // SurveyQuestions ---------------------------------------------------------------------------- surveyquestions = surveyquestions.Distinct().ToList(); sb.Append("<SurveyQuestions>"); foreach (SurveyQuestion svq in surveyquestions) { sb.Append("<SurveyQuestion "); sb.Append("SurveyQuestionID=\"" + svq.SurveyQuestionID + "\" "); sb.Append("SurveyID=\"" + svq.SurveyID + "\" "); sb.Append("SurveyQuestionText=\"" + Utility.EncodeXMLString(svq.SurveyQuestionText) + "\" "); sb.Append("AllowMultiselect=\"" + svq.AllowMultiSelect.ToString() + "\" "); sb.Append("SortOrder=\"" + svq.SortOrder.ToString() + "\" "); sb.Append(" />"); List<SurveyQuestionOption> svqos = surveyquestionoptionrep.GetSurveyQuestionOptions(svq.SurveyQuestionID).ToList(); foreach (SurveyQuestionOption svqo in svqos) { surveyquestionoptions.Add(svqo); } } sb.Append("</SurveyQuestions>"); // SurveyQuestionOptions ---------------------------------------------------------------------------- surveyquestionoptions = surveyquestionoptions.Distinct().ToList(); sb.Append("<SurveyQuestionOptions>"); foreach (SurveyQuestionOption svqo in surveyquestionoptions) { sb.Append("<SurveyQuestionOption "); sb.Append("SurveyQuestionOptionID=\"" + svqo.SurveyQuestionOptionID + "\" "); sb.Append("SurveyQuestionID=\"" + svqo.SurveyQuestionID + "\" "); sb.Append("SurveyQuestionOptionText=\"" + Utility.EncodeXMLString(svqo.SurveyQuestionOptionText) + "\" "); sb.Append("SortOrder=\"" + svqo.SortOrder.ToString() + "\" "); sb.Append(" />"); } sb.Append("</SurveyQuestionOptions>"); // SlideShows --------------------------------------------------------------------------------- slideshows = slideshows.Distinct().ToList(); sb.Append("<SlideShows>"); foreach (SlideShow ss in slideshows) { sb.Append("<SlideShow "); sb.Append("SlideShowID=\"" + ss.SlideShowID.ToString() + "\" "); sb.Append("IntervalInSecs=\"" + ss.IntervalInSecs.ToString() + "\" "); sb.Append("TransitionType=\"" + Utility.EncodeXMLString(ss.TransitionType) + "\" "); sb.Append(" />"); List<SlideShowImageXref> ssixrefs = slideshowimagexrefrep.GetSlideShowImageXrefs(ss.SlideShowID).ToList(); foreach (SlideShowImageXref ssixref in ssixrefs) { slideshowimagexrefs.Add(ssixref); } List<SlideShowMusicXref> ssmxrefs = slideshowmusicxrefrep.GetSlideShowMusicXrefs(ss.SlideShowID).ToList(); foreach (SlideShowMusicXref ssmxref in ssmxrefs) { slideshowmusicxrefs.Add(ssmxref); } } sb.Append("</SlideShows>"); // SlideshowImageXrefs --------------------------------------------------------------------------------- slideshowimagexrefs = slideshowimagexrefs.Distinct().ToList(); sb.Append("<SlideShowImageXrefs>"); foreach (SlideShowImageXref ssixref in slideshowimagexrefs) { sb.Append("<SlideShowImageXref "); sb.Append("SlideShowImageXrefID=\"" + ssixref.SlideShowImageXrefID.ToString() + "\" "); sb.Append("SlideShowID=\"" + ssixref.SlideShowID.ToString() + "\" "); sb.Append("ImageID=\"" + ssixref.ImageID.ToString() + "\" "); sb.Append("PlayOrder=\"" + ssixref.PlayOrder.ToString() + "\" "); sb.Append(" />"); // Add the image images.Add(imagerep.GetImage(ssixref.ImageID)); } sb.Append("</SlideShowImageXrefs>"); // SlideshowMusicXrefs --------------------------------------------------------------------------------- slideshowmusicxrefs = slideshowmusicxrefs.Distinct().ToList(); sb.Append("<SlideShowMusicXrefs>"); foreach (SlideShowMusicXref ssmxref in slideshowmusicxrefs) { sb.Append("<SlideShowMusicXref "); sb.Append("SlideShowMusicXrefID=\"" + ssmxref.SlideShowMusicXrefID.ToString() + "\" "); sb.Append("SlideShowID=\"" + ssmxref.SlideShowID.ToString() + "\" "); sb.Append("MusicID=\"" + ssmxref.MusicID.ToString() + "\" "); sb.Append("PlayOrder=\"" + ssmxref.PlayOrder.ToString() + "\" "); sb.Append(" />"); // Add the music musics.Add(musicrep.GetMusic(ssmxref.MusicID)); } sb.Append("</SlideShowMusicXrefs>"); // Images --------------------------------------------------------------------------------- images = images.Distinct().ToList(); sb.Append("<Images>"); foreach (Image image in images) { sb.Append("<Image "); sb.Append("ImageID=\"" + image.ImageID.ToString() + "\" "); sb.Append("StoredFilename=\"" + image.StoredFilename + "\" "); sb.Append("ImageName=\"" + Utility.EncodeXMLString(image.ImageName) + "\" "); sb.Append(" />"); } sb.Append("</Images>"); // PlayLists --------------------------------------------------------------------------------- playlists = playlists.Distinct().ToList(); sb.Append("<PlayLists>"); foreach (PlayList pl in playlists) { sb.Append("<PlayList "); sb.Append("PlayListID=\"" + pl.PlayListID.ToString() + "\" "); sb.Append(" />"); List<PlayListVideoXref> plvxrefs = playlistvideoxrefrep.GetPlayListVideoXrefs(pl.PlayListID).ToList(); foreach (PlayListVideoXref plvxref in plvxrefs) { playlistvideoxrefs.Add(plvxref); } } sb.Append("</PlayLists>"); // PlaylistVideoXrefs --------------------------------------------------------------------------------- playlistvideoxrefs = playlistvideoxrefs.Distinct().ToList(); sb.Append("<PlayListVideoXrefs>"); foreach (PlayListVideoXref plvxref in playlistvideoxrefs) { sb.Append("<PlayListVideoXref "); sb.Append("PlayListVideoXrefID=\"" + plvxref.PlayListVideoXrefID.ToString() + "\" "); sb.Append("PlayListID=\"" + plvxref.PlayListID.ToString() + "\" "); sb.Append("VideoID=\"" + plvxref.VideoID.ToString() + "\" "); sb.Append("PlayOrder=\"" + plvxref.PlayOrder.ToString() + "\" "); sb.Append(" />"); videos.Add(videorep.GetVideo(plvxref.VideoID)); } sb.Append("</PlayListVideoXrefs>"); // Videos --------------------------------------------------------------------------------- videos = videos.Distinct().ToList(); sb.Append("<Videos>"); foreach (Video video in videos) { sb.Append("<Video "); sb.Append("VideoID=\"" + video.VideoID.ToString() + "\" "); sb.Append("StoredFilename=\"" + video.StoredFilename + "\" "); sb.Append("VideoName=\"" + video.VideoName + "\" "); sb.Append(" />"); } sb.Append("</Videos>"); // Musics --------------------------------------------------------------------------------- musics = musics.Distinct().ToList(); sb.Append("<Musics>"); foreach (Music music in musics) { sb.Append("<Music "); sb.Append("MusicID=\"" + music.MusicID.ToString() + "\" "); sb.Append("StoredFilename=\"" + music.StoredFilename + "\" "); sb.Append("MusicName=\"" + music.MusicName + "\" "); sb.Append(" />"); } sb.Append("</Musics>"); // Close the XML and return sb.Append("</xml>"); return sb.ToString(); } catch (Exception ex) { return "<xml><Error>" + ex.Message + "</Error></xml>"; } }