Esempio n. 1
0
        private void label6_Click(object sender, EventArgs e)
        {
            if (userNo == -1)
            {
                MessageBox.Show("로그인을 먼저 해주세요", "로그인", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Form7 form7 = new Form7();

            this.Hide();
            form7.label1.Font = new Font("맑은 고딕", 27);
            form7.Show();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (movieNo == -1 || theaterNo == -1 || date == DateTime.Now.Date.AddDays(-1) || dictionary.Count == 0)
            {
                MessageBox.Show("항목을 선택해주세요", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int price = 0;

            command.Parameters.Clear();
            command.CommandText = "SELECT * FROM movie WHERE m_no = @movie";
            command.Parameters.Add("@movie", SqlDbType.Int);

            command.Parameters[0].Value = movieNo;

            using (reader = command.ExecuteReader())
            {
                if (reader.Read())
                {
                    price = reader.GetInt32(7);
                }
            }

            command.Parameters.Clear();
            command.CommandText = "INSERT INTO reservation (m_no, u_no, t_no, r_date, r_price) values(@movie, @user, @theater, @date, @price);SELECT SCOPE_IDENTITY();";

            command.Parameters.Add("@movie", SqlDbType.Int);
            command.Parameters.Add("@user", SqlDbType.Int);
            command.Parameters.Add("@theater", SqlDbType.Int);
            command.Parameters.Add("@date", SqlDbType.Date);
            command.Parameters.Add("@price", SqlDbType.Int);

            command.Parameters[0].Value = movieNo;
            command.Parameters[1].Value = userNo;
            command.Parameters[2].Value = theaterNo;
            command.Parameters[3].Value = date;
            command.Parameters[4].Value = price * dictionary.Count;

            int id = Convert.ToInt32(command.ExecuteScalar());

            command.Parameters.Clear();
            command.CommandText = "INSERT INTO reservationSeat (r_no, rs_row, rs_col) values(@r_no, @row, @col)";
            command.Parameters.Add("@r_no", SqlDbType.Int);
            command.Parameters.Add("@row", SqlDbType.Int);
            command.Parameters.Add("@col", SqlDbType.Int);

            command.Parameters[0].Value = id;

            foreach (KeyValuePair <int, int[]> seat in dictionary)
            {
                command.Parameters[1].Value = seat.Value[0];
                command.Parameters[2].Value = seat.Value[1];
                command.ExecuteNonQuery();
            }

            MessageBox.Show("예약이 완료되었습니다.", "예약", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Form7 form7 = new Form7();

            this.Hide();
            form7.Show();
        }