コード例 #1
0
        private void frmPhieuSuaChua_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSet1.PhieuSuaChua' table. You can move, or remove it, as needed.
            this.phieuSuaChuaTableAdapter.Fill(this.dataSet1.PhieuSuaChua, cbBienSo.Text);
            cbBienSo.DataSource    = XeBUS.Xe_DanhSach();
            cbBienSo.DisplayMember = "BienSo";
            cbBienSo.ValueMember   = "BienSo";

            cbVTPT.DataSource    = VatTuPhuTungBUS.VatTuPhuTung_GetAll();
            cbVTPT.DisplayMember = "MaVatTuPhuTung";
            cbVTPT.ValueMember   = "DonGia";

            cbNoiDung.DataSource    = TienCongBUS.TienCong_GetAll();
            cbNoiDung.DisplayMember = "NoiDungSuaChua";
            cbNoiDung.ValueMember   = "DonGia";

            cbNoiDung.Text     = "";
            cbVTPT.Text        = "";
            lbcSoLuongTon.Text = "";
            txtSoLuong.Text    = "";

            this.cbBienSo.SelectedIndexChanged  += new System.EventHandler(this.cbBienSo_SelectedIndexChanged);
            this.cbNoiDung.SelectedIndexChanged += new System.EventHandler(this.cbNoiDung_SelectedIndexChanged);
            this.cbVTPT.SelectedIndexChanged    += new System.EventHandler(this.cbVTPT_SelectedIndexChanged);
        }
コード例 #2
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         Xe xe = new Xe()
         {
             BienSo = txtBienSo.Text
         };
         XeBUS.Xe_Delete(xe);
         MessageBox.Show("Xóa thành công!!");
         tableTiepNhanXe.DataSource = XeBUS.Xe_DanhSach();
         txtBienSo.Text             = "";
         txtDiaChi.Text             = "";
         txtDienThoai.Text          = "";
         txtEmail.Text          = "";
         txtTenChuXe.Text       = "";
         cbHieuXe.SelectedIndex = 0;
         txtBienSo.Focus();
     }
     catch (Exception)
     {
         MessageBox.Show("Không thể xóa xe đang sửa chữa!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     btnXoa.Enabled = false;
 }
コード例 #3
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (KiemTra())
     {
         Xe xe = new Xe();
         try
         {
             xe.TenChuXe     = txtTenChuXe.Text;
             xe.BienSo       = txtBienSo.Text;
             xe.DiaChi       = txtDiaChi.Text;
             xe.Email        = txtEmail.Text;
             xe.DienThoai    = txtDienThoai.Text;
             xe.HieuXe       = cbHieuXe.SelectedValue.ToString();
             xe.NgayTiepNhan = dateNgayTiepNhan.Text;
             //xe.TienNo = 0;
             XeBUS.Xe_Insert(xe);
             tableTiepNhanXe.DataSource = XeBUS.Xe_DanhSach();
             //tableTiepNhanXe.DataSource = XeBUS.Xe_DSTheoNgay(dateNgayTiepNhan.Text);
             // tableTiepNhanXe.DataSource = XeBUS.Xe_DSTheoNgay(xe.NgayTiepNhan.ToString());
             MessageBox.Show("Nhập thành công !!");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         finally
         {
             SQLDataProvider.connection.Close();
         }
         btnXoa.Enabled = false;
         //btnThemMoi.Enabled = true;
     }
 }
コード例 #4
0
 private void frmTimKiem_Load(object sender, EventArgs e)
 {
     cbHieuXe.DataSource      = HieuXeBUS.HieuXe_GetHieuXe();
     cbHieuXe.DisplayMember   = "HieuXe";
     cbHieuXe.ValueMember     = "HieuXe";
     cb_TimKiem.DataSource    = XeBUS.Xe_DanhSach();
     cb_TimKiem.DisplayMember = "TenChuXe";
     cb_TimKiem.ValueMember   = "TenChuXe";
     SQLDataProvider.connection.Close();
 }
コード例 #5
0
        private void frmPhieuThuTien_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'DataSet1.PhieuThuTien' table. You can move, or remove it, as needed.
            this.PhieuThuTienTableAdapter.Fill(this.DataSet1.PhieuThuTien, cbBienSo.Text);

            cbBienSo.DataSource    = XeBUS.Xe_DanhSach();
            cbBienSo.DisplayMember = "BienSo";
            cbBienSo.ValueMember   = "BienSo";
            // cbBienSo.SelectedIndexChanged = cbBienSo_SelectedIndexChanged(sender, e);
            cbBienSo.SelectedIndexChanged += cbBienSo_SelectedIndexChanged;
            //btnLapPhieu.Enabled = false;
            btnIn.Enabled = false;
        }
コード例 #6
0
 private void ReLoad()
 {
     if (rbt_BienSo.Checked == true)
     {
         table_DanhSach.DataSource = XeBUS.Xe_GetBienSo(cb_TimKiem.Text);
     }
     if (rbt_TenChuXe.Checked == true)
     {
         table_DanhSach.DataSource = XeBUS.Xe_GetTenChuXe(cb_TimKiem.Text);
     }
     if (rbt_HieuXe.Checked == true)
     {
         table_DanhSach.DataSource = XeBUS.Xe_GetHieuXe(cb_TimKiem.Text);
         if (table_DanhSach.Rows[0].Cells[0].Value == null)
         {
             MessageBox.Show("Chưa tiếp nhận hiệu xe này!!!", "Chọn lại!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     cb_TimKiem.DataSource = XeBUS.Xe_DanhSach();
 }
コード例 #7
0
        private void frmTiepnhanxe_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'quanlygaraoto1.sp_Xe_DanhSach' table. You can move, or remove it, as needed.
            this.sp_Xe_DanhSachTableAdapter.Fill(this.quanlygaraoto1.sp_Xe_DanhSach);
            try
            {
                cbHieuXe.DataSource    = HieuXeBUS.HieuXe_GetHieuXe();
                cbHieuXe.DisplayMember = "HieuXe";
                cbHieuXe.ValueMember   = "HieuXe";
                LoadDSXeSuaTrongNgay(dateNgayTiepNhan.Text);


                sp_Xe_DanhSachTableAdapter.Fill(quanlygaraoto1.sp_Xe_DanhSach);
                tableTiepNhanXe.DataSource = XeBUS.Xe_DanhSach();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                SQLDataProvider.connection.Close();
            }
        }
コード例 #8
0
        private bool KiemTra()
        {
            if (txtTenChuXe.Text.Trim().Equals(""))
            {
                MessageBox.Show("Tên chủ xe chưa có !!!");
                txtTenChuXe.Focus();
                return(false);
            }
            if (txtBienSo.Text.Trim().Equals(""))
            {
                MessageBox.Show("Biển số chưa có !!!");
                txtBienSo.Focus();
                return(false);
            }
            if (cbHieuXe.Text.Trim().Equals(""))
            {
                MessageBox.Show("Hiệu xe chưa được chọn !!!");
                cbHieuXe.Focus();
                return(false);
            }
            if (cbHieuXe.FindStringExact(cbHieuXe.Text) == -1)
            {
                MessageBox.Show("Hiệu xe không có trong gara!!");
                cbHieuXe.Focus();
                return(false);
            }
            if (txtDiaChi.Text.Trim().Equals(""))
            {
                MessageBox.Show("Địa chỉ chưa có!!!");
                txtDiaChi.Focus();
                return(false);
            }
            if (txtDienThoai.Text.Trim().Equals(""))
            {
                MessageBox.Show("Chưa nhập số điện thoại!!!");
                txtDienThoai.Focus();
                return(false);
            }
            if (txtEmail.Text.Trim().Equals(""))
            {
                MessageBox.Show("Chưa nhập email !!!");
                txtEmail.Focus();
                return(false);
            }
            DataTable dt = XeBUS.Xe_DanhSach();
            DataView  dv = dt.DefaultView;

            dv.Sort = "BienSo";
            if (dv.Find(txtBienSo.Text) != -1)
            {
                MessageBox.Show("Biển số đã có !");
                txtBienSo.Focus();
                return(false);
            }
            if (XeBUS.Xe_DemDSTheoNgay(dateNgayTiepNhan.Text) >= XeBUS.SoXeSuaChuaTrongNgay())
            {
                MessageBox.Show(string.Format("Số xe đã tiếp nhận đủ {0}chiếc", XeBUS.SoXeSuaChuaTrongNgay()), "Thông báo");
                return(false);
            }
            return(true);
        }
コード例 #9
0
 private void cb_TimKiem_SelectedIndexChanged(object sender, EventArgs e)
 {
     cb_TimKiem.DataSource = XeBUS.Xe_DanhSach();
 }