public bool ThemChuyenBay(DTO_ChuyenBay cb, string tenSBTG, int thoiGianDung) { try { Connect.connection.Open(); SqlCommand command = new SqlCommand("ThemCB", Connect.connection) { CommandType = CommandType.StoredProcedure }; SqlParameter parameter; parameter = new SqlParameter("@TenSBDi", cb.MaSBDi); command.Parameters.Add(parameter); parameter = new SqlParameter("@TenSBDen", cb.MaSBDen); command.Parameters.Add(parameter); parameter = new SqlParameter("@TenHHK", cb.MaHHK); command.Parameters.Add(parameter); parameter = new SqlParameter("@TenSBTG", tenSBTG); command.Parameters.Add(parameter); parameter = new SqlParameter("@ThoiGianDung", thoiGianDung); command.Parameters.Add(parameter); parameter = new SqlParameter("@ThoiGianKhoiHanh", cb.ThoiGianKhoiHanh); command.Parameters.Add(parameter); parameter = new SqlParameter("@ThoiGianDen", cb.ThoiGianDen); command.Parameters.Add(parameter); parameter = new SqlParameter("@SoGheHang1", cb.SoGheHang1); command.Parameters.Add(parameter); parameter = new SqlParameter("@SoGheHang2", cb.SoGheHang2); command.Parameters.Add(parameter); parameter = new SqlParameter("@GiaVe", cb.GiaVe); command.Parameters.Add(parameter); if (command.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch { return(false); } finally { Connect.connection.Close(); } }
public bool XoaChuyenBay(DTO_ChuyenBay cb) { try { Connect.connection.Open(); SqlCommand command = new SqlCommand("XoaCB", Connect.connection) { CommandType = CommandType.StoredProcedure }; SqlParameter parameter = new SqlParameter("@MaCB", cb.MaCB); command.Parameters.Add(parameter); if (command.ExecuteNonQuery() != 0) { return(true); } return(false); } catch { return(false); } finally { Connect.connection.Close(); } }
public bool Add(DTO_ChuyenBay dto) { try { _con.Open(); string maChuyenBay = TaoMaChuyenBay(); string sqlQuery = string.Format("INSERT INTO CHUYENBAY(MACHUYENBAY, MATUYENBAY, " + "MAMAYBAY, THOIGIANKHOIHANH, THOIGIANBAY) " + "VALUES('{0}', '{1}', '{2}', '{3}', '{4}')" , maChuyenBay, dto.MaTuyenBay, dto.MaMayBay, dto.ThoiGianKhoiHanh, dto.ThoiGianBay); SqlCommand cmd = new SqlCommand(sqlQuery, _con); if (cmd.ExecuteNonQuery() > 0) { return(true); } } catch (Exception a) { } finally { _con.Close(); } return(false); }
public DataTable LoadVeMayBayDataGridView(DTO_ChuyenBay dtoChuyenBay, DTO_TuyenBay dtoTuyenBay) { DataTable dt = new DataTable(); try { OpenConection(); SqlCommand command = new SqlCommand(); command.Parameters.Add(new SqlParameter("@NgayGio", dtoChuyenBay.NgayGio)); command.Parameters.Add(new SqlParameter("@ThoiGianBay", dtoChuyenBay.ThoiGianBay)); command.Parameters.Add(new SqlParameter("@SogheHang1", dtoChuyenBay.SoGheHang1)); command.Parameters.Add(new SqlParameter("@SoGheHang2", dtoChuyenBay.SoGheHang2)); command.Parameters.Add(new SqlParameter("@SanBayDi", dtoTuyenBay.SanBayDi)); command.Parameters.Add(new SqlParameter("@SanBayDen", dtoTuyenBay.SanBayDen)); dt = ShowDataInTableStoredProcedure(command, "SelectVeMayBayXuatPhat"); return(dt); } catch { return(dt); } finally { CloseConnection(); } }
private void NextStep2Btn_Click(object sender, EventArgs e) //truyen dtoChuyenBay, dtoTuyenBay sang step 2 de loc thong tin ve { int hang1 = 0, hang2 = 0; if (HangVeDrpDwn.Text == "1") { hang1 = int.Parse(HangVeDrpDwn.Text); } else { hang2 = int.Parse(HangVeDrpDwn.Text); } dtoChuyenBayXuatPhat = new DTO_ChuyenBay { NgayGio = XuatPhatDate.Text, ThoiGianBay = XuatPhatTime.Text, SoGheHang1 = hang1, SoGheHang2 = hang2 }; dtoTuyenBayXuatPhat = new DTO_TuyenBay { SanBayDi = XuatPhatDrDwn.Text, SanBayDen = NoiDenDrpDwn.Text }; if (KhuHoiCheckBox.Checked) { KhuHoi = true; dtoChuyenBayKhuHoi = new DTO_ChuyenBay { NgayGio = KhuHoiDate.Text, ThoiGianBay = KhuHoiTime.Text, SoGheHang1 = hang1, SoGheHang2 = hang2 }; dtoTuyenBayKhuHoi = new DTO_TuyenBay { SanBayDi = NoiDenDrpDwn.Text, SanBayDen = XuatPhatDrDwn.Text }; } MessageBox.Show("Vui lòng tới bước 2 để điền thông tin"); }
public bool EditChuyenBay(DTO_ChiTietChuyenBay dtoChiTietChuyenBay, DTO_ChuyenBay dtoChuyenBay, DTO_TuyenBay dtoTuyenBay) { try { OpenConection(); SqlCommand command = new SqlCommand(); /*command.Parameters.Add(new SqlParameter("@cttbMaChiTietChuyenBay", dtoChiTietChuyenBay.MaChiTietChuyenBay));/// * command.Parameters.Add(new SqlParameter("@tbMaTuyenBay", dtoTuyenBay.MaTuyenBay));//*/ command.Parameters.Add(new SqlParameter("@MaChuyenBay", dtoChuyenBay.MaChuyenBay)); command.Parameters.Add(new SqlParameter("@SanBayDi", dtoTuyenBay.SanBayDi)); command.Parameters.Add(new SqlParameter("@SanBayDen", dtoTuyenBay.SanBayDen)); command.Parameters.Add(new SqlParameter("@NgayGio", dtoChuyenBay.NgayGio)); command.Parameters.Add(new SqlParameter("@ThoiGianBay", dtoChuyenBay.ThoiGianBay)); command.Parameters.Add(new SqlParameter("@ThoiGianDung", dtoChiTietChuyenBay.ThoiGianDung)); command.Parameters.Add(new SqlParameter("@SanBayTrungGian", dtoChiTietChuyenBay.SanBayTrungGian)); command.Parameters.Add(new SqlParameter("@TenMayBay", dtoChuyenBay.TenMayBay)); ExecuteQueriesStoredProcedure(command, "EditChuyenBay"); return(true); } catch { return(false); } finally { CloseConnection(); } }
private void btnThem_Click(object sender, EventArgs e) { if (cboMaTuyenBay.Text.Trim() != "" && cboMaMayBay.Text.Trim() != "" && txtThoiGianBay.Text.Trim() != "") { try { dtoChuyenBay = new DTO_ChuyenBay(txtMaChuyenBay.Text, cboMaTuyenBay.Text, cboMaMayBay.Text, dtpkThoiGianKhoiHanh.Value, float.Parse(txtThoiGianBay.Text)); if (busChuyenBay.Add(dtoChuyenBay)) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception a) { MessageBox.Show("Thêm không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { TaoLaiChuyenBay(); } } else { MessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public string PostXuatPhat([FromBody] DTO_ChuyenBay dtoChuyenBay) { string JSONresult; DataTable dt = busChinhSuaVe.LoadTableVe(dtoChuyenBay); JSONresult = JsonConvert.SerializeObject(dt); return(JSONresult); }
public bool LoadThemMoiChuyenBay(DTO_ChiTietChuyenBay dtoChiTietChuyenBay, DTO_ChuyenBay dtoChuyenBay, DTO_TuyenBay dtoTuyenBay) { if (dalThemChuyenBay.ThemChuyenBay(dtoChiTietChuyenBay, dtoChuyenBay, dtoTuyenBay)) { return(true); } else { return(false); } }
public bool LoadEditChuyenBay(DTO_ChiTietChuyenBay dtoChiTietChuyenBay, DTO_ChuyenBay dtoChuyenBay, DTO_TuyenBay dtoTuyenBay) { if (dalEditChuyenBay.EditChuyenBay(dtoChiTietChuyenBay, dtoChuyenBay, dtoTuyenBay)) { return(true); } else { return(false); } }
private void Step2Btn_Click(object sender, EventArgs e) { ContentBanVePanel.Controls.Clear(); ContentBanVePanel.Controls.Add(step21); dtoChuyenBayXuatPhat = step21.dtoChuyenBayXuatPhat = step11.dtoChuyenBayXuatPhat; dtoTuyenBayXuatPhat = step21.dtoTuyenBayXuatPhat = step11.dtoTuyenBayXuatPhat; KhuHoi = step21.KhuHoi = step11.KhuHoi; dtoChuyenBayKhuHoi = step21.dtoChuyenBayKhuHoi = step11.dtoChuyenBayKhuHoi; dtoTuyenBayKhuHoi = step21.dtoTuyenBayKhuHoi = step11.dtoTuyenBayKhuHoi; step21.Step2_Load(); }
public void LoadDTOEditChuyenBay(DTO_ChiTietChuyenBay dtoChiTieTChuyenBay, DTO_ChuyenBay dtoChuyenBay, DTO_TuyenBay dtoTuyenBay) { this.dtoChiTieTChuyenBay = dtoChiTieTChuyenBay; this.dtoChuyenBay = dtoChuyenBay; this.dtoTuyenBay = dtoTuyenBay; ThoiGianDungtext.Text = dtoChiTieTChuyenBay.ThoiGianDung; MaChuyenBaytext.Text = dtoChuyenBay.MaChuyenBay; SanBayDentext.Text = dtoTuyenBay.SanBayDen; SanBayDitext.Text = dtoTuyenBay.SanBayDi; NgayGioBaytext.Text = dtoChuyenBay.NgayGio; SanBayTrungGiantext.Text = dtoChiTieTChuyenBay.SanBayTrungGian; ThoiGianBaytext.Text = dtoChuyenBay.ThoiGianBay; TenMayBaytext.Text = dtoChuyenBay.TenMayBay; }
public bool XoaChuyenBay(DataGridViewRow row) { DTO_ChuyenBay dtoChuyenBay = new DTO_ChuyenBay(); dtoChuyenBay.MaCB = row.Cells[0].Value.ToString(); dtoChuyenBay.MaSBDi = row.Cells[1].Value.ToString(); dtoChuyenBay.MaSBDen = row.Cells[2].Value.ToString(); dtoChuyenBay.MaHHK = row.Cells[3].Value.ToString(); dtoChuyenBay.ThoiGianKhoiHanh = Convert.ToDateTime(row.Cells[4].Value.ToString()); dtoChuyenBay.ThoiGianDen = Convert.ToDateTime(row.Cells[5].Value.ToString()); dtoChuyenBay.SoGheHang1 = int.Parse(row.Cells[6].Value.ToString()); dtoChuyenBay.SoGheHang2 = int.Parse(row.Cells[7].Value.ToString()); dtoChuyenBay.GiaVe = int.Parse(row.Cells[8].Value.ToString()); return(daoChuyenBay.XoaChuyenBay(dtoChuyenBay)); }
public bool ThemChuyenBay(DataGridViewRow row, string tenSBTG, int thoiGianDung) { DTO_ChuyenBay dtoChuyenBay = new DTO_ChuyenBay(); dtoChuyenBay.MaCB = string.Empty; dtoChuyenBay.MaSBDi = row.Cells[1].Value.ToString(); dtoChuyenBay.MaSBDen = row.Cells[2].Value.ToString(); dtoChuyenBay.MaHHK = row.Cells[3].Value.ToString(); dtoChuyenBay.ThoiGianKhoiHanh = Convert.ToDateTime(row.Cells[4].Value.ToString()); dtoChuyenBay.ThoiGianDen = Convert.ToDateTime(row.Cells[5].Value.ToString()); dtoChuyenBay.SoGheHang1 = int.Parse(row.Cells[6].Value.ToString()); dtoChuyenBay.SoGheHang2 = int.Parse(row.Cells[7].Value.ToString()); dtoChuyenBay.GiaVe = int.Parse(row.Cells[8].Value.ToString()); return(daoChuyenBay.ThemChuyenBay(dtoChuyenBay, tenSBTG, thoiGianDung)); }
public bool Update(DTO_ChuyenBay dto) { try { _con.Open(); string sqlQuery = string.Format("UPDATE CHUYENBAY SET MATUYENBAY='{0}', MAMAYBAY='{1}', THOIGIANKHOIHANH='{2}', THOIGIANBAY='{3}' WHERE MACHUYENBAY='{4}'", dto.MaTuyenBay, dto.MaMayBay, dto.ThoiGianKhoiHanh, dto.ThoiGianBay, dto.MaChuyenBay); SqlCommand cmd = new SqlCommand(sqlQuery, _con); if (cmd.ExecuteNonQuery() > 0) { return(true); } } catch (Exception a) { } finally { _con.Close(); } return(false); }
public DataTable LoadTableVeChuyenBay(DTO_ChuyenBay dtoChuyenBay) { DataTable dt = new DataTable(); try { OpenConection(); SqlCommand command = new SqlCommand(); command.Parameters.Add(new SqlParameter("@MaChuyenBay", dtoChuyenBay.MaChuyenBay)); dt = ShowDataInTableStoredProcedure(command, "SelectTheoMachuyenbay"); return(dt); } catch { } finally { CloseConnection(); } return(dt); }
public DataTable LoadVeMayBayDatagridViewKhuHoi(DTO_ChuyenBay dtoChuyenBay, DTO_TuyenBay dtoTuyenBay) { return(dalStep2.LoadVeMayBayDataGridView(dtoChuyenBay, dtoTuyenBay)); }
public bool Add(DTO_ChuyenBay dto) { return(dal.Add(dto)); }
public DataTable LoadTableVe(DTO_ChuyenBay dtoChuyenBay) { return(dalChinhSuaVe.LoadTableVeChuyenBay(dtoChuyenBay)); }
public bool Update(DTO_ChuyenBay dto) { return(dal.Update(dto)); }