private void btnSearch_Click(object sender, EventArgs e) { int thoiGian; List <Business.CheckCoDuongDai.CheckCoDuongDai> lstCheckCo = new List <Business.CheckCoDuongDai.CheckCoDuongDai>(); if (cboThoiGian.ItemIndex < 0) { thoiGian = 0; } else { thoiGian = int.Parse(cboThoiGian.EditValue.ToString()); } int gara; if (cbGara.SelectedIndex < 0) { gara = 0; } else { gara = int.Parse(cbGara.SelectedValue.ToString()); } lstCheckCo = new Business.CheckCoDuongDai.CheckCoDuongDai().GetDSCuocDuongDaiSanBay_Gara(txtSoHieuXe.Text.Trim(), thoiGian, gara); //grdCuocSanBayDuongDai.DataMember = "SanBayDuongDai"; //grdCuocSanBayDuongDai.SetDataBinding(lstCheckCo , "SanBayDuongDai"); grdCuocSanBayDuongDai.DataSource = lstCheckCo; }
private void NhapDuLieuVaoTruyenDi(int rowPosition) { if (grvCuocSanBayDuongDai.RowCount > 0) { Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo = (Business.CheckCoDuongDai.CheckCoDuongDai)(grvCuocSanBayDuongDai.GetFocusedRow()); if (DateTime.Now.AddHours(-24) <= objCheckCo.NgayTao) { ThongTinSanBay_DuongDai frmSanBayDuongDai = new ThongTinSanBay_DuongDai(objCheckCo, G_arrProvince, G_arrDistrict, G_arrCommune); DialogResult diaResult = frmSanBayDuongDai.ShowDialog(); if (diaResult == DialogResult.OK) { LoadDSCuoc(); } } else if (ThongTinDangNhap.USER_ID == "admin" || ThongTinDangNhap.IsInRole("TC") || ThongTinDangNhap.IsInRole("GD")) { ThongTinSanBay_DuongDai frmSanBayDuongDai = new ThongTinSanBay_DuongDai(objCheckCo, G_arrProvince, G_arrDistrict, G_arrCommune); DialogResult diaResult = frmSanBayDuongDai.ShowDialog(); if (diaResult == DialogResult.OK) { LoadDSCuoc(); } } else { System.Windows.Forms.MessageBox.Show("Bạn chỉ có thể sửa dữ liệu trong vòng 24h"); } } }
public ThongTinSanBay_DuongDai(Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo, List <Province> arrProvince, List <District> arrDistrict, List <Commune> arrCommune) { InitializeComponent(); checkCoDuongDai1.G_arrCommune = arrCommune; checkCoDuongDai1.G_arrDistrict = arrDistrict; checkCoDuongDai1.G_arrProvince = arrProvince; G_objCheckCo = objCheckCo; isUpdate = true; checkCoDuongDai1.isInsert = false; }
public void Insert() { Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo = new Business.CheckCoDuongDai.CheckCoDuongDai(); BangMaValidate maValidate = ValidateFormNhap(objCheckCo); HienThiThongBao(maValidate); if (maValidate == BangMaValidate.ValidateSuccess) { int coCuoi = 0; float tongTien = 0; bool chieuDi = true; if (txtTongTien.Text == string.Empty) { tongTien = 0; } else { try { tongTien = float.Parse(txtTongTien.Text); } catch { tongTien = 0; } } if (txtCoCuoi.Text == string.Empty) { coCuoi = 0; } else { try { coCuoi = int.Parse(txtCoCuoi.Text); } catch { coCuoi = 0; } } if (chkMotChieu.Checked) { chieuDi = true; } else { chieuDi = false; } int TinhThanhDiID = 0; int TinhThanhDenID = 0; int QuanHuyenDiID = 0; int QuanHuyenDenID = 0; int PhuongXaDiID = 0; int PhuongXaDenID = 0; string TenLaiXe = txtTenLaiXe.Text.Trim(); bool isChiaSe = true; if (chkChiaSe.Visible) { isChiaSe = chkChiaSe.Checked; } if (cbTinh_Di.SelectedIndex >= 0) { TinhThanhDiID = (int)cbTinh_Di.SelectedValue; } if (cbTinh_Den.SelectedIndex >= 0) { TinhThanhDenID = (int)cbTinh_Den.SelectedValue; } if (cbQH_Di.SelectedIndex >= 0) { QuanHuyenDiID = (int)cbQH_Di.SelectedValue; } if (cbQH_Den.SelectedIndex >= 0) { QuanHuyenDenID = (int)cbQH_Den.SelectedValue; } if (cb_PhuongXaDi.SelectedIndex >= 0) { PhuongXaDiID = (int)cb_PhuongXaDi.SelectedValue; } if (cb_PhuongXaDen.SelectedIndex >= 0) { PhuongXaDenID = (int)cb_PhuongXaDen.SelectedValue; } DateTime ThoiDiemTra = DateTime.MinValue; if (cbThoiDiemTra.Text != "") { ThoiDiemTra = cbThoiDiemTra.DateTime; } int output = objCheckCo.InsertCheckCo(txtSoHieuXe.Text, txtNoiDi.Text.ToUpperInvariant(), txtNoiDen.Text.ToUpperInvariant(), TinhThanhDenID, int.Parse(txtCoDau.Text), coCuoi, cbThoiDiemDon.DateTime, ThoiDiemTra, chieuDi, tongTien, txtGhiChu.Text, ThongTinDangNhap.USER_ID, TinhThanhDiID, QuanHuyenDiID, QuanHuyenDenID, PhuongXaDiID, PhuongXaDenID, TenLaiXe, txtDienThoai.Text.Trim(), isChiaSe); if (output > 0) { new MessageBox.MessageBoxBA().Show("Lưu thông tin thành công", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Information); isSuccess = true; } else if (output == -1) { new MessageBox.MessageBoxBA().Show(String.Format("Xe {0} đã chốt cơ trong khoảng 15 phút trở lại đây rồi", txtSoHieuXe.Text.Trim()), "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } else { new MessageBox.MessageBoxBA().Show("Lưu thông tin lỗi", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error); } } }