private void Find(string DanhMuc, string Ten, string ChucVu, string Output, ComboBox cmb) { try { string query = " select " + Output + " from tblDSCanBoCapDatNN where 1=1 "; if (DanhMuc != "") { query += " and DanhMuc Like N'%" + DanhMuc + "%' "; } if (ChucVu != "") { query += " and ChucVu like N'%" + ChucVu + "%' "; } if (Ten != "") { query += " and Ten like N'%" + Ten + "%' "; } ds.Tables.Clear(); ds = cls.ExecuteQuery(query); cmb.Items.Clear(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { cmb.Items.Add(ds.Tables[0].Rows[i][Output].ToString()); } } catch (Exception ex) { } }
public void TimTenDonViHanhChinh(string Ma) { try { ds.Tables.Clear(); string qr = " select Ten from tblTuDienDonViHanhChinh where MaDonViHanhChinh = N'" + Ma + "'"; ds = cls.ExecuteQuery(qr); clsConfig.TenDVHC = ds.Tables[0].Rows[0]["Ten"].ToString().Trim(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadDVHC() { try { cmbDVHC.Items.Add("A"); ds.Tables.Clear(); string qr = " select MaDonViHanhChinh,Ten from tblTuDienDonViHanhChinh where MaHuyen <> '0' and MaXa <> '0' order by Ten asc "; ds = cls.ExecuteQuery(qr); if (ds.Tables[0].Rows.Count > 0) { /* Lưu ý, * luôn luôn để 2 trường xác định * cmbDVHC.ValueMember = "MaDonViHanhChinh"; * cmbDVHC.DisplayMember = "Ten"; * * hoặc * cmbDVHC.DisplayMember = "Value"; * cmbDVHC.ValueMember = "Key"; * * lên trước khi đặt nguồn dữ liệu, * * như vậy thì sự kiện cmbDVHC_SelectedIndexChanged không tự động nhảy vào khi bắt đầu load và sinh ra lỗi * */ #region "cách này không thể add trường tùy ý thêm vào combobox" //cmbDVHC.ValueMember = "MaDonViHanhChinh"; //cmbDVHC.DisplayMember = "Ten"; //dataGridView1.DataSource = ds.Tables[0]; //cmbDVHC.DataSource = ds.Tables[0]; #endregion #region "cách này chủ động hơn!" Dictionary <string, string> dsDVHC = new Dictionary <string, string>(); dsDVHC.Add("", ""); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { dsDVHC.Add(ds.Tables[0].Rows[i]["MaDonViHanhChinh"].ToString(), ds.Tables[0].Rows[i]["Ten"].ToString()); } cmbDVHC.DisplayMember = "Value"; cmbDVHC.ValueMember = "Key"; cmbDVHC.DataSource = new BindingSource(dsDVHC, null); #endregion } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadThongTinGiaDinh(int MGD) { string query = "Select * from tblHoGiaDinh where MaSoGiaDinh =" + MGD.ToString(); DataSet ds = cls.ExecuteQuery(query); txtDaiDien.Text = ds.Tables[0].Rows[0]["NguoiDaiDien"].ToString(); }
private void FillData(int MaGD) { string query = " select * from tblNguoi where MaSoGiaDinh ='" + MaGD + "' "; clsDatabase cls = new clsDatabase(); DataSet ds = cls.ExecuteQuery(query); dataGridView1.DataSource = ds.Tables[0]; DatagridviewStyle(); }
private void FillData(int MSHS) { ds.Tables.Clear(); string query = " select * from tblThuaDatCapGCNDatNN where MaDonViHanhChinh ='" + clsConfig.MaDonVihanhChinh + "' and MaHoSoCapGCNDatNN ='" + MSHS + "' "; ds = cls.ExecuteQuery(query); dataGridView1.DataSource = ds.Tables[0]; DatagridviewStyle(); }
private void LoadDataUBND() { try{ string query = " select * from tblXetQuyenSuDungDatNN Where MaDonViHanhChinh ='" + clsConfig.MaDonVihanhChinh + "' and MaHoSoCapGCNDatNN ='" + clsConfig.MaHoSo + "' "; ds.Tables.Clear(); ds = cls.ExecuteQuery(query); if (ds.Tables[0].Rows.Count > 0) { rtbYKienUBND.Text = ds.Tables[0].Rows[0]["UBNDNoiDung"].ToString(); dtpNgayKyUBND.Value = (DateTime)ds.Tables[0].Rows[0]["UBNDNgayKy"]; cmbCanBoUBND.Text = ds.Tables[0].Rows[0]["UBNDNguoiKy"].ToString(); cmbTieuDeUBND.Text = ds.Tables[0].Rows[0]["UBNDTieuDeKy"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadDVHC() { try { ds.Tables.Clear(); string qr = " select MaDonViHanhChinh,Ten from tblTuDienDonViHanhChinh where MaHuyen <> '0' and MaXa <> '0' order by Ten asc "; ds = cls.ExecuteQuery(qr); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { cmbDVHC.Items.Add(ds.Tables[0].Rows[i]["Ten"].ToString().Trim()); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadThongTinGiaDinh(int MGD) { string query = "Select * from tblHoGiaDinh where MaSoGiaDinh =" + MGD.ToString(); DataSet ds = cls.ExecuteQuery(query); txtDaiDien.Text = ds.Tables[0].Rows[0]["NguoiDaiDien"].ToString(); nbrKhauChinhThuc.Value = Convert.ToInt32(ds.Tables[0].Rows[0]["KhauChinhThuc"].ToString()); nbrKhauXemXet.Value = Convert.ToInt32(ds.Tables[0].Rows[0]["KhauXemXet"].ToString()); nbrSoNguoi.Value = Convert.ToInt32(ds.Tables[0].Rows[0]["SoNguoi"].ToString()); txtDiaChi.Text = ds.Tables[0].Rows[0]["DiaChi"].ToString(); rtbGhiChu.Text = ds.Tables[0].Rows[0]["GhiChu"].ToString(); cmbThon.Text = ds.Tables[0].Rows[0]["Thon"].ToString(); }
private void FillData(string query) { try { ds.Tables.Clear(); ds = cls.ExecuteQuery(query); if (ds != null && ds.Tables != null) { dataGridView1.DataSource = ds.Tables[0]; DatagridviewStyle(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FillData(int MSHS) { try { ds.Tables.Clear(); string query = " select * from tblNopThueDatNN where MaDonViHanhChinh ='" + clsConfig.MaDonVihanhChinh + "' and MaHoSoCapGCNDatNN ='" + MSHS + "' "; ds = cls.ExecuteQuery(query); if (ds != null && ds.Tables != null) { dataGridView1.DataSource = ds.Tables[0]; DatagridviewStyle(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnXoa_Click(object sender, EventArgs e) { var result = MessageBox.Show("BẠN có chắc muốn xóa hồ sơ này?", "XÓA hồ sơ!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (clsConfig.MaHoSo != 0) { string query = " update tblHoSoCapGCNDatNN set BaoXoa = 1 where MaHoSoCapGCNDatNN ='" + clsConfig.MaHoSo + "' "; cls.ExecuteQuery(query); } HideAllControl_in_Panel2(); clsConfig.Refresh(); LayTrangThaiHoSo(); Status(1); } }
void LoadThongTinTab2(int _MaHS) { if (_MaHS != 0) { string query = "select * from tblHoSoCapGCNDatNN where MaHoSoCapGCNDatNN =" + _MaHS.ToString() + " and MaDonViHanhChinh ='" + clsConfig.MaDonVihanhChinh + "' "; DataSet dts = new DataSet(); try { dts = cls.ExecuteQuery(query); if (dts.Tables[0].Rows.Count > 0) { try { dtpNgayVaoSo.Value = Convert.ToDateTime(dts.Tables[0].Rows[0]["NgayVaoSoCapGCN"]); } catch { dtpNgayVaoSo.Value = DateTime.Today; } try { dtpNgayKyGCN.Value = Convert.ToDateTime(dts.Tables[0].Rows[0]["NgayKyGCN"]); } catch { dtpNgayKyGCN.Value = DateTime.Today; } txtNguoiKyGCN.Text = dts.Tables[0].Rows[0]["NguoiKyGCN"].ToString(); txtTieuDeKyGCN.Text = dts.Tables[0].Rows[0]["TieuDeKyGCN"].ToString(); txtSoPhatHanh.Text = dts.Tables[0].Rows[0]["SoPhatHanh"].ToString(); txtTieuDeKyGCN.Text = dts.Tables[0].Rows[0]["NguoiKyGCN"].ToString(); txtSoVaoSo.Text = dts.Tables[0].Rows[0]["SoVaoSoCapGCN"].ToString(); } } catch (Exception ex) { //MessageBox.Show(ex.Message); } } dtpNgayKyGCN.Format = DateTimePickerFormat.Custom; dtpNgayKyGCN.CustomFormat = "dd/MM/yyyy"; dtpNgayVaoSo.Format = DateTimePickerFormat.Custom; dtpNgayVaoSo.CustomFormat = "dd/MM/yyyy"; }
private void ReLoad() { TimDanhSachHoSoBienDong(); for (int i = 0; i < DanhSachMaHoSo.Count; i++) { TreeNode nodeHS = new TreeNode("Hồ sơ: " + DanhSachMaHoSo[i]); treeView1.Nodes.Add(nodeHS); if (GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i])).Length > 0) { for (int j = 0; j < GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i])).Length; j++) { ds.Tables.Clear(); ds = cls.ExecuteQuery(" select * from tblDangKyBienDongDatNN where MaHoSo =" + DanhSachMaHoSo[i] + " and MaDangKyBienDong =" + GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i]))[j]); Contents[0] = ds.Tables[0].Rows[0]["MaHoSo"].ToString(); Contents[1] = ds.Tables[0].Rows[0]["MaDangKyBienDong"].ToString(); Contents[2] = Convert.ToDateTime(ds.Tables[0].Rows[0]["NgayDangKy"]).ToString("dd/MM/yyyy"); Contents[3] = ds.Tables[0].Rows[0]["LoaiBienDong"].ToString(); Contents[4] = ds.Tables[0].Rows[0]["NoiDungBienDong"].ToString(); if (GetMaBienDong(Convert.ToInt32(DanhSachMaHoSo[i]))[j] == MaBienDong.ToString()) { Location_Y_Panel += CreatePanel(i, Location_Y_Panel, true, Contents, Contents[1]); } else { Location_Y_Panel += CreatePanel(i, Location_Y_Panel, false, Contents, Contents[1]); } TreeNode nodeBD = new TreeNode("Biến động: " + Contents[1] + " (" + Contents[2] + ")"); nodeBD.Name = Contents[1]; nodeHS.Nodes.Add(nodeBD); treeView1.AfterSelect += treeView1_AfterSelect; } } } treeView1.ExpandAll(); }