Esempio n. 1
0
        public DataSet Details()
        {
            int       k  = 0;
            DataTable dt = new DataTable();

            dt.Columns.Add("MovieID");
            dt.Columns.Add("InvitationNumber");
            dt.Columns.Add("LastScreeningDate");
            dt.Columns.Add("DateEndOfMovie");
            dt.Columns.Add("NumberOfScreenings");
            DataTable dt1 = Movies.AllMovies();

            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                string movie = dt1.Rows[i]["MovieID"].ToString();
                dt.Rows.Add();
                dt.Rows[k]["MovieID"] = movie;
                k = k + 1;
            }
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                string movie2            = dt.Rows[j]["MovieID"].ToString();
                int    sum               = Invitation.NumOfInviationsForMovieID(movie2);
                string lastscreeningdate = Screening.LastScreeningDateForMovieID(movie2);
                string dateend           = Movies.MovieDateEnd(movie2);
                int    numofscreenings   = Screening.NumOfScreeningForMovieID(movie2);
                dt.Rows[j]["InvitationNumber"]   = sum;
                dt.Rows[j]["LastScreeningDate"]  = lastscreeningdate;
                dt.Rows[j]["DateEndOfMovie"]     = dateend;
                dt.Rows[j]["NumberOfScreenings"] = numofscreenings;
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    Console.Write(dt.Rows[i][j] + "  ");
                }
                Console.WriteLine();
            }
            DataSet ds = new DataSet();

            ds.Tables.Add(dt);
            return(ds);
        }