Example #1
0
        public SeatsChooser(Movie _movie,User user)
        {
            this.user = user;
            InitializeComponent();
            this.movie = _movie;
            this.sold = new bool[movie.amount];
            this.choose = new bool[movie.amount];

            DataRowCollection res = movie.getSeats().Tables[0].Rows;
            for (int i = 0; i < res.Count; i++)
            {
                int s = (int)res[i]["flag"];
                this.sold[s] = true;
            }
            for (int i = 0; i < movie.amount; i++)
            {
                int x = i % NUM_COLUMNS;
                int y = i / NUM_COLUMNS;
                CheckBox button = new CheckBox();
                button.Appearance = Appearance.Button;
                button.Text = Convert.ToString(i);
                button.Left = x * (WIDTH+INTERVAL) + INTERVAL;
                button.Top = y * (HEIGHT+INTERVAL) + INTERVAL;
                button.Height = HEIGHT;
                button.Width = WIDTH;
                button.Click += F;
                if (sold[i])
                {
                    //button.Checked = true;
                    button.Enabled = false;
                }
                groupBox1.Controls.Add(button);
            }
        }
Example #2
0
        public PayForm(Movie movie,User user,Seat seats)
        {
            InitializeComponent();
            this.movie = movie;
            this.user = user;
            this.seats = seats;
            this.total_price = movie.price * seats.Count;

            textBoxtotalprice.Text = Convert.ToString(this.total_price);
            textBoxleftmoney.Text = Convert.ToString(user.money);
        }
Example #3
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();
        }
Example #4
0
 public MoviePublish()
 {
     InitializeComponent();
     movie = new Movie();
 }
Example #5
0
 public commentForm(User user,Movie movie)
 {
     InitializeComponent();
     this.user = user;
     this.movie = movie;
 }
Example #6
0
 private Movie getMovie()
 {
     Movie movie = new Movie();
     DataRow dr = ((DataRowView)dataMovieList.CurrentRow.DataBoundItem).Row;
     movie.id = (int)dr["id"];
     movie.getMovieById();
     return movie;
 }
Example #7
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     Movie movie = new Movie();
     movie.name = textName.Text;
     dataMovieList.DataSource = movie.getMovieInfo();
 }
Example #8
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;
            }
        }