Beispiel #1
0
        public void procedure_UpdatePhieuDat()
        {
            while (isRunning)
            {
                if (bllTS.getQuyDinhHuy() <= 0)
                {
                    return;
                }
                DataTable dt = bllPDC.getThongTinPhieuHuy();
                if (dt == null)
                {
                    return;
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DanhSachGhe DSG = new DanhSachGhe();
                    DSG.MaChuyenBay = dt.Rows[i][1].ToString();
                    DSG.HangVe      = dt.Rows[i][2].ToString();
                    DSG.SoGheTrong  = bllDSG.getSoGheTrong(DSG.MaChuyenBay, DSG.HangVe) + 1;

                    bllDSG.UpdateSoGheTrong(DSG);
                    bllPDC.HuyPhieuDatCho(dt.Rows[i][0].ToString());
                }
                dt.Dispose();
            }
        }
Beispiel #2
0
        private void btReservate_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                PhieuDatCho PDC = new PhieuDatCho();

                PDC.MaChuyenBay   = tbMaChuyenBay.Text;
                PDC.HangVe        = cbHangVe.Text;
                PDC.GiaTien       = decimal.Parse(lbGiaTien.Text);
                PDC.TrangThai     = "Chưa xuất vé";
                PDC.HoTen         = tbHoTen.Text;
                PDC.CMND          = tbCMND.Text;
                PDC.SDT           = tbSDT.Text;
                PDC.Email         = tbEmail.Text;
                PDC.NgayHuy       = bllCB.getNgayKhoiHanh(tbMaChuyenBay.Text);
                PDC.MaPhieuDatCho = bllPDC.getMaPhieuDatCho();

                if (bllPDC.insertPhieuDatCho(PDC))
                {
                    lbNotify.Text      = "Thành công, vui lòng kiểm tra mail để xác nhận thông tin";
                    lbNotify.ForeColor = Color.FromArgb(8, 186, 29);

                    DanhSachGhe DSG = new DanhSachGhe();
                    DSG.MaChuyenBay = PDC.MaChuyenBay;
                    DSG.HangVe      = PDC.HangVe;
                    DSG.SoGheTrong  = bllDSG.getSoGheTrong(tbMaChuyenBay.Text, cbHangVe.Text) - 1;

                    bllDSG.UpdateSoGheTrong(DSG);

                    SendMail(PDC);
                }
                else
                {
                    lbNotify.ForeColor = Color.Red;
                    lbNotify.Text      = "Đã có lỗi xảy ra, vui lòng thử lại sau";
                }
            }
        }
Beispiel #3
0
        public bool CheckInput()
        {
            lbNotify.Visible = true;

            if (string.IsNullOrEmpty(tbMaChuyenBay.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Bạn chưa chọn chuyến bay";
                return(false);
            }
            if (bllDSG.getSoGheTrong(tbMaChuyenBay.Text, cbHangVe.Text) <= 0)
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Đã hết chỗ";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(tbHoTen.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Bạn chưa nhập họ tên";
                tbHoTen.Focus();
                return(false);
            }
            if (!string.IsNullOrWhiteSpace(tbCMND.Text) && !CheckCMND(tbCMND.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "CMND không hợp lệ, CMND phải đủ 9 số";
                tbCMND.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(tbSDT.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Bạn chưa nhập số điện thoại";
                tbSDT.Focus();
                return(false);
            }
            if (!CheckSDT(tbSDT.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Số điện thoại không hợp lệ, bắt đầu từ 0 và từ 9 đến 10 số";
                tbSDT.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(tbEmail.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Bạn chưa nhập Email";
                tbSDT.Focus();
                return(false);
            }
            if (!CheckEmail(tbEmail.Text))
            {
                lbNotify.ForeColor = Color.Red;
                lbNotify.Text      = "Email không hợp lệ";
                tbSDT.Focus();
                return(false);
            }
            lbNotify.Visible = false;
            return(true);
        }