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); }
private static List <Quran> LoadListFromReader(IDataReader reader, bool iSThereSubInstancesInside) { List <Quran> iQList = new List <Quran>(); try { while (reader.Read()) { Quran iQur = new Quran(); iQur.quranID = int.Parse(reader["QuranID"].ToString()); iQur.siteID = int.Parse(reader["SiteID"].ToString()); iQur.title = reader["Title"].ToString().Trim(); iQur.description = reader["Description"].ToString(); iQur.tRanslatorDetUrl = reader["TRanslatorDetUrl"].ToString(); iQur.translationSrc = reader["TranslationSrc"].ToString(); iQur.suraCount = int.Parse(reader["SuraCount"].ToString()); string isdefault = reader["IsDefault"].ToString(); iQur.isDefault = (isdefault == "True" || isdefault == "1"); iQur.qLanguage = reader["QLanguage"].ToString().Trim(); string active = reader["IsActive"].ToString(); iQur.isActive = (active == "True" || active == "1"); iQur.createdDate = Convert.ToDateTime(reader["CreatedDate"]); iQur.createdByUserName = reader["UserName"].ToString().Trim(); iQur.createdByUserID = int.Parse(reader["CreatedBy"].ToString()); //Get Sub Data ? if (iSThereSubInstancesInside == true) { using (IDataReader reader1 = DBiQuran.iSura_GetSuras_Dr(iQur.siteID, iQur.quranID)) { while (reader1.Read()) { QuranSura iQuranSura = new QuranSura(); iQur.iQuranSura.SuraID = int.Parse(reader1["SuraID"].ToString()); iQur.iQuranSura.SiteID = int.Parse(reader1["SiteID"].ToString()); iQur.iQuranSura.QuranID = int.Parse(reader1["QuranID"].ToString()); iQur.iQuranSura.Title = reader1["Title"].ToString().Trim(); iQur.iQuranSura.Place = reader1["Place"].ToString().Trim(); iQur.iQuranSura.SoraOrderReverse = int.Parse(reader1["SoraOrderReverse"].ToString()); iQur.iQuranSura.VersesCount = int.Parse(reader1["VersesCount"].ToString()); iQur.iQuranSura.SuraOrder = int.Parse(reader1["SuraOrder"].ToString()); string active1 = reader1["IsActive"].ToString(); iQur.iQuranSura.IsActive = (active1 == "True" || active1 == "1"); iQur.iQuranSura.CreatedDate = Convert.ToDateTime(reader1["CreatedDate"]); iQur.iQuranSura.CreatedByUserName = reader1["UserName"].ToString().Trim(); iQur.iQuranSura.CreatedByUserId = int.Parse(reader1["CreatedBy"].ToString()); } } } iQList.Add(iQur); } } finally { reader.Close(); } return(iQList); }