private void dgvTicketMultiRoute_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { VeThangLienTuyen row = (VeThangLienTuyen)dgvTicketMultiRoute.SelectedItems[0]; txtMaVeLienTuyen.Text = row.mavethang; cboHanhKhachLienTuyen.Text = row.HanhKhachThang.tenhk; cboNhanVienDangKyLienTuyen.Text = row.NhanVien.hoten; dtpNgayDangKyLienTuyen.Text = row.ngaydangky.ToString(); dtpNgayHetHanLienTuyen.Text = row.ngayhethan.ToString(); txtGiaVeLienTuyen.Text = row.giave.ToString(); } catch (Exception g) { } }
public IEnumerable <VeThangLienTuyen> TimKiemVeThangLienTuyen(string input) { List <VeThangLienTuyen> Details = new List <VeThangLienTuyen>(); var result = db.Search_VeThangLienTuyen(input).ToList(); for (int j = 0; j < result.Count; j++) { VeThangLienTuyen vlt = new VeThangLienTuyen(); vlt.NhanVien = new NhanVien(); vlt.HanhKhachThang = new HanhKhachThang(); vlt.mavethang = Convert.ToString(result[j].mavethang); vlt.HanhKhachThang.tenhk = Convert.ToString(result[j].tenhk); vlt.NhanVien.hoten = Convert.ToString(result[j].hoten); vlt.ngaydangky = Convert.ToDateTime(result[j].ngaydangky); vlt.ngayhethan = Convert.ToDateTime(result[j].ngayhethan); vlt.giave = Convert.ToInt32(result[j].giave); Details.Add(vlt); } return(Details); }
private void btnLuu_Click(object sender, RoutedEventArgs e) { if (radXylyve1tuyen.IsChecked == true) { VeThang1Tuyen v1t = new VeThang1Tuyen(); v1t.matuyenxe = cboTuyenDuong1Tuyen.SelectedValue.ToString(); v1t.mahk = cboKhachHang.SelectedValue.ToString(); v1t.manv = cboNhanVien.SelectedValue.ToString(); v1t.ngaydangky = dtpNgayDangKy1Tuyen.SelectedDate.Value; v1t.ngayhethan = dtpNgayHetHan1Tuyen.SelectedDate.Value; v1t.giave = Convert.ToInt32(txtGiaVe1Tuyen.Text); if (themMoi) { VeThang1TuyenBUS.Instance.Them(v1t); } else { VeThang1TuyenBUS.Instance.CapNhat(v1t, maVETHANG1TUYEN); } Load(sender, e); } else if (radXylyvelientuyen.IsChecked == true) { VeThangLienTuyen vlt = new VeThangLienTuyen(); vlt.mahk = cboHanhKhachLienTuyen.SelectedValue.ToString(); vlt.manv = cboNhanVienDangKyLienTuyen.SelectedValue.ToString(); vlt.ngaydangky = dtpNgayDangKyLienTuyen.SelectedDate.Value; vlt.ngayhethan = dtpNgayHetHanLienTuyen.SelectedDate.Value; vlt.giave = Convert.ToInt32(txtGiaVeLienTuyen.Text); if (themMoi) { VeThangLienTuyenBUS.Instance.Them(vlt); } else { VeThangLienTuyenBUS.Instance.CapNhat(vlt, maVETHANGLIENTUYEN); } Load(sender, e); } }
private void btnXoa_Click(object sender, RoutedEventArgs e) { if (radXylyve1tuyen.IsChecked == true) { if (MessageBox.Show("Bạn có muốn xóa vé 1 tuyến của hành khách " + cboKhachHang.Text + " không?", "Xóa", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { VeThang1Tuyen v1t = new VeThang1Tuyen(); v1t.mavethang = txtVe1Tuyen.Text; VeThang1TuyenBUS.Instance.Xoa(v1t); Load(sender, e); } } else if (radXylyvelientuyen.IsChecked == true) { if (MessageBox.Show("Bạn có muốn xóa vé liên tuyến của hành khách " + cboHanhKhachLienTuyen.Text + " không?", "Xóa", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { VeThangLienTuyen vlt = new VeThangLienTuyen(); vlt.mavethang = txtMaVeLienTuyen.Text; VeThangLienTuyenBUS.Instance.Xoa(vlt); Load(sender, e); } } }
public void Xoa(VeThangLienTuyen vlt) { VeThangLienTuyenDAO.Instance.Xoa(vlt); }
public void CapNhat(VeThangLienTuyen vlt, string maVETHANG) { VeThangLienTuyenDAO.Instance.CapNhat(vlt, maVETHANG); }
public void Them(VeThangLienTuyen vlt) { VeThangLienTuyenDAO.Instance.Them(vlt); }
public void Xoa(VeThangLienTuyen vlt) { var result = db.Delete_VeThangLienTuyen(vlt.mavethang); }
public void CapNhat(VeThangLienTuyen vlt, string maVETHANG) { var result = db.Update_VeThangLienTuyen(maVETHANG, vlt.mahk, vlt.manv, vlt.ngaydangky, vlt.ngayhethan, vlt.giave); }
public void Them(VeThangLienTuyen vlt) { var result = db.Insert_VeThangLienTuyen(vlt.mahk, vlt.manv, vlt.ngaydangky, vlt.ngayhethan, vlt.giave); }