public static BookingFile GetInfo(string MaBF) { DataTable dt = ShipBookingData.FillDataTable("spBookingFile_SelectByID", "@MaBF", MaBF); BookingFile bf = new BookingFile(); if (dt.Rows.Count > 0) { bf.MaBF = dt.Rows[0]["MaBF"].ToString(); bf.LoaiChuyen = dt.Rows[0]["LoaiChuyen"].ToString(); bf.NoiDi = dt.Rows[0]["NoiDi"].ToString(); bf.NoiDen = dt.Rows[0]["NoiDen"].ToString(); bf.NgayDi = DateTime.Parse(dt.Rows[0]["NgayDi"].ToString()); bf.NgayVe = DateTime.Parse(dt.Rows[0]["NgayVe"].ToString()); bf.ThoiGian = dt.Rows[0]["ThoiGian"].ToString(); bf.OpenChecking = Convert.ToBoolean(dt.Rows[0]["OpenChecking"].ToString()); bf.LoaiVe = dt.Rows[0]["LoaiVe"].ToString(); bf.SoGhe = dt.Rows[0]["SoGhe"].ToString(); bf.GiaTien = dt.Rows[0]["GiaTien"].ToString(); bf.ThanhToan = dt.Rows[0]["ThanhToan"].ToString(); bf.MaNguoiNhan = dt.Rows[0]["MaNguoiNhan"].ToString(); bf.MaHanhTrinh = dt.Rows[0]["HanhTrinh"].ToString(); bf.GioKhoiHanh = DateTime.Parse(dt.Rows[0]["GioKhoiHanh"].ToString()); bf.GioDen = DateTime.Parse(dt.Rows[0]["GioDen"].ToString()); bf.SoVe = dt.Rows[0]["SoVe"].ToString(); } else { bf = null; } return bf; }
protected void FillBookingDetailData(string MaBF) { BookingFile booking = new BookingFile(); booking = BookingFileDB.GetInfo(MaBF); if (booking != null) { lblBookingID.Text = booking.MaBF.Trim(); lblLoaiChuyen.Text = booking.LoaiChuyen.Trim(); lblNoiDi.Text = booking.NoiDi.Trim(); lblNoiDen.Text = booking.NoiDen.Trim(); lblNgayDi.Text = booking.NgayDi.ToShortDateString(); if (booking.LoaiChuyen.Equals("Khứ hồi") == true) { lblNgayVeText.Visible = true; lblNgayVe.Visible = true; lblNgayVe.Text = booking.NgayVe.ToShortDateString(); } else { lblNgayVeText.Visible = false; lblNgayVe.Visible = false; } lblGioKhoiHanh.Text = booking.GioKhoiHanh.ToShortTimeString(); lblGioDen.Text = booking.GioDen.ToShortTimeString(); lblLoaiVe.Text = booking.LoaiVe.Trim(); List<HanhKhach> HKList = new List<HanhKhach>(); HKList = HanhKhachDB.GetListHanhKhachByBookingID(booking.MaBF.Trim()); string soghe = ""; for (int i = 0; i < HKList.Count; i++) { if (HKList[i].SoGhe.Trim() != "") { soghe = soghe + HKList[i].SoGhe.Trim(); if ((i + 1) < HKList.Count) { soghe = soghe + ", "; } } } lblSoGhe.Text = soghe; lblGiaTien.Text = booking.GiaTien.Trim(); } }
protected void FillNguoiNhanVeData(string MaBF) { BookingFile booking = new BookingFile(); booking = BookingFileDB.GetInfo(MaBF); if (booking != null) { string MaNN = ""; MaNN = booking.MaNguoiNhan.Trim(); NguoiNhanVe nguoinhan = new NguoiNhanVe(); nguoinhan = NguoiNhanVeDB.GetInfo(MaNN); if (nguoinhan != null) { lblMaNN.Text = nguoinhan.MaNguoiNhan.Trim(); lblTenNN.Text = nguoinhan.Ten.Trim(); lblDiaChiNN.Text = nguoinhan.DiaChi.Trim(); lblSoDienThoaiNN.Text = nguoinhan.DienThoai.Trim(); lblEmailNN.Text = nguoinhan.Email.Trim(); lblYeuCauKhac.Text = nguoinhan.YeuCauKhac.Trim(); } } }
public static List<BookingFile> GetListBookingFileByDate(string date, string hanhtrinh) { List<BookingFile> BFList = new List<BookingFile>(); BookingFile BF; DataTable dt = ShipBookingData.FillDataTable("spBookingFile_SelectByDate", "@NgayDi", "@HanhTrinh", date, hanhtrinh); for (int i = 0; i < dt.Rows.Count; i++) { BF = new BookingFile(); BF.LoaiChuyen = dt.Rows[i]["LoaiChuyen"].ToString(); BF.NoiDi = dt.Rows[i]["NoiDi"].ToString(); BF.NoiDen = dt.Rows[i]["NoiDen"].ToString(); BF.NgayDi = DateTime.Parse(dt.Rows[i]["NgayDi"].ToString()); BF.NgayVe = DateTime.Parse(dt.Rows[i]["NgayVe"].ToString()); BF.ThoiGian = dt.Rows[i]["ThoiGian"].ToString(); BF.OpenChecking = Convert.ToBoolean(dt.Rows[0]["OpenChecking"].ToString()); BF.LoaiVe = dt.Rows[i]["LoaiVe"].ToString(); BF.SoGhe = dt.Rows[i]["SoGhe"].ToString(); BF.GiaTien = dt.Rows[i]["GiaTien"].ToString(); BF.ThanhToan = dt.Rows[i]["ThanhToan"].ToString(); BF.MaNguoiNhan = dt.Rows[i]["MaNguoiNhan"].ToString(); BF.MaHanhTrinh = dt.Rows[i]["HanhTrinh"].ToString(); BF.GioKhoiHanh = DateTime.Parse(dt.Rows[i]["GioKhoiHanh"].ToString()); BF.GioDen = DateTime.Parse(dt.Rows[i]["GioDen"].ToString()); BF.SoVe = dt.Rows[i]["SoVe"].ToString(); BFList.Add(BF); BF = null; } return BFList; }
public static void Update(BookingFile bf) { string[] parameters = new string[] { "@MaBF", "@LoaiChuyen", "@NoiDi", "@NoiDen", "@NgayDi", "@NgayVe", "@ThoiGian", "@OpenChecking", "@LoaiVe", "@SoGhe", "@GiaTien", "@ThanhToan", "@MaNguoiNhan", "@HanhTrinh", "@GioKhoiHanh", "@GioDen", "@SoVe" }; string[] values = new string[] { bf.MaBF, bf.LoaiChuyen, bf.NoiDi, bf.NoiDen, bf.NgayDi.ToString(), bf.NgayVe.ToString(), bf.ThoiGian, bf.OpenChecking.ToString(), bf.LoaiVe, bf.SoGhe, bf.GiaTien, bf.ThanhToan, bf.MaNguoiNhan, bf.MaHanhTrinh, bf.GioKhoiHanh.ToString(), bf.GioDen.ToString(), bf.SoVe }; ExecuteData("spBookingFile_UpdateByID", parameters, values); }