Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            float refund = 0;
            int count = 0;
            foreach (DataGridViewRow dr in dataGridView1.SelectedRows)
            {
                int filmId = Convert.ToInt32(dr.Cells[1].Value);
                int flag = Convert.ToInt32(dr.Cells[2].Value);

                if (Seat.Refund(user.id, filmId, flag))
                {
                    Movie movie = new Movie();
                    movie.id = filmId;
                    movie.getMovieById();
                    refund += movie.price;
                    count += 1;
                }
            }
            user.recharge(refund);
            MessageBox.Show(string.Format("成功退票 {0} 张, {1} 元钱!", count, refund));
            dataGridView1.DataSource = user.getTickets();
        }
Exemplo n.º 2
0
 private Movie getMovie()
 {
     Movie movie = new Movie();
     DataRow dr = ((DataRowView)dataMovieList.CurrentRow.DataBoundItem).Row;
     movie.id = (int)dr["id"];
     movie.getMovieById();
     return movie;
 }
Exemplo n.º 3
0
        public MovieDetail(Movie movie,User user)
        {
            InitializeComponent();
            detailMovie = movie;
            this.user = user;
            detailMovie.getMovieById();
            textBoxfilmname.Text = detailMovie.name;
            textBoxdirector.Text = detailMovie.director;
            textBoxhallnum.Text = detailMovie.hallNum.ToString();
            textBoxlength.Text = detailMovie.length.ToString();
            textBoxprice.Text = detailMovie.price.ToString();
            textTime.Text = detailMovie.startTime.ToString();
            try
            {
                picturePoster.Image = Image.FromFile(detailMovie.logoPath);
            }
            catch (Exception)
            {

                picturePoster.Image = null;
            }

            comments = new Comment();
            comments.getFilmComments(detailMovie.id);
            labelRemark1.Text = Convert.ToString(comments.comments[0]);
            labelRemark2.Text = Convert.ToString(comments.comments[1]);

            picMark[0] = pictureBox1;
            picMark[1] = pictureBox2;
            picMark[2] = pictureBox3;
            picMark[3] = pictureBox4;
            picMark[4] = pictureBox5;

            for (int i = 0; i < 5 ; i ++)
            {
                picMark[i].Click += movieMark;
                picMark[i].MouseMove += movieOver;
            }
            groupBox1.MouseMove += movieOver;
            groupBox1.Click += movieMark;

            DataTable dt = this.detailMovie.getUserMark().Tables[0];
            double sum_score = 0;
            int count = dt.Rows.Count;
            foreach (DataRow r in dt.Rows)
            {
                sum_score += Convert.ToDouble(r["score"]);
            }
            if (count == 0)
                this.detailMovie.score = 0;
            else
                this.detailMovie.score = 1.0 * sum_score / count;

            clearMark();

            if (user.type == 0)
            {

            }
            else
            {
                this.button.Visible = false;
                this.buttonbuyticket.Visible = false;
            }
        }