Beispiel #1
0
        public static bool InsertHangVe(HangVe hangVe)
        {
            string cmdText = string.Format("INSERT INTO HANGVE(TenHV,TiLe,ISDELETE) VALUES (N'{0}',{1},{2})", hangVe.TenHV, hangVe.TiLe, 0);
            bool   insert  = DataProvider.ExecuteNonQuery(cmdText);

            return(insert);
        }
Beispiel #2
0
        private void Edit(DataGridViewRow row)
        {
            AppState.state = Actions.EDIT;
            int      maVe      = (int)row.Cells["MaVe"].Value;
            int      maCB      = (int)row.Cells["MaCB"].Value;
            string   tenHK     = (string)row.Cells["TenHK"].Value;
            string   cmnd      = (string)row.Cells["CMND"].Value;
            string   dienThoai = (string)row.Cells["DienThoai"].Value;
            DateTime thoiGian  = (DateTime)row.Cells["ThoiGian"].Value;
            HangVe   hv        = (HangVe)row.Cells["HV"].Value;
            int      giaVe     = (int)row.Cells["GiaVe"].Value;

            Ve ve = new Ve(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe);

            var          dialog = new frmVeEditing(ve);
            DialogResult res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                if (BLL_Ve.UpdateVe(dialog.ve))
                {
                    Notification.Show("Chỉnh sửa vé thành công", Status.SUCCESS);
                }
                reloadData();
            }
            AppState.state = Actions.NOTHING;
        }
Beispiel #3
0
        public static bool DeleteHangVe(HangVe hv)
        {
            string cmdText = string.Format("Update HANGVE set ISDELETE = 1 where MaHV = {0}", hv.maHV);
            bool   res     = DataProvider.ExecuteNonQuery(cmdText);

            return(res);
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(string HangID, [Bind("HangID,TenHang,TiLeGia")] HangVe hangVe)
        {
            if (HangID != hangVe.HangID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hangVe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HangVeExists(hangVe.HangID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hangVe));
        }
Beispiel #5
0
        public static bool UpdateHangVe(HangVe hangVe)
        {
            string cmdText = string.Format("UPDATE HANGVE SET TenHV = N'{0}',TiLe={1} WHERE MaHV = {2}", hangVe.TenHV, hangVe.TiLe, hangVe.maHV);
            bool   update  = DataProvider.ExecuteNonQuery(cmdText);

            return(update);
        }
Beispiel #6
0
        public int Update(HangVe HangVe)
        {
            string sql = string.Format("Update GiaoDich Set MaHangVe='{1}', MaChuyenBay='{2}', GiaVe='{3}', SoCho='{4}'  Where MaGiaoDich={0}",
                                       HangVe.MaHangVe, HangVe.MaChuyenBay, HangVe.GiaVe, HangVe.SoCho);
            var rs = ProcessData.ExecuteNonQuery(sql);

            return(rs);
        }
Beispiel #7
0
        public int Insert(HangVe HangVe)
        {
            string sql = string.Format("Insert into HangVe(MaHangVe, MaChuyenBay, GiaVe, SoCho)  Values('{0}','{1}',{2},{3})",
                                       HangVe.MaHangVe, HangVe.MaChuyenBay, HangVe.GiaVe, HangVe.SoCho);
            var rs = ProcessData.ExecuteNonQuery(sql);

            return(rs);
        }
Beispiel #8
0
        public async Task <IActionResult> Create([Bind("HangID,TenHang,TiLeGia")] HangVe hangVe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hangVe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hangVe));
        }
Beispiel #9
0
        public static HangVe GetHangVe(int MaHV)
        {
            string    cmdText = String.Format("select * from HANGVE Where MaHV={0}", MaHV);
            DataTable dt      = DataProvider.ExecuteReader(cmdText);

            if (dt != null && dt.Rows.Count > 0)
            {
                HangVe hv = new HangVe((int)dt.Rows[0]["MaHV"], dt.Rows[0]["TenHV"].ToString(), (double)dt.Rows[0]["TiLe"]);
                return(hv);
            }
            return(null);
        }
Beispiel #10
0
        private void Edit(DataGridViewRow row)
        {
            if ((int)row.Cells["TinhTrang"].Value == 1 && (((DateTime)row.Cells["ThoiGian"].Value) - DateTime.Now).Hours < ThamSo.TGHuyDatVe)
            {
                Notification.Show("Phiếu đặt chỗ đã quá thời gian", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã quá thời gian\n-->Tiến hành hủy");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 2)
            {
                Notification.Show("Phiếu đặt chỗ đã bán không thể chỉnh sửa", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã bán không thể chỉnh sửa");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 3)
            {
                Notification.Show("Phiếu đặt chỗ đã hủy không thể chỉnh sửa", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã hủy không thể chỉnh sửa");
                dialog1.ShowDialog();
                return;
            }
            AppState.state = Actions.EDIT;
            int      maVe      = (int)row.Cells["MaVe"].Value;
            int      maCB      = (int)row.Cells["MaCB"].Value;
            string   tenHK     = (string)row.Cells["TenHK"].Value;
            string   cmnd      = (string)row.Cells["CMND"].Value;
            string   dienThoai = (string)row.Cells["DienThoai"].Value;
            DateTime thoiGian  = (DateTime)row.Cells["ThoiGian"].Value;
            HangVe   hv        = (HangVe)row.Cells["HV"].Value;
            int      giaVe     = (int)row.Cells["GiaVe"].Value;
            int      tt        = (int)row.Cells["TinhTrang"].Value;

            PhieuDatCho pdc = new PhieuDatCho(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe, tt);

            var          dialog = new frmPhieuDatChoEditing(pdc);
            DialogResult res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                if (BLL_PhieuDatCho.UpdatePhieuDatCho(dialog.pdc))
                {
                    Notification.Show("Chỉnh sửa phiếu đặt chỗ thành công", Status.SUCCESS);
                }
                reloadData();
            }
            AppState.state = Actions.NOTHING;
        }
Beispiel #11
0
        private void Sale(DataGridViewRow row)
        {
            if ((int)row.Cells["TinhTrang"].Value == 1 && (((DateTime)row.Cells["ThoiGian"].Value) - DateTime.Now).Hours < ThamSo.TGHuyDatVe)
            {
                Notification.Show("Phiếu đặt chỗ đã quá thời gian", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã quá thời gian\n-->Tiến hành hủy");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 2)
            {
                Notification.Show("Phiếu đặt chỗ đã bán", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã bán");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 3)
            {
                Notification.Show("Phiếu đặt chỗ đã hủy không thể bán", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã hủy không thể bán");
                dialog1.ShowDialog();
                return;
            }
            int      maVe      = (int)row.Cells["MaVe"].Value;
            int      maCB      = (int)row.Cells["MaCB"].Value;
            string   tenHK     = (string)row.Cells["TenHK"].Value;
            string   cmnd      = (string)row.Cells["CMND"].Value;
            string   dienThoai = (string)row.Cells["DienThoai"].Value;
            DateTime thoiGian  = (DateTime)row.Cells["ThoiGian"].Value;
            HangVe   hv        = (HangVe)row.Cells["HV"].Value;
            int      giaVe     = (int)row.Cells["GiaVe"].Value;
            int      tt        = (int)row.Cells["TinhTrang"].Value;

            PhieuDatCho pdc    = new PhieuDatCho(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe, tt);
            var         dialog = new frmWarning("Cảnh Báo!!!", "Bạn có muốn bán vé không?");
            var         res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                pdc.tinhTrang = 2;
                if (BLL_PhieuDatCho.SalePhieuDatCho(pdc))
                {
                    Notification.Show("Bán vé thành công", Status.SUCCESS);
                }
                BLL_PhieuDatCho.UpdatePhieuDatCho(pdc);
                reloadData();
            }
        }
Beispiel #12
0
        public static List <HangVe> SearchTenHV(string tenHV)
        {
            string    cmdText = String.Format("select * from HangVe where TenHV like N'%{0}%'", tenHV);
            DataTable dt      = DataProvider.ExecuteReader(cmdText);

            if (dt != null && dt.Rows.Count > 0)
            {
                List <HangVe> HangVe = new List <HangVe>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    HangVe hv = new HangVe((int)dt.Rows[i]["MaHV"], dt.Rows[i]["TenHV"].ToString(), (double)dt.Rows[i]["TiLe"]);
                    HangVe.Add(hv);
                }
                return(HangVe);
            }
            return(null);
        }
Beispiel #13
0
        public static List <HangVe> GetHangVes()
        {
            string    cmdText = @"select * from HANGVE where ISDELETE = 0";
            DataTable dt      = DataProvider.ExecuteReader(cmdText);

            if (dt != null && dt.Rows.Count > 0)
            {
                List <HangVe> HangVe = new List <HangVe>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    HangVe hv = new HangVe((int)dt.Rows[i]["MaHV"], dt.Rows[i]["TenHV"].ToString(), (double)dt.Rows[i]["TiLe"]);
                    HangVe.Add(hv);
                }
                return(HangVe);
            }
            return(null);
        }
Beispiel #14
0
        private void Detail(DataGridViewRow row)
        {
            int      maVe      = (int)row.Cells["MaVe"].Value;
            int      maCB      = (int)row.Cells["MaCB"].Value;
            string   tenHK     = (string)row.Cells["TenHK"].Value;
            string   cmnd      = (string)row.Cells["CMND"].Value;
            string   dienThoai = (string)row.Cells["DienThoai"].Value;
            DateTime thoiGian  = (DateTime)row.Cells["ThoiGian"].Value;
            HangVe   hv        = (HangVe)row.Cells["HV"].Value;
            int      giaVe     = (int)row.Cells["GiaVe"].Value;

            Ve ve = new Ve(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe);

            var          dialog = new frmVeEditing(ve);
            DialogResult res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
            }
        }
Beispiel #15
0
        private void cancel(DataGridViewRow row)
        {
            if ((int)row.Cells["TinhTrang"].Value == 2)
            {
                Notification.Show("Phiếu đặt chỗ đã bán không thể hủy", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã bán không thể hủy");
                dialog1.ShowDialog();
                return;
            }
            else if ((int)row.Cells["TinhTrang"].Value == 3)
            {
                Notification.Show("Phiếu đặt chỗ đã hủy", Status.WARNING);
                var dialog1 = new frmWarning("Thông Báo", "Phiếu đặt chỗ đã hủy");
                dialog1.ShowDialog();
                return;
            }
            int      maVe      = (int)row.Cells["MaVe"].Value;
            int      maCB      = (int)row.Cells["MaCB"].Value;
            string   tenHK     = (string)row.Cells["TenHK"].Value;
            string   cmnd      = (string)row.Cells["CMND"].Value;
            string   dienThoai = (string)row.Cells["DienThoai"].Value;
            DateTime thoiGian  = (DateTime)row.Cells["ThoiGian"].Value;
            HangVe   hv        = (HangVe)row.Cells["HV"].Value;
            int      giaVe     = (int)row.Cells["GiaVe"].Value;
            int      tt        = (int)row.Cells["TinhTrang"].Value;

            PhieuDatCho pdc    = new PhieuDatCho(maVe, maCB, tenHK, cmnd, dienThoai, thoiGian, hv, giaVe, tt);
            var         dialog = new frmWarning("Cảnh Báo!!!", "Bạn có muốn hủy phiếu đặt ghế không?");
            var         res    = dialog.ShowDialog();

            if (res == DialogResult.OK)
            {
                pdc.tinhTrang = 3;
                if (BLL_PhieuDatCho.UpdatePhieuDatCho(pdc))
                {
                    Notification.Show("Hủy phiếu đặt chỗ thành công", Status.SUCCESS);
                }
                reloadData();
            }
        }
        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            BUL_HangVe bUL_HangVe = new BUL_HangVe();

            if (txtMaHangVe.Text != "" && txtTenHangVe.Text != "")
            {
                HangVe hv = new HangVe(txtMaHangVe.Text, txtTenHangVe.Text, txtGhiChu.Text);

                if (bUL_HangVe.themHangVe(hv))
                {
                    MessageBox.Show("Thêm thành công");
                    dGVthemHangVe.DataSource = bUL_HangVe.getHV(); // refresh datagridview
                }
                else
                {
                    MessageBox.Show("Đã có lỗi xảy ra", "Lỗi");
                }
            }
            else
            {
                MessageBox.Show("Xin hãy nhập đầy đủ");
            }
        }
Beispiel #17
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            BUL_HangVe bUL_HangVe = new BUL_HangVe();

            if (txtMaHangVe.Text != "")
            {
                HangVe hv = new HangVe(txtMaHangVe.Text, txtTenHangVe.Text, txtGhiChu.Text);

                if (bUL_HangVe.suaHangVe(hv))
                {
                    MessageBox.Show("Sửa thành công");
                    xemdulieu();
                    addbinding();
                }
                else
                {
                    MessageBox.Show("Đã có lỗi xảy ra", "Lỗi");
                }
            }
            else
            {
                MessageBox.Show("Kiểm tra lại");
            }
        }
        public bool xoaHangVe(HangVe hV)
        {
            Ultilies ultilies = new Ultilies();

            return(ultilies.xoaHangVe(hV));
        }
Beispiel #19
0
 public static bool InsertHangVe(HangVe hangVe)
 {
     return(DAL_HangVe.InsertHangVe(hangVe));
 }
        public bool themHangVe(HangVe hV)
        {
            Ultilies ultilies = new Ultilies();

            return(ultilies.themHangVe(hV));
        }
Beispiel #21
0
 public static bool DeleteHangVe(HangVe hv)
 {
     return(DAL_HangVe.DeleteHangVe(hv));
 }
Beispiel #22
0
 public static bool UpdateHangVe(HangVe hangVe)
 {
     return(DAL_HangVe.UpdateHangVe(hangVe));
 }