/// <summary> /// Hàm cập nhật đất đá /// </summary> /// <param name="value">đất đá cần cập nhật</param> /// <returns>bool</returns> public static bool CapNhatDatDa(DatDa value) { String sql = "UPDATE DatDa SET TenDatDa = '" + value.TenDatDa + "', HS_KienCo_TB = '" + value.HS_KienCo_TB + "', HeSoDatDa = '" + value.HeSoDatDa + "', TinhChat = '" + value.TinhChat + "', DungTrong = '" + value.DungTrong + "', KCTB_KhoiNut = '" + value.KCTB_KhoiNut + "', KT_HAT_MAX = '" + value.KT_HAT_MAX + "' WHERE MaDatDa = '" + value.MaDatDa + "'"; Connection conn = new Connection(); return(conn.SetData(sql)); }
/// <summary> /// Hàm thêm đất đá /// </summary> /// <param name="value">đất đá cần thêm</param> /// <returns>bool</returns> public static bool ThemDatDa(DatDa value) { String sql = "INSERT INTO DatDa (MaDatDa, TenDatDa, HS_KienCo_TB, HeSoDatDa, TinhChat, DungTrong, KCTB_KhoiNut, KT_HAT_MAX) VALUES ('" + value.MaDatDa + "', '" + value.TenDatDa + "', '" + value.HS_KienCo_TB + "', '" + value.HeSoDatDa + "', '" + value.TinhChat + "', '" + value.DungTrong + "', '" + value.KCTB_KhoiNut + "', '" + value.KT_HAT_MAX + "')"; Connection conn = new Connection(); return(conn.SetData(sql)); }
/// <summary> /// Hàm lấy thông tin đất đá /// </summary> /// <param name="id">mã đất đá</param> /// <returns>DatDa</returns> public static DatDa DatDa(String id) { DatDa datDa = new DatDa(); Connection conn = new Connection(); string sql = "SELECT * FROM DatDa WHERE MaDatDa = '" + id + "'"; SQLiteDataReader dr = conn.GetData(sql); while (dr.Read()) { datDa = new DatDa(dr["MaDatDa"].ToString(), dr["TenDatDa"].ToString(), dr.GetDouble(2), dr.GetDouble(3), dr["TinhChat"].ToString(), dr.GetDouble(5), dr.GetDouble(6), dr.GetDouble(7)); } return datDa; }
/// <summary> /// Hàm lấy thông tin đất đá /// </summary> /// <param name="id">mã đất đá</param> /// <returns>DatDa</returns> public static DatDa DatDa(String id) { DatDa datDa = new DatDa(); Connection conn = new Connection(); string sql = "SELECT * FROM DatDa WHERE MaDatDa = '" + id + "'"; SQLiteDataReader dr = conn.GetData(sql); while (dr.Read()) { datDa = new DatDa(dr["MaDatDa"].ToString(), dr["TenDatDa"].ToString(), dr.GetDouble(2), dr.GetDouble(3), dr["TinhChat"].ToString(), dr.GetDouble(5), dr.GetDouble(6), dr.GetDouble(7)); } return(datDa); }
/// <summary> /// Hàm cập nhật đất đá /// </summary> /// <param name="value">đất đá cần cập nhật</param> /// <returns>bool</returns> public static bool CapNhatDatDa(DatDa value) { String sql = "UPDATE DatDa SET TenDatDa = '" + value.TenDatDa + "', HS_KienCo_TB = '" + value.HS_KienCo_TB + "', HeSoDatDa = '" + value.HeSoDatDa + "', TinhChat = '" + value.TinhChat + "', DungTrong = '" + value.DungTrong + "', KCTB_KhoiNut = '" + value.KCTB_KhoiNut + "', KT_HAT_MAX = '" + value.KT_HAT_MAX + "' WHERE MaDatDa = '" + value.MaDatDa + "'"; Connection conn = new Connection(); return conn.SetData(sql); }
/// <summary> /// Hàm thêm đất đá /// </summary> /// <param name="value">đất đá cần thêm</param> /// <returns>bool</returns> public static bool ThemDatDa(DatDa value) { String sql = "INSERT INTO DatDa (MaDatDa, TenDatDa, HS_KienCo_TB, HeSoDatDa, TinhChat, DungTrong, KCTB_KhoiNut, KT_HAT_MAX) VALUES ('" + value.MaDatDa + "', '" + value.TenDatDa + "', '" + value.HS_KienCo_TB + "', '" + value.HeSoDatDa + "', '" + value.TinhChat + "', '" + value.DungTrong + "', '" + value.KCTB_KhoiNut + "', '" + value.KT_HAT_MAX + "')"; Connection conn = new Connection(); return conn.SetData(sql); }
private void buttonInsert_Click(object sender, EventArgs e) { DatDa inserted = new DatDa(); inserted.MaDatDa = textBoxMaDatDa2.Text; inserted.TenDatDa = textBoxTenDatDa2.Text; if (textBoxHeSoKienCo2.Text != String.Empty) { inserted.HS_KienCo_TB = double.Parse(textBoxHeSoKienCo2.Text); } if (textBoxHeSoDatDa2.Text != String.Empty) { inserted.HeSoDatDa = double.Parse(textBoxHeSoDatDa2.Text); } inserted.TinhChat = textBoxTinhChat2.Text; if (textBoxDungTrong2.Text != String.Empty) { inserted.DungTrong = double.Parse(textBoxDungTrong2.Text); } if (textBoxKCTB2.Text != String.Empty) { inserted.KCTB_KhoiNut = double.Parse(textBoxKCTB2.Text); } if (textBoxKT_HAT_MAX2.Text != String.Empty) { inserted.KT_HAT_MAX = double.Parse(textBoxKT_HAT_MAX2.Text); } try { BS_DatDa.ThemDatDa(inserted); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_DatDa(); }
public ExportData(String _maHoChieu) { Connection conn = new Connection(); string sql = "SELECT HoChieu.*, LoKhoan.ID, LoKhoan.MaLK, LoKhoan.BanKinhLK, LoKhoan.ChieuSauLK FROM LoKhoan, BanVe, HoChieu WHERE HoChieu.MaHoChieu = LoKhoan.MaHoChieu And BanVe.ID= HoChieu.MaBanVe and HoChieu.MaHoChieu = \'" + _maHoChieu + "\';"; SQLiteDataReader dr = conn.GetData(sql); while (dr.Read()) { hoChieu.TenHoChieu = dr["TenHoChieu"].ToString(); hoChieu.ChieuCaoTang = (dr["ChieuCaoTang"].ToString() == String.Empty ? 0 : Convert.ToDouble(dr["ChieuCaoTang"].ToString())); hoChieu.HeSoKC = (dr["HeSoKC"].ToString() == String.Empty ? 0 : Convert.ToDouble(dr["HeSoKC"].ToString())); hoChieu.KichThuoc_X = (dr["KichThuoc_X"].ToString() == String.Empty ? 0 : Convert.ToDouble(dr["KichThuoc_X"].ToString())); hoChieu.KichThuoc_Y = (dr["KichThuoc_Y"].ToString() == String.Empty ? 0 : Convert.ToDouble(dr["KichThuoc_Y"].ToString())); //thoiDiemNo = Convert.ToDateTime(dr["ThoiDiemNo"].ToString()); hoChieu.MaDatDa = dr["MaDatDa"].ToString(); hoChieu.MaCapDo = dr["MaCapDo"].ToString(); hoChieu.MaMayKhoan = dr["MaMayKhoan"].ToString(); hoChieu.MaThuocNo = dr["MaThuocNo"].ToString(); hoChieu.MaCongTruong = dr["MaCongTruong"].ToString(); danhSachLoKhoan.Add(new LoKhoan(dr["MaLK"].ToString(), Convert.ToDouble(dr["BanKinhLK"].ToString()), Convert.ToDouble(dr["ChieuSauLK"].ToString()))); } dr.Close(); //Lấy hết giá trị của bảng Đất Đá datDa = BS_DatDa.DatDa(hoChieu.MaDatDa); //Lấy hết giá trị từ bảng Cấp độ nổ capDoNo = BS_CapDoNo.CapDoNo(hoChieu.MaCapDo); //Lấy hết giá trị của bảng Máy khoan mayKhoan = BS_MayKhoan.MayKhoan(hoChieu.MaMayKhoan); //Lấy hết giá trị của bảng Thuốc nổ thuocNo = BS_ThuocNo.ThuocNo(hoChieu.MaThuocNo); //Lấy hết giá trị của bảng Công trường congTruong = BS_CongTruong.CongTruong(hoChieu.MaCongTruong); //tính toán congTB = Math.Round((thuocNo.KhaNangSinhCong / 360), 2); // Cong trung binh (e) //double congtb = thuocNo.KhaNangSinhCong / 360; // Cong trung binh (e) //congtb = Math.Round(congtb * 100) / 100; //duong Khang chan tang // duongKhang = Math.Round((53 * datDa.KCTB_KhoiNut * (mayKhoan.DuongKinhLoKhoan / 1000) * Math.Sqrt(thuocNo.MatDoNapThuoc * congTB / datDa.DungTrong) * (1.6 - 0.5 * hoChieu.HeSoKC)) * 100) / 100; duongKhang = Math.Round((53 * datDa.HeSoDatDa * (mayKhoan.DuongKinhLoKhoan / 1000) * Math.Sqrt((thuocNo.MatDoNapThuoc * (congTB / datDa.DungTrong))) * (1.6 - 0.5 * hoChieu.HeSoKC)), 2); //Khoang cach giua cac lo min (Kí Hiệu {A}) // KC_Cot = Math.Round((hoChieu.HeSoKC * duongKhang) * 100) / 100; KC_Cot = Math.Round((hoChieu.HeSoKC * duongKhang), 2); // Khoảng cách giữa các hàng (Kí Hiệu {b}) // KC_Hang = Math.Round((0.85 * KC_Cot) * 100) / 100; KC_Hang = Math.Round((0.85 * KC_Cot), 2); //Chieu sau khoan them chieuSauThem = Math.Round((0.3 * KC_Hang), 2); // Chieu dai lo khoan (Kí Hiệu {Lk}) chieuSauToanBoLK = Math.Round((mayKhoan.ChieuSau + chieuSauThem), 2); // Chieu cao cột bua thiết kế ( Kí Hiệu {Lbua}) chieuDaiBua = Math.Round((0.75 * duongKhang), 2); //Hang min //hangMin = Convert.ToInt32(hoChieu.KichThuoc_Y / KC_Hang); //Hangmin = Math.Round(Hangmin * 100) / 100; //Cot min //soCotMin = Convert.ToInt32((hoChieu.KichThuoc_X - duongKhang) / KC_Cot); // Tổng số lỗ mìn (Kí Hiệu {Tổng số lỗ}) //tongLoMin = soCotMin * hangMin; }