• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DAL.QUANLYXEKHACHEntities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BanVeXePhuongTrang.DAL.QUANLYXEKHACHEntities的典型用法代码示例。如果您正苦于以下问题:C# QUANLYXEKHACHEntities类的具体用法?C# QUANLYXEKHACHEntities怎么用?C# QUANLYXEKHACHEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QUANLYXEKHACHEntities类属于BanVeXePhuongTrang.DAL命名空间,在下文中一共展示了QUANLYXEKHACHEntities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: frmThemTuyenXe

        public frmThemTuyenXe(tblTuyenXe tuyenXe)
        {
            InitializeComponent();
            editMode = true;
            cbbBenXeDen.Enabled = false;
            cbbBenXeDi.Enabled = false;


            foreach (var item in new QUANLYXEKHACHEntities().tblBenXes.ToList())
            {
                cbbBenXeDen.Items.Add(item.TenBenXe);
                cbbBenXeDi.Items.Add(item.TenBenXe);
            }
            // Edit mode
            cbbBenXeDi.SelectedItem = tuyenXe.tblBenXe.TenBenXe;
            cbbBenXeDen.SelectedItem = tuyenXe.tblBenXe1.TenBenXe;
            txtMaTuyen.Text = tuyenXe.MaTuyen;

            dtgChiTietTuyen.Rows.Clear();
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            List<tblChiTietTuyen> listChiTietTuyen = tuyenXe.tblChiTietTuyens.ToList();
            for (int i = 0; i < listChiTietTuyen.Count; i++)
            {
                DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)dtgChiTietTuyen.Rows[i].Cells["BenXeTrungGian"];
                foreach (var row in db.tblBenXes.Select(t => t.TenBenXe).ToList())
                    cell.Items.Add(row);

                cell.Value = listChiTietTuyen[i].tblBenXe.TenBenXe;
                dtgChiTietTuyen.Rows[i].Cells["ThoiGianDung"].Value = listChiTietTuyen[i].ThoiGianDung;
                dtgChiTietTuyen.Rows[i].Cells["GhiChu"].Value = listChiTietTuyen[i].GhiChu;
            } 
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:32,代码来源:frmThemTuyenXe.cs


示例2: frmLichChuyenDi

        public frmLichChuyenDi(tblChuyenDi chuyenDi)
        {
            InitializeComponent();
            editMode = true;
            try
            {
                QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
                txtMaChuyenDi.Text = chuyenDi.MaChuyenDi.ToString();
                txtGiaVe.Text = chuyenDi.DonGia.ToString();

                cbbMaTuyen.DataSource = db.tblTuyenXes.Select(t => t.MaTuyen).ToList();
                cbbMaTuyen.SelectedItem = chuyenDi.tblXeKhach.MaTuyen;
                txtTuyen.Text = chuyenDi.tblXeKhach.tblTuyenXe.tblBenXe.TenBenXe + "-" + chuyenDi.tblXeKhach.tblTuyenXe.tblBenXe1.TenBenXe;
                dtpKhoiHanh.Value = chuyenDi.KhoiHanh.Value;
                dtpKetThuc.Value = chuyenDi.KhoiHanh.Value.AddMinutes(chuyenDi.tblXeKhach.tblTuyenXe.ThoiGianDi);

                dtgBXTrungGian.Rows.Clear();
                foreach (var item in db.tblChiTietTuyens.Where(t => t.MaTuyen == chuyenDi.tblXeKhach.MaTuyen).ToList())
                {
                    dtgBXTrungGian.Rows.Add(item.tblBenXe.TenBenXe,
                                            item.ThoiGianDung,
                                            item.GhiChu);
                }

                cbbMaXe.DataSource = db.tblXeKhaches.Where(t => t.MaTuyen == chuyenDi.tblXeKhach.MaTuyen).Select(t => t.MaXe).ToList();
            }
            catch 
            { }
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:29,代码来源:frmLichChuyenDi.cs


示例3: btnThem_Click

        private void btnThem_Click(object sender, EventArgs e)
        {
            try 
            { 
                BLL_BenXe temp = new BLL_BenXe();
                if (temp.canInsert(txtMaBenXe.Text.ToString(), txtTenBenXe.Text.ToString()))
                {
                    QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();

                    tblBenXe t = new tblBenXe();
                    t.MaBenXe = txtMaBenXe.Text.ToString();
                    t.TenBenXe = txtTenBenXe.Text.ToString();
                    db.tblBenXes.Add(t);
                    db.SaveChanges();

                    btnTaoMoi_Click(sender, e);
                    MessageBox.Show("Thêm thành công");
                }
                else 
                {
                    MessageBox.Show("Không thành công");
                }
            }
            catch { }
        }
开发者ID:letuananhtn94,项目名称:QLBanVeXePhuongTrang,代码行数:25,代码来源:frmThemBenXe.cs


示例4: btThem_Click

        private void btThem_Click(object sender, EventArgs e)
        {
            tblChiTietTrungChuyen temp = new tblChiTietTrungChuyen();
            temp.MaPhieu = int.Parse(dtgKhachHang.CurrentRow.Cells["MaPhieu_KH"].Value.ToString());
            dynamic selectedItem = cbbXeTrungChuyen.SelectedItem;
            string bienSoXe = selectedItem.BienSo;
            temp.SoLuong = int.Parse(dtgKhachHang.CurrentRow.Cells["SoVe_KH"].Value.ToString());

            try
            {
                QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
                tblXeTrungChuyen xeTC = db.tblXeTrungChuyens.Where(t => t.BienSoXe == bienSoXe).SingleOrDefault();
                if(xeTC != null)
                {
                    temp.MaXe = xeTC.MaXe;
                    temp.DaRuoc = false;
                    db.tblChiTietTrungChuyens.Add(temp);
                    db.SaveChanges();

                    dtgDanhSachTC.Rows.Add(dtgKhachHang.CurrentRow.Cells["HoTen_KH"].Value,
                                       dtgKhachHang.CurrentRow.Cells["MaPhieu_KH"].Value,
                                       dtgKhachHang.CurrentRow.Cells["SDT_KH"].Value,
                                       dtgKhachHang.CurrentRow.Cells["DiaDiem_KH"].Value,
                                       dtgKhachHang.CurrentRow.Cells["SoVe_KH"].Value);
                    dtgKhachHang.Rows.RemoveAt(dtgKhachHang.CurrentRow.Index);    
                }    
            }
            catch
            {
                MessageBox.Show("Lỗi");
            }         
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:32,代码来源:frmQuanLyTrungChuyen.cs


示例5: cbMaChuyenDi_SelectedIndexChanged

        private void cbMaChuyenDi_SelectedIndexChanged(object sender, EventArgs e)
        {
            khoiPhucTinhTrangGhe();

            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            int maChuyen = int.Parse(cbbMaChuyenDi.SelectedItem.ToString());
            tblChuyenDi chuyenDi = db.tblChuyenDis.Where(t => t.MaChuyenDi == maChuyen).SingleOrDefault();
            txtTuyen.Text = chuyenDi.tblXeKhach.tblTuyenXe.tblBenXe.TenBenXe.ToString() + "-" + chuyenDi.tblXeKhach.tblTuyenXe.tblBenXe1.TenBenXe.ToString();
            txtKhoiHanh.Text = chuyenDi.KhoiHanh.Value.ToString();
            txtGia.Text = chuyenDi.DonGia.ToString();
         
            foreach (var item in chuyenDi.tblChiTietPhieuDatChoes.ToList())
            {
                if(chuyenDi.tblXeKhach.MaLoaiXe == 1) // ghế ngồi
                {
                    if (item.LayVe.Value)
                        capNhatTinhTrangGhe(idGheThuong + item.ViTriGhe, Color.Red, pnlXeThuong);
                    else
                        capNhatTinhTrangGhe(idGheThuong + item.ViTriGhe, Color.Green, pnlXeThuong);
                }
                else
                {
                    if (item.LayVe.Value)
                        capNhatTinhTrangGhe(idGheNam + item.ViTriGhe, Color.Red, pnlGiuongNam);
                    else
                        capNhatTinhTrangGhe(idGheNam + item.ViTriGhe, Color.Green, pnlGiuongNam);
                }
            }

            tabXeThuong.Visible = tabXeGiuongNam.Visible = true;
            if (chuyenDi.tblXeKhach.MaLoaiXe == 1) // ghế ngồi
                tabXeGiuongNam.Visible = false;
            else
                tabXeThuong.Visible = false;
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:35,代码来源:frmVeXe.cs


示例6: btSua_Click

        private void btSua_Click(object sender, EventArgs e)
        {
            frmSuaXe form = null;
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            if(dtgDanhSachXeKhachSelected)
            {
                int maXe = int.Parse(dtgDSXeKhach.CurrentRow.Cells["MaXe"].Value.ToString());
                tblXeKhach xe = db.tblXeKhaches.Where(t => t.MaXe == maXe).SingleOrDefault();
                if(xe != null)
                {
                    form = new frmSuaXe(xe);
                }
            }
            else
            {
                int maXe = int.Parse(dtgDSXeTrungChuyen.CurrentRow.Cells["MaXeTC"].Value.ToString());
                tblXeTrungChuyen xe = db.tblXeTrungChuyens.Where(t => t.MaXe == maXe).SingleOrDefault();
                if (xe != null)
                {
                    form = new frmSuaXe(xe);
                }
            }

            form.ShowDialog();
            frmQuanLyXe_Load(sender, e);
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:26,代码来源:frmQuanLyXe.cs


示例7: frmTraCuuTrungChuyen

        public frmTraCuuTrungChuyen()
        {
            InitializeComponent();

            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            cbbXeTrungChuyen.DataSource = db.tblXeTrungChuyens.Select(t => new { BienSo = t.BienSoXe, DiaDiem = t.DiaDiemTrungChuyen }).ToList();
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:7,代码来源:frmTraCuuTrungChuyen.cs


示例8: btnXoa_Click

        private void btnXoa_Click(object sender, EventArgs e)
        {
            int rowIndex = dtgChuyenDi.CurrentCell.RowIndex;
            DataGridViewRow row = dtgChuyenDi.Rows[rowIndex];

            int maChuyenDi = int.Parse(row.Cells["MaChuyenDi"].Value.ToString());
            string message = string.Format("Bạn muốn xóa chuyến đi\nBiển sô xe: {0}\nTuyến: {1}\nKhởi hành: {2}", row.Cells["BienSoXe"].Value, row.Cells["TuyenXe"].Value, row.Cells["KhoiHanh"].Value);
            DialogResult result = MessageBox.Show(message, "Thông báo", MessageBoxButtons.YesNo);
            if(result == System.Windows.Forms.DialogResult.Yes)
            {
                BLL.BLL_ChuyenDi temp = new BLL.BLL_ChuyenDi();
                if (temp.canDelete(maChuyenDi))
                {
                    QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();

                    tblChuyenDi chuyenDi = db.tblChuyenDis.Where(t => t.MaChuyenDi == maChuyenDi).SingleOrDefault();
                    if (chuyenDi != null)
                    {
                        // Xóa báo cáo
                        tblBaoCaoDoanhThuChuyenDi bcChuyenDi = db.tblBaoCaoDoanhThuChuyenDis.Where(t => t.MaChuyenDi == chuyenDi.MaChuyenDi).SingleOrDefault();
                        if(bcChuyenDi != null)
                            db.tblBaoCaoDoanhThuChuyenDis.Remove(bcChuyenDi);

                        db.tblChuyenDis.Remove(chuyenDi);
                        db.SaveChanges();

                        MessageBox.Show("Xóa thành công");
                        frmQuanLyChuyenDi_Load(sender, e);
                    }
                }
                else
                    MessageBox.Show("Chuyến đi đã có khách hàng đặt vé hoặc mua, không thể xóa");
            }
 
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:35,代码来源:frmQuanLyChuyenDi.cs


示例9: solveDataInputChiTietTuyen

        private List<tblChiTietTuyen> solveDataInputChiTietTuyen()
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            List<tblChiTietTuyen> list = new List<tblChiTietTuyen>();

            foreach (DataGridViewRow row in dtgChiTietTuyen.Rows)
            {
                if (string.IsNullOrEmpty(row.Cells[0].Value + "") && string.IsNullOrEmpty(row.Cells[1].Value + ""))
                    break;

                string MaBenXeTrungGian = "";
                string tenBenXe = row.Cells[0].Value.ToString();
                tblBenXe benXe = db.tblBenXes.Where(t => t.TenBenXe == tenBenXe).SingleOrDefault();
                if (benXe != null)
                    MaBenXeTrungGian = benXe.MaBenXe;

                tblChiTietTuyen temp = new tblChiTietTuyen();
                temp.MaBenXeTrungGiang = MaBenXeTrungGian;

                if (!string.IsNullOrEmpty(row.Cells[1].Value + ""))
                    temp.ThoiGianDung = int.Parse(row.Cells[1].Value.ToString());
                else
                    temp.ThoiGianDung = 0;
                temp.MaTuyen = txtMaTuyen.Text.ToString();
                if (row.Cells[2].Value != null)
                    temp.GhiChu = row.Cells[2].Value.ToString();
                else
                    temp.GhiChu = "";

                list.Add(temp);
            }

            return list;
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:34,代码来源:frmThemTuyenXe.cs


示例10: frmDanhSachDatVe_Load

        private void frmDanhSachDatVe_Load(object sender, EventArgs e)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();

            cbbBenXeDen.DataSource = db.tblBenXes.Select(t => t.TenBenXe).ToList();
            cbbBenXeDi.DataSource = db.tblBenXes.Select(t => t.TenBenXe).ToList();
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:7,代码来源:frmDanhSachDatVe.cs


示例11: canDelete

        public bool canDelete(int maNV)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            if (db.tblNhanViens.Where(t => t.MaNhanVien == maNV).ToArray().Length != 0)
                return true;

            return false;
        }
开发者ID:letuananhtn94,项目名称:QLBanVeXePhuongTrang,代码行数:8,代码来源:BLL_NhanVien.cs


示例12: canUpdate

        public bool canUpdate(int maNV, int cmnd)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            if (db.tblNhanViens.Where(t => t.MaNhanVien != maNV && t.CMND == cmnd).ToArray().Length != 0)
                return false;

            return true;
        }
开发者ID:letuananhtn94,项目名称:QLBanVeXePhuongTrang,代码行数:8,代码来源:BLL_NhanVien.cs


示例13: btSua_Click

 private void btSua_Click(object sender, EventArgs e)
 {
     string maTuyen = dtgDanhSachTuyen.CurrentRow.Cells["MaTuyen"].Value.ToString();
     tblTuyenXe tuyenXe = new QUANLYXEKHACHEntities().tblTuyenXes.Where(t => t.MaTuyen == maTuyen).SingleOrDefault();
     frmThemTuyenXe form = new frmThemTuyenXe(tuyenXe);
     form.ShowDialog();
     frmQuanLyTuyenXe_Load(sender, e);
 }
开发者ID:duphattai,项目名称:OOAD,代码行数:8,代码来源:frmQuanLyTuyenXe.cs


示例14: canDelete

        public bool canDelete(string maBen)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            if (db.tblBenXes.Where(t => t.MaBenXe == maBen).ToArray().Length != 0)
                return true;

            return false;
        }
开发者ID:letuananhtn94,项目名称:QLBanVeXePhuongTrang,代码行数:8,代码来源:BLL_BenXe.cs


示例15: getLastestIndex

 public int getLastestIndex()
 {
     QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
     if (db.tblChiTietPhieuDatChoes.ToArray().Length == 0)
         return 1;
     else
         return db.tblChiTietPhieuDatChoes.Max(t => t.MaCTPhieu) + 1;
 }
开发者ID:duphattai,项目名称:OOAD,代码行数:8,代码来源:BLL_ChiTietPhieuDatCho.cs


示例16: getLastestIndex

 public int getLastestIndex()
 {
     QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
     if (db.tblXeTrungChuyens.ToArray().Length == 0)
         return 1;
     else
         return db.tblXeTrungChuyens.Max(t => t.MaXe) + 1;
 }
开发者ID:duphattai,项目名称:OOAD,代码行数:8,代码来源:BLL_XeTrungChuyen.cs


示例17: canUpdate

        public bool canUpdate(string tenDN, string mk)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            if (db.tblTaiKhoans.Where(t => t.TenTaiKhoan == tenDN && t.MatKhau == mk).ToArray().Length != 0)
                return false;

            return true;
        }
开发者ID:letuananhtn94,项目名称:QLBanVeXePhuongTrang,代码行数:8,代码来源:BLL_TaiKhoan.cs


示例18: frmDoiMatKhau_Load

 private void frmDoiMatKhau_Load(object sender, EventArgs e)
 {
     int MaNV = ma;
     QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
     tblTaiKhoan tk = db.tblTaiKhoans.Where(t => t.MaNhanVien == MaNV).SingleOrDefault();
     txtTenNguoiDung.Text = tk.tblNhanVien.TenNhanVien.ToString();
     txtTenDangNhap.Text = tk.TenTaiKhoan.ToString();
 }
开发者ID:letuananhtn94,项目名称:QLBanVeXePhuongTrang,代码行数:8,代码来源:frmDoiMatKhau.cs


示例19: canUpdate

        public bool canUpdate(int maChuyen, int? maXe)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();
            if (db.tblChuyenDis.Where(t => t.MaChuyenDi == maChuyen).ToArray().Length != 0)
                return true;

            return false;
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:8,代码来源:BLL_ChuyenDi.cs


示例20: validateInput

        public string validateInput(int maPhieu, string hoTen, int? dienThoai)
        {
            QUANLYXEKHACHEntities db = new QUANLYXEKHACHEntities();

            if (db.tblPhieuDatChoes.Where(t => t.DienThoai == dienThoai || t.MaPhieu == maPhieu).Count() != 0)
                return "Hành khách đã tồn tại";
            return null;
        }
开发者ID:duphattai,项目名称:OOAD,代码行数:8,代码来源:BLL_PhieuDatCho.cs



注:本文中的BanVeXePhuongTrang.DAL.QUANLYXEKHACHEntities类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DAL.DataHandler类代码示例发布时间:2022-05-24
下一篇:
C# Math.Vector类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap