public override List<MenuOptionItem> getOptionList(UserSession us) { ReadOnlyCollection<FavouriteVerseRecord> favourite_list = us.favourite_verses.getFavouriteListForDisplay(); if (favourite_list != null) { String verse_ref = ""; FavouriteVerseRecord fvr = null; List<MenuOptionItem> final_list = new List<MenuOptionItem>(); MenuOptionItem m_o = null; for (int i = 0; i < favourite_list.Count; i++) { if (favourite_list[i] != null) { fvr = favourite_list[i]; //call methods in a handler...not so good. I should of moved this method into a common class Verse start_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), fvr.start_verse); Verse end_verse; if (fvr.end_verse == null || fvr.start_verse.Equals(fvr.end_verse)) end_verse = null; else if ("NULL".Equals(fvr.end_verse)) end_verse = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(start_verse); else end_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), fvr.end_verse); if (start_verse == null || (!(fvr.end_verse == null || fvr.start_verse.Equals(fvr.end_verse)) && end_verse == null)) { m_o = new VerseMenuOptionItem( fvr.id.ToString(), (i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, "N/A", fvr); m_o.is_valid = false; final_list.Add(m_o); } else { verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(start_verse, end_verse); m_o = new VerseMenuOptionItem( fvr.id.ToString(), (i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, verse_ref + " (" + fvr.datetime.ToString("dd/MM/yyyy") + ")", fvr); m_o.is_valid = true; final_list.Add(m_o); } } } return final_list; } return null; }
public override List<MenuOptionItem> getOptionList(UserSession us) { ReadOnlyCollection<VerseHistoryRecord> history_list = us.verse_history.getHistoryListForDisplay(); //LinkedList<VerseHistoryRecord> if (history_list != null) { String verse_ref = ""; VerseHistoryRecord vhr = null; MenuOptionItem m_o = null; List<MenuOptionItem> final_list = new List<MenuOptionItem>(); for (int i = 0; i < history_list.Count; i++) { if (history_list[i] != null) { vhr = history_list[i]; //call methods in a handler...not so good. I should of moved this method into a common class Verse start_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), vhr.start_verse); if (start_verse != null) { Verse end_verse; if (vhr.end_verse == null || vhr.start_verse.Equals(vhr.end_verse)) end_verse = null; else if ("NULL".Equals(vhr.end_verse)) end_verse = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(start_verse); else end_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), vhr.end_verse); verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(start_verse, end_verse); m_o = new VerseMenuOptionItem( vhr.id.ToString(), (i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, verse_ref + " (" + vhr.datetime.ToString("dd/MM/yyyy") + ")", vhr); final_list.Add(m_o); } else { m_o = new VerseMenuOptionItem( vhr.id.ToString(), (i + 1).ToString(), target_page, vhr.start_verse + " (" + vhr.datetime.ToString("dd/MM/yyyy") + ")", vhr); m_o.is_valid = false; final_list.Add(m_o); } } } return final_list; } return null; }
public override List<MenuOptionItem> getOptionList(UserSession us) { List<TopFavouriteVerseRecord> favourite_list = FavouriteVerseManager.getTopFavouriteList(); if (favourite_list != null) { String verse_ref = ""; TopFavouriteVerseRecord tfvr = null; MenuOptionItem m_o = null; List<MenuOptionItem> final_list = new List<MenuOptionItem>(); for (int i = 0; i < favourite_list.Count; i++) { if (favourite_list[i] != null) { tfvr = favourite_list[i]; //call methods in a handler...not so good. I should of moved this method into a common class Verse start_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), tfvr.start_verse); Verse end_verse = start_verse; if (start_verse != null) { verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(start_verse, end_verse); m_o = new VerseMenuOptionItem( (i + 1).ToString(), verse_ref/*(i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, verse_ref + " (" + tfvr.verse_count + ")", tfvr); final_list.Add(m_o); } else { m_o = new VerseMenuOptionItem( (i + 1).ToString(), tfvr.start_verse, target_page, tfvr.start_verse + " (" + tfvr.verse_count + ")", tfvr); m_o.is_valid = false; final_list.Add(m_o); } } } return final_list; } return null; }
public override List<MenuOptionItem> getOptionList(UserSession us) { List<VerseTag> tagged_verses = VerseTagManager.getInstance().getListOfVerseTagsForEmotion(Int32.Parse(us.getVariable(SELECTED_EMOTION_VAR_NAME))); //LinkedList<VerseHistoryRecord> List<MenuOptionItem> final_list = new List<MenuOptionItem>(); if (tagged_verses != null) { if(tagged_verses.Count > 0) tagged_verses.Sort(); int index = 0; foreach (VerseTag verse_tag in tagged_verses) { index++; if (verse_tag != null) { try { String start_verse = verse_tag.start_verse; String end_verse = verse_tag.end_verse; /*if (verse_tag.datetime != null && verse_tag.datetime != DateTime.MinValue && !"".Equals(verse_tag.datetime)) { date_tagged = verse_tag.datetime.ToString("dd/MM/yy"); } else { date_tagged = ""; }*/ int like_count = verse_tag.getLikeCount(); String like_string; if (like_count == 0) { like_string = ""; } else if (like_count == 1) { like_string = "1 person likes this"; } else { like_string = like_count + " people likes this"; } String rel_date = DateUtils.RelativeDate(verse_tag.datetime); Verse s_v = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), start_verse); Verse e_v; if (s_v != null) { if (end_verse == null || "".Equals(end_verse) || end_verse.Equals(start_verse)) e_v = null; else if ("NULL".Equals(end_verse)) e_v = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(s_v); else e_v = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), end_verse); //VerseRecord vr = new VerseRecord(start_verse, end_verse); String verse_summ = BibleContainer.getSummaryOfVerse(s_v, 7); String user_name = UserNameManager.getInstance().getUserName(verse_tag.user_id); TaggedVerseMenuOptionItem m_o; String verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(s_v, e_v); if (start_verse == null || end_verse == null) { m_o = new TaggedVerseMenuOptionItem( (index).ToString(), (index).ToString()/*(book_list[i].name).ToString()*/, target_page, "N/A", verse_tag); m_o.is_valid = false; final_list.Add(m_o); } else { m_o = new TaggedVerseMenuOptionItem( (index).ToString(), verse_ref/*(i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, verse_ref + " (" + rel_date + ") - " + verse_summ + "... \r\nTagged by: " + user_name + " \r\n" + like_string, verse_tag); m_o.is_valid = true; final_list.Add(m_o); } } else { TaggedVerseMenuOptionItem m_o = new TaggedVerseMenuOptionItem( (index).ToString(), (index).ToString()/*(book_list[i].name).ToString()*/, target_page, "Currently not available in your chosen translation (this could be due to a S/W bug).", verse_tag); m_o.is_valid = false; final_list.Add(m_o); } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); VerseMenuOptionItem m_o = new VerseMenuOptionItem( (index).ToString(), (index).ToString()/*(book_list[i].name).ToString()*/, target_page, "N/A", null); m_o.is_valid = false; final_list.Add(m_o); } } } return final_list; } return final_list; }