Ejemplo n.º 1
0
        public clsFilmCollection()
        {
            Int32             Index       = 0;
            Int32             RecordCount = 0;
            clsDataConnection DB          = new clsDataConnection();

            PopulateArray(DB);

            DB.Execute("sproc_tblFilm_SelectAll");

            RecordCount = DB.Count;

            while (Index < RecordCount)
            {
                clsFilm AFilm = new clsFilm();

                AFilm.FilmID            = Convert.ToInt32(DB.DataTable.Rows[Index]["FilmId"]);
                AFilm.FilmName          = Convert.ToString(DB.DataTable.Rows[Index]["FilmName"]);
                AFilm.FilmDescription   = Convert.ToString(DB.DataTable.Rows[Index]["FilmDescription"]);
                AFilm.FilmCertificate   = Convert.ToString(DB.DataTable.Rows[Index]["FilmCertificate"]);
                AFilm.FilmReleaseDate   = Convert.ToDateTime(DB.DataTable.Rows[Index]["FilmReleaseDate"]);
                AFilm.FilmDepartureDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["FilmDepartureDate"]);
                AFilm.FilmShowing       = Convert.ToBoolean(DB.DataTable.Rows[Index]["FilmShowing"]);
                //add the record to the private data member
                mFilmList.Add(AFilm);
                //point at the next record
                Index++;
            }
        }
Ejemplo n.º 2
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index = 0;
            Int32 RecordCount;

            RecordCount = DB.Count;
            mFilmList   = new List <clsFilm>();
            while (Index < RecordCount)
            {
                clsFilm AFilm = new clsFilm();

                AFilm.FilmID            = Convert.ToInt32(DB.DataTable.Rows[Index]["FilmId"]);
                AFilm.FilmName          = Convert.ToString(DB.DataTable.Rows[Index]["FilmName"]);
                AFilm.FilmDescription   = Convert.ToString(DB.DataTable.Rows[Index]["FilmDescription"]);
                AFilm.FilmCertificate   = Convert.ToString(DB.DataTable.Rows[Index]["FilmCertificate"]);
                AFilm.FilmReleaseDate   = Convert.ToDateTime(DB.DataTable.Rows[Index]["FilmReleaseDate"]);
                AFilm.FilmDepartureDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["FilmDepartureDate"]);
                AFilm.FilmShowing       = Convert.ToBoolean(DB.DataTable.Rows[Index]["FilmShowing"]);
                //add the record to the private data member
                mFilmList.Add(AFilm);
                //point at the next record
                Index++;
            }
        }