Exemplo n.º 1
0
        //public Collection<QuranVerse> QuranVerses
        //{
        //	get { return quranVerses; }
        //	set { quranVerses = value; }
        //}
        #endregion

        #region Private Methods

        private void GetSura(int siteId, int suraid)
        {
            using (IDataReader reader = DBiQuran.iSura_GetSura(siteId, suraid))
            {
                if (reader.Read())
                {
                    this.suraID           = int.Parse(reader["SuraID"].ToString());
                    this.siteID           = int.Parse(reader["SiteID"].ToString());
                    this.quranID          = int.Parse(reader["QuranID"].ToString());
                    this.title            = reader["Title"].ToString();
                    this.place            = reader["Place"].ToString();
                    this.soraOrderReverse = 115 - int.Parse(reader["SuraOrder"].ToString());
                    this.versesCount      = int.Parse(reader["VersesCount"].ToString());
                    this.suraOrder        = int.Parse(reader["SuraOrder"].ToString());
                    this.pageNumber       = int.Parse(reader["PageNumber"].ToString());
                    string active = reader["IsActive"].ToString();
                    this.isActive          = (active == "True" || active == "1");
                    this.createdDate       = Convert.ToDateTime(reader["CreatedDate"]);
                    this.createdByUserName = reader["UserName"].ToString();
                    this.createdByUserID   = int.Parse(reader["CreatedBy"].ToString());

                    //this.iquranVerse = new QuranVerse();

                    Quran quranVers    = new Quran(this.quranID, this.siteID);
                    int   surasPerPage = 0;

                    if (quranVers.SurasPerPageUser > 0)
                    {
                        surasPerPage = quranVers.SurasPerPageUser;
                    }
                    else
                    {
                        surasPerPage = quranVers.SurasPerPage;
                    }



                    if (this.versesCount > surasPerPage)
                    {
                        this.totalPages = this.versesCount / surasPerPage;
                        int remainder = 0;
                        Math.DivRem(this.versesCount, surasPerPage, out remainder);
                        if (remainder > 0)
                        {
                            this.totalPages += 1;
                        }
                    }
                    else
                    {
                        this.totalPages = 1;
                    }
                }
                else
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("IDataReader didn't read in Quran.GetSura");
                    }
                }
            }
        }