Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((bool)Session["AdminStatus"] == true)
            {
                btnAdminAccess.Visible = true;
            }

            DataRow[] drMovies = GetMoviesInfo();

            DataSetTableAdapters.SchedulesTableAdapter taSchedules
                = new DataSetTableAdapters.SchedulesTableAdapter();
            taSchedules.Fill(ds.Schedules);

            //Pack labels and button for effectiveness
            //TODO: Ask Dario how to get all tags instead of this
            Image[]        images       = { img1, img2, img3 };
            Label[]        movieNames   = { lblMovieName0, lblMovieName1, lblMovieName2 };
            Label[]        summaries    = { lblSummary0, lblSummary1, lblSummary2 };
            Label[]        durations    = { lblDuration0, lblDuration1, lblDuration2 };
            Label[]        releaseDates = { lblReleaseDate0, lblReleaseDate1, lblReleaseDate2 };
            Label[]        IMDB         = { lblIMDB0, lblIMDB1, lblIMDB2 };
            Label[]        genres       = { lblGenres0, lblGenres1, lblGenres2 };
            DropDownList[] showtimes    = { drdShowtime0, drdShowtime1, drdShowtime2 };

            for (int index = 0; index < drMovies.Length; index++)
            {
                images[index].Attributes.Add("src", "images/" + drMovies[index]["Poster"]); //Load movies' images
                movieNames[index].Text   = drMovies[index]["MovieTitle"].ToString();        //Load movie name
                summaries[index].Text    = drMovies[index]["Summary"].ToString();           //Load summary
                durations[index].Text    = drMovies[index]["Duration"].ToString();          //Load duration
                releaseDates[index].Text = drMovies[index]["ReleaseDate"].ToString();       //Load relase date
                IMDB[index].Text         = drMovies[index]["IMDBRating"].ToString();        //Load IMDB rating
                genres[index].Text       = drMovies[index]["Genres"].ToString();            //Load genres

                DataRow[] drSchedules
                    = ds.Schedules.Select("MovieID='" + drMovies[index]["MovieID"] + "'");

                for (int x = 0; x < 5; x++)
                {
                    ListItem item = new ListItem(drSchedules[x]["Showtime"].ToString());
                    if (Convert.ToInt32(drSchedules[x]["Quantity"]) == 0)
                    {
                        item.Attributes.Add("disabled", "true");
                    }

                    showtimes[index].Items.Add(item);
                }
            }
        }
Пример #2
0
        protected void btnShowBill_Click(object sender, EventArgs e)
        {
            Session["Ammount"]          = amount;
            Session["Tax"]              = tax;
            Session["Total"]            = total;
            Session["DaysUntilTuesday"] = daysUntilTuesday;
            Session["GeneralAdmission"] = lblQuantity.Text;
            Session["SeniorAdmission"]  = lblQuantity1.Text;
            Session["TuesdayAdmission"] = lblQuantity2.Text;

            DataSet ds1 = new DataSet();

            DataSetTableAdapters.SchedulesTableAdapter taSchedules
                = new DataSetTableAdapters.SchedulesTableAdapter();
            taSchedules.Fill(ds1.Schedules);
            DataRow[] drTimeId = ds1.Schedules.Select("TimeID=" + (int)Session["TimeID"]);//Inside is where clause
            drTimeId[0]["Quantity"] = GetAvailableQuantity() - GetTotalQuantity();

            taSchedules.Update(ds1.Schedules);

            Server.Transfer("Bill.aspx");
        }
Пример #3
0
        private int GetAvailableQuantity()
        {
            DataSetTableAdapters.SchedulesTableAdapter taSchedules
                = new DataSetTableAdapters.SchedulesTableAdapter();
            taSchedules.Fill(ds.Schedules);//Get the lateset and put into ds1.Schedules

            DataRow[] drSchedules
                = ds.Schedules.Select("MovieID='" + (int)Session["MovieID"] + "'");
            int timeIndex = 0;

            for (int index = 0; index < drSchedules.Length; index++)
            {
                if (drSchedules[index]["Showtime"].ToString() == (string)Session["Showtime"])
                {
                    timeIndex = Convert.ToInt32(drSchedules[index]["TimeID"]);
                }
            }
            Session["TimeID"] = timeIndex;

            DataRow[] drTimeID  = ds.Schedules.Select("TimeID = '" + timeIndex + "'");
            int       remainQnt = Convert.ToInt32(drTimeID[0]["Quantity"]);

            return(remainQnt);
        }