private static List <QuranVerse> LoadListFromReader(IDataReader reader, bool isTranslation) { List <QuranVerse> iVList = new List <QuranVerse>(); try { while (reader.Read()) { QuranVerse iVerse = new QuranVerse(); iVerse.verseID = int.Parse(reader["VerseID"].ToString()); iVerse.suraID = int.Parse(reader["SuraID"].ToString()); iVerse.quranID = int.Parse(reader["QuranID"].ToString()); iVerse.siteID = int.Parse(reader["SiteID"].ToString()); iVerse.verseOrder = int.Parse(reader["VerseOrder"].ToString()); iVerse.suraOrder = int.Parse(reader["SuraOrder"].ToString()); iVerse.sortOrderInQuran = int.Parse(reader["SortOrderInQuran"].ToString()); iVerse.halfNo = int.Parse(reader["HalfNo"].ToString()); iVerse.partNo = int.Parse(reader["PartNo"].ToString()); iVerse.hizbNo = int.Parse(reader["HizbNo"].ToString()); iVerse.quraterNo = int.Parse(reader["QuraterNo"].ToString()); iVerse.place = reader["Place"].ToString().Trim(); iVerse.startTime = float.Parse(reader["StartTime"].ToString()); iVerse.endTime = float.Parse(reader["EndTime"].ToString()); iVerse.endTimeText = reader["EndTimeText"].ToString().Trim(); string active = reader["IsActive"].ToString(); iVerse.isActive = (active == "True" || active == "1"); iVerse.createdDate = Convert.ToDateTime(reader["CreatedDate"]); iVerse.createdByUserName = reader["UserName"].ToString().Trim(); iVerse.createdByUserID = int.Parse(reader["CreatedBy"].ToString()); iVerse.qLanguage = reader["QLanguage"].ToString().Trim(); if (isTranslation == false) { iVerse.verseText = reader["VerseText"].ToString(); iVerse.quranVerseTxt.VerseText = reader["VerseText"].ToString(); iVerse.quranVerseTxt.VerseTextNM = reader["VerseTextNM"].ToString(); iVerse.quranVerseTxt.VerseTextNMAlif = reader["VerseTextNMAlif"].ToString(); } else { iVerse.verseText = reader["VerseText"].ToString(); } iVList.Add(iVerse); } } finally { reader.Close(); } return(iVList); }
private static List <QuranSura> LoadListFromReader(IDataReader reader, bool iSThereSubInstancesInside) { List <QuranSura> iSList = new List <QuranSura>(); try { while (reader.Read()) { QuranSura iSur = new QuranSura(); iSur.SuraID = int.Parse(reader["SuraID"].ToString()); iSur.SiteID = int.Parse(reader["SiteID"].ToString()); iSur.QuranID = int.Parse(reader["QuranID"].ToString()); iSur.Title = reader["Title"].ToString().Trim(); iSur.Place = reader["Place"].ToString().Trim(); iSur.SoraOrderReverse = 115 - int.Parse(reader["SuraOrder"].ToString()); iSur.VersesCount = int.Parse(reader["VersesCount"].ToString()); iSur.SuraOrder = int.Parse(reader["SuraOrder"].ToString()); iSur.pageNumber = int.Parse(reader["PageNumber"].ToString()); string active = reader["IsActive"].ToString(); iSur.IsActive = (active == "True" || active == "1"); iSur.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]); iSur.CreatedByUserName = reader["UserName"].ToString().Trim(); iSur.CreatedByUserId = int.Parse(reader["CreatedBy"].ToString()); //Get Sub Data ? if (iSThereSubInstancesInside == true) { using (IDataReader reader1 = DBiQuran.iVerse_GetVerses_Dr(iSur.siteID, iSur.suraID)) { while (reader1.Read()) { QuranVerse iQuranVerse = new QuranVerse(); iSur.iQuranVerses.VerseID = int.Parse(reader1["VerseID"].ToString()); iSur.iQuranVerses.SuraID = int.Parse(reader1["SuraID"].ToString()); iSur.iQuranVerses.QuranID = int.Parse(reader1["QuranID"].ToString()); iSur.iQuranVerses.SiteID = int.Parse(reader1["SiteID"].ToString()); iSur.iQuranVerses.VerseOrder = int.Parse(reader1["VerseOrder"].ToString()); iSur.iQuranVerses.SortOrderInQuran = int.Parse(reader1["SortOrderInQuran"].ToString()); iSur.iQuranVerses.HalfNo = int.Parse(reader1["HalfNo"].ToString()); iSur.iQuranVerses.PartNo = int.Parse(reader1["PartNo"].ToString()); iSur.iQuranVerses.QuraterNo = int.Parse(reader1["QuraterNo"].ToString()); iSur.iQuranVerses.StartTime = float.Parse(reader1["StartTime"].ToString()); iSur.iQuranVerses.EndTime = float.Parse(reader1["EndTime"].ToString()); iSur.iQuranVerses.EndTimeText = reader1["EndTimeText"].ToString().Trim(); string active1 = reader1["IsActive"].ToString(); iSur.iQuranVerses.IsActive = (active1 == "True" || active1 == "1"); iSur.iQuranVerses.CreatedDate = Convert.ToDateTime(reader1["CreatedDate"]); iSur.iQuranVerses.CreatedByUserName = reader1["UserName"].ToString().Trim(); iSur.iQuranVerses.CreatedByUserId = int.Parse(reader1["CreatedBy"].ToString()); iSur.iQuranVerses.QLanguage = reader1["QLanguage"].ToString().Trim(); if (iSur.iQuranVerses.QLanguage == "ar") { using (IDataReader reader2 = DBiQuran.iVerse_GetVerse_Text(iSur.iQuranVerses.SiteID, iSur.iQuranVerses.QuranID, iSur.iQuranVerses.SuraID, iSur.iQuranVerses.VerseID)) { if (reader2.Read()) { iSur.iQuranVerses.VerseText = reader2["VerseText"].ToString(); iSur.iQuranVerses.QuranVerseTxt.VerseTextNM = reader2["VerseTextNM"].ToString(); iSur.iQuranVerses.QuranVerseTxt.VerseTextNMAlif = reader2["VerseTextNMAlif"].ToString(); } else { if (log.IsErrorEnabled) { log.Error("IDataReader didn't read in Quran.GetiQuran"); } } } } else { iSur.iQuranVerses.VerseText = DBiQuran.iVerse_GetVerse_Translation(iSur.iQuranVerses.SiteID, iSur.iQuranVerses.QuranID, iSur.iQuranVerses.SuraID, iSur.iQuranVerses.VerseID); } } } } iSList.Add(iSur); } } finally { reader.Close(); } return(iSList); }