Esempio n. 1
0
 /*Sửa 1 thông tin*/
 public void Sua(DDuongBay DDB, DLichSuHD DLS)
 {
     string sql = string.Format(@"Update DuongBay Set MaDuongBay='{0}',Site='HN',ViTri=N'{1}',ChieuDai={2}
                                 ,ChieuRong={3},TinhTrang='{4}' Where MaDuongBay='{5}'"
                                 , DDB.MaDuongBay, DDB.ViTri, DDB.ChieuDai, DDB.ChieuRong, DDB.TinhTrang, DDB.MaDuongBay);
     DA.ThucThi(sql);
     /*Chèn vào bảng lịch sử hoạt động*/
     string time = DateTime.Now.ToLocalTime().ToString();
     string str = "Insert Into LichSuHD(MaNhanVien,Site,TenNhanVien,HanhDong,TGTH)" + " Values('"
                         + DLS.MaNV + "','" + "HN" + "',N'"
                         + DLS.TenNV + "',N'Sửa Thông Tin Đường Bay Mã: "
                         + DDB.MaDuongBay + "','" + time + "')";
     DA.ThucThi(str);
 }
Esempio n. 2
0
 /*Nạp các phương thức thêm sửa xóa*/
 public void Insert(DDuongBay DDB, DLichSuHD DLS)
 {
     string sql = string.Format(@"Insert Into DuongBay(MaDuongBay,Site,ViTri,ChieuDai,ChieuRong,TinhTrang) 
                         Values('{0}','HN',N'{1}',N'{2}','{3}','{4}')",
                                             DDB.MaDuongBay,
                                             DDB.ViTri,
                                             DDB.ChieuDai,
                                             DDB.ChieuRong,
                                             DDB.TinhTrang);
     DA.ThucThi(sql);
     /*Chèn vào bảng lịch sử hoạt động*/
     string time = DateTime.Now.ToLocalTime().ToString();
     string str = "Insert Into LichSuHD(MaNhanVien,Site,TenNhanVien,HanhDong,TGTH)" + " Values('"
                     + DLS.MaNV + "','" + "HN" + "',N'" + DLS.TenNV + "',N'Thêm Thông Tin Đường Bay Mã: " + DDB.MaDuongBay + "','" + time + "')";
     DA.ThucThi(str);
 }
Esempio n. 3
0
 /*Lấy ra dòng dữ liệu và gán vào các hộp text*/
 public void SelectCoDK(DDuongBay DDB, TextEdit txt1, TextEdit txt2
                           , TextEdit txt3, TextEdit txt4, ComboBoxEdit cb1)
 {
     try
     {
         string path = string.Format("Select * From DuongBay Where MaDuongBay='{0}'", DDB.MaDuongBay);
         DataTable dtt = DA.TbView(path);
         txt1.EditValue = dtt.Rows[0]["MaDuongBay"].ToString().Trim();
         txt2.EditValue = dtt.Rows[0]["ViTri"].ToString().Trim();
         txt3.EditValue = dtt.Rows[0]["ChieuDai"].ToString().Trim();
         txt4.EditValue = dtt.Rows[0]["ChieuRong"].ToString().Trim();
         cb1.EditValue = dtt.Rows[0]["TinhTrang"].ToString().Trim();
         dtt = null;
     }
     catch
     {
         XtraMessageBox.Show("Vui lòng kích vào lưới thông tin chọn thông tin cần sửa !", "Chú ý !",
                                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 4
0
 /*Xóa 1 thông tin*/
 public void Xoa(DDuongBay DDB, DLichSuHD DLS)
 {
     try
     {
         DataTable myTB;
         myTB = DA.TbView("select * from DuongBay");
         if (myTB.Rows.Count == 0)
         {
             XtraMessageBox.Show("Không tồn tại thể hiện dữ liệu !" + "\n\t Vui lòng xem lại!", "Chú ý",
                                     MessageBoxButtons.OK, MessageBoxIcon.Warning); myTB = null;
         }
         else
         {
             if (DA.TbView("select * from DuongBay").Rows.Count == 1)
             {
                 XtraMessageBox.Show("Không được phép xóa hết bản ghi", "Cảnh Báo !",
                     MessageBoxButtons.OK, MessageBoxIcon.Error); myTB = null;
             }
             else
             {
                 DialogResult tl = XtraMessageBox.Show("Bạn có muốn xóa Máy Bay " + DDB.ViTri,
                     "Cảnh Báo!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (tl == DialogResult.Yes)
                 {
                     myTB = DA.TbView("select * From ChuyenBay Where MaDuongBay='" + DDB.MaDuongBay + "'");
                     if (myTB.Rows.Count >= 1)
                     {
                         XtraMessageBox.Show("Dịch vụ Máy Bay này đang cung cấp cho Chuyến Bay!",
                             "Cảnh Báo Mất Dữ Liệu!", MessageBoxButtons.OK, MessageBoxIcon.Error); myTB = null; return;
                     }
                     else
                     {
                         string sql = "Delete From DuongBay Where MaDuongBay='" + DDB.MaDuongBay + "'";
                         /*Chèn vào bảng lịch sử hoạt động*/
                         string time = DateTime.Now.ToLocalTime().ToString();
                         string str = "Insert Into LichSuHD(MaNhanVien,Site,TenNhanVien,HanhDong,TGTH)" + " Values('"
                                            + DLS.MaNV + "','" + "HN" + "',N'"
                                             + DLS.TenNV + "',N'Xóa Đường Bay Mã: "
                                             + DDB.MaDuongBay + "','" + time + "')";
                         DA.ThucThi(str);
                         DA.ThucThi(sql); XtraMessageBox.Show("Xóa Thành Công !", "Chú ý"
                                                 , MessageBoxButtons.OK, MessageBoxIcon.Information); return;
                     }
                 }
             }
         }
     }
     catch (Exception ex) { XtraMessageBox.Show("Lỗi phát sinh chương trình.!\r\nVui lòng liên hệ với chúng tôi ngay lập tức!\r\nChi tiết lỗi:\r\n" + ex.Message, "Chú ý !", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }