예제 #1
0
        public frmFlightEditing(ChuyenBay cb)
        {
            onloading = true;
            chuyenBay = cb;
            InitializeComponent();
            checkState();
            loadData();
            cthvs = BLL_CTHV.GetCTHVs(chuyenBay.maCB);
            ctcbs = BLL_CTCB.GetCTCBs(chuyenBay.maCB);

            tbMaCB.Text           = chuyenBay.strMaCB;
            nGiaVe.Value          = chuyenBay.DonGia;
            cbSBDi.SelectedValue  = chuyenBay.TB.SBDi.maSB;
            cbSBDen.SelectedValue = chuyenBay.TB.SBDen.maSB;
            dtpNgay.Value         = chuyenBay.ThoiGian;
            dtpGio.Value          = chuyenBay.ThoiGian;
            nTGBayH.Value         = chuyenBay.ThoiLuong / 60;
            nTGBayM.Value         = chuyenBay.ThoiLuong % 60;
            nSLGhe1.Value         = cthvs[0].SLGhe;
            nSLGhe2.Value         = cthvs[1].SLGhe;

            // thông tin chuyến bay trung gian
            loaddgv();

            //TuyenBay tb = new TuyenBay();
            //int donGia = Convert.ToInt32(nGiaVe.Value);
            //DateTime tg = dtpNgay.Value.Date + dtpGio.Value.TimeOfDay;
            //int tl = Convert.ToInt32(nTGBayH.Value * 60 + nTGBayM.Value);
            //int sg = Convert.ToInt32(nSLGhe1.Value + nSLGhe2.Value);
        }
예제 #2
0
        public override void Create()
        {
            AppState.state = Actions.ADD;
            var          dialog = new frmFlightEditing();
            DialogResult res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                if (BLL_ChuyenBay.InsertChuyenBay(dialog.chuyenBay))
                {
                    int lastCB = BLL_ChuyenBay.GetLastMaCB();
                    for (int i = 0; i < dialog.ctcbs.Count; i++)
                    {
                        BLL_CTCB.InsertCTCB(dialog.ctcbs[i], lastCB);
                    }
                    for (int i = 0; i < dialog.cthvs.Count; i++)
                    {
                        BLL_CTHV.InsertCTHV(dialog.cthvs[i], lastCB);
                    }
                    reloadData();
                    Notification.Show("Thêm chuyến bay thành công", Status.SUCCESS);
                }
            }
            AppState.state = Actions.NOTHING;
        }
예제 #3
0
        private void Edit(DataGridViewRow row)
        {
            AppState.state = Actions.EDIT;
            var          dialog = new frmFlightEditing(currentCB);
            DialogResult res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                BLL_ChuyenBay.UpdateChuyenBay(dialog.chuyenBay);
                BLL_CTCB.DeleteCTCB(dialog.chuyenBay.maCB);
                for (int i = 0; i < dialog.ctcbs.Count; i++)
                {
                    BLL_CTCB.InsertCTCB(dialog.ctcbs[i], dialog.chuyenBay.maCB);
                }
                for (int i = 0; i < dialog.cthvs.Count; i++)
                {
                    BLL_CTHV.UpdateCTHV(dialog.cthvs[i]);
                }
                reloadData();
            }
            AppState.state = Actions.NOTHING;
        }