Esempio n. 1
0
        void InsertOrder()
        {
            AccountModel acc    = Session["accSession"] as AccountModel;
            GiaVeCuaGhe  giaGhe = Session["giaVe"] as GiaVeCuaGhe;

            DAOdonHangVe.Insert(acc.Ten, acc.Email, giaGhe.TongTien, giaGhe.Rap);
            Dictionary <string, int> lstGheDangChon = Session["lstGheDangChon"] as Dictionary <string, int>;
            DateTime ngay = Convert.ToDateTime(Session["ngay"]);

            foreach (KeyValuePair <string, int> item in lstGheDangChon)
            {
                DAOGiaVeCuaGhe.ChuyenTrangThaiDa(item.Key, giaGhe.Rap, giaGhe.KhanDai, giaGhe.Suat, ngay);
            }

            InsertVe();
        }
Esempio n. 2
0
        private void btnThanhToan_Click(object sender, EventArgs e)
        {
            if (ValidateOfMe.ValidateOfMe.isHaveEmptyTextBox(ref pnInfor))
            {
                return;
            }

            #region InsertDonHangVe
            GiaVeCuaGhe giaVe = new GiaVeCuaGhe();
            giaVe.Rap     = rap;
            giaVe.Suat    = lbSuatChieu.SelectedValue.ToString();
            giaVe.KhanDai = lbKhanDai.SelectedValue.ToString();
            DAODonHangVe.Insert(txtTenKhach.Text,
                                txtTamTinh.Text,
                                lbDiscount.Text,
                                txtSoTienThanhToan.Text,
                                rap);
            #endregion
            #region update Trạng thái của ghế

            foreach (KeyValuePair <string, int> item in lstGheDangChon)
            {
                DAOGiaVeCuaGhe.ChuyenTrangThaiDa(item.Key, giaVe);
            }

            #endregion
            string dsGhe = "";
            foreach (KeyValuePair <string, int> item in lstGheDangChon)
            {
                dsGhe += item.Key + "    ";
            }

            #region In Hóa Đơn
            string HoaDon = "Anh / Chi : " + txtTenKhach.Text + "\r\n" +
                            "dia chi : " + txtDiaChi.Text + "\r\n" +
                            "Phim : " + lbTenPhim.Text + "\r\n" +
                            "suat chieu  :  " + lbSuatChieu.Text + "\r\n" +
                            "khan dai   :  " + txtDiaChi.Text + "\r\n" +
                            "tam tinh   :  " + txtTamTinh.Text + "\r\n" +
                            "Disocunt  :  " + lbDiscount.Text + "\r\n" +
                            "giam   :   " + txtGiam.Text + "\r\n" +
                            "tong tien   :   " + txtSoTienThanhToan.Text + "\r\n" +
                            "ghe da chon   :  " + dsGhe;
            using (SaveFileDialog sfd = new SaveFileDialog()
            {
                Filter = "DPF file|*.pdf", ValidateNames = true
            })
            {
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    iTextSharp.text.Document doc = new iTextSharp.text.Document(PageSize.A6.Rotate());

                    try
                    {
                        PdfWriter.GetInstance(doc, new FileStream(sfd.FileName, FileMode.Create));
                        doc.Open();
                        Paragraph a = new Paragraph(HoaDon);

                        doc.Add(new iTextSharp.text.Paragraph(a));
                    }
                    catch (Exception ex) {
                        MessageBox.Show(ex.Message);
                    }
                    finally { doc.Close(); }
                }
            }
            #endregion
            InsertVe();
            MessageBox.Show("Đã Đặt xong ghế");
            Reset();//set default cho form
        }