private void F_DangNhap_Load(object sender, EventArgs e) { try { string Server = (string)Registry.GetValue(RegistryDocMIS, "SQL_ServerName", RegistryDoc); string Authentication = (string)Registry.GetValue(RegistryDocMIS, "SQL_LoginWin", RegistryDoc); string Username = (string)Registry.GetValue(RegistryDocMIS, "SQL_UserName", RegistryDoc); string Password = (string)Registry.GetValue(RegistryDocMIS, "SQL_Password", RegistryDoc); string Database = (string)Registry.GetValue(RegistryDocMIS, "SQL_DataBase", RegistryDoc); SqlConnection sqlcon; if (Authentication.Equals("0")) { sqlcon = new SqlConnection("Server=" + Server + "; Database=" + Database + "; Trusted_Connection=True"); } else { sqlcon = new SqlConnection("@”Data Source=" + Server + ";Initial Catalog=" + Database + ";User ID=" + Username + ";password="******"Login_Username", RegistryDoc); textEdit_matKhau.Text = (string)Registry.GetValue(RegistryDocMIS, "Login_Password", RegistryDoc); if (Convert.ToString(Registry.GetValue(RegistryDocMIS, "Login_Check", RegistryDoc)).Equals("true")) { checkEdit_luu.Checked = true; } else { checkEdit_luu.Checked = false; } } catch { } }
public void loadListArray() { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { sql.ToString(); } catch { sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; } listBox_DanhSach.Items.Clear(); string s = "SELECT MaID,TenDangNhap,HoTen,Cap FROM Taikhoan"; mang_ID = sql.GetDataArray(s, 0); mang_TenDangNhap = sql.GetDataArray(s, 1); mang_TenNguoiDung = sql.GetDataArray(s, 2); mang_NhomQuanLy = sql.GetDataArray(s, 3); int i = 0; while (!string.IsNullOrEmpty(mang_TenDangNhap[i])) { listBox_DanhSach.Items.Add(i + ". " + mang_TenDangNhap[i]); i++; } Cursor = Cursors.Default; }
public void ketThucDangNhap() { string s = "update Taikhoan_Lichsu set ThoiDiemKetThuc = '" + DateTime.Now + "', LogOn = 1 where LogOn = 0 "; SQLConnect sql = (SQLConnect)SQL_con_object; sql.ExecuteData(s); khay_HeThong.Visible = false; }
private void F_Main_NhatKyDangNhap_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; DataTable table = new DataTable(); DataColumn col0 = new DataColumn(); col0.DataType = System.Type.GetType("System.Int32"); col0.ColumnName = "STT"; table.Columns.Add(col0); DataColumn col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Tên đăng nhập"; table.Columns.Add(col1); DataColumn col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Họ và tên"; table.Columns.Add(col2); DataColumn col3 = new DataColumn(); col3.DataType = System.Type.GetType("System.String"); col3.ColumnName = "Thời điểm bắt đầu"; table.Columns.Add(col3); DataColumn col4 = new DataColumn(); col4.DataType = System.Type.GetType("System.String"); col4.ColumnName = "Thời điểm kết thúc"; table.Columns.Add(col4); DataColumn col5 = new DataColumn(); col5.DataType = System.Type.GetType("System.String"); col5.ColumnName = "Địa chỉ IP"; table.Columns.Add(col5); gridControl1.DataSource = table; gridView1.Columns[0].Width = 25; DataColumn[] col = { col0, col1, col2, col3, col4, col5 }; SQLConnect sql = F_DangNhap.SQL_con_object as SQLConnect; string s = "SELECT ROW_NUMBER() OVER(ORDER BY Taikhoan_Lichsu.ThoiDiemBatDau desc) AS Row#, Taikhoan.TenDangNhap,Taikhoan.HoTen,Taikhoan_Lichsu.ThoiDiemBatDau,Taikhoan_Lichsu.ThoiDiemKetThuc,Taikhoan_Lichsu.DiaChiIP FROM Taikhoan INNER JOIN Taikhoan_Lichsu ON Taikhoan.MaID=Taikhoan_Lichsu.MaID WHERE (Taikhoan_Lichsu.LogOn=1)"; sql.ViewDataTable(s, table, col); Cursor = Cursors.Default; }
private void F_Main_DMHuyen_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //Gridcontrol2 DSLoaiDat table_DSHuyen = new DataTable(); co0 = new DataColumn(); co0.DataType = System.Type.GetType("System.Int32"); co0.ColumnName = "STT"; table_DSHuyen.Columns.Add(co0); co1 = new DataColumn(); co1.DataType = System.Type.GetType("System.String"); co1.ColumnName = "Mã đơn vị Huyện"; table_DSHuyen.Columns.Add(co1); co2 = new DataColumn(); co2.DataType = System.Type.GetType("System.String"); co2.ColumnName = "Tên đơn vị Huyện"; table_DSHuyen.Columns.Add(co2); gridControl1.Width = int.MaxValue; gridControl1.DataSource = table_DSHuyen; gridView1.OptionsBehavior.Editable = false; //gridView1.OptionsView.ColumnAutoWidth = false; gridView1.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView1.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView1.Columns[0].Width = 5; gridView1.Columns[1].Width = 70; gridView1.Columns[2].Width = 300; //Chèn dữ liệu vào gridcontrol string s1 = "SELECT COUNT(ID) as SoHuyen FROM [GIAODAT].[dbo].[DMDvhc]"; groupControl1.Text = "Danh sách đơn vị Huyện | Tổng số Huyện : " + sql.GetData(s1, 0); DataColumn[] Array_col2 = { co0, co1, co2 }; s1 = "SELECT ROW_NUMBER() OVER(ORDER BY [TenDvhc] ASC) AS Row#,[MaDvhc],[TenDvhc] FROM [GIAODAT].[dbo].[DMDvhc]"; table_DSHuyen.Clear(); sql.ViewDataTable(s1, table_DSHuyen, Array_col2); Cursor = Cursors.Default; }
private void simpleButton1_Click(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { if (String.IsNullOrEmpty(textEdit_tenDangNhap.Text) || String.IsNullOrEmpty(textEdit_matKhau.Text)) { DevExpress.XtraEditors.XtraMessageBox.Show("Vui Lòng Nhập Đầy Đủ Thông Tin !"); return; } SQLConnect sql = (SQLConnect)SQL_con_object; string s = "SELECT * FROM Taikhoan WHERE (TenDangNhap='" + textEdit_tenDangNhap.Text + "') AND (MatKhau='" + sql.StringToMD5(textEdit_matKhau.Text) + "')"; if (String.IsNullOrEmpty(sql.GetData(s, 0))) { DevExpress.XtraEditors.XtraMessageBox.Show("Username và Password không đúng !", "Cảnh Báo"); return; } if (checkEdit_luu.Checked) { Registry.SetValue(RegistryDocMIS, "Login_Check", "true"); Registry.SetValue(RegistryDocMIS, "Login_Username", textEdit_tenDangNhap.Text); Registry.SetValue(RegistryDocMIS, "Login_Password", textEdit_matKhau.Text); } else { Registry.SetValue(RegistryDocMIS, "Login_Check", "false"); } NguoiDung person = new NguoiDung(sql.GetData(s, 0), sql.GetData(s, 1), sql.GetData(s, 2), sql.GetData(s, 3), sql.GetData(s, 4), sql.GetData(s, 5), sql.GetData(s, 6), int.Parse(sql.GetData(s, 7)), sql.GetData(s, 8)); person_object = (NguoiDung)person; s = "INSERT INTO Taikhoan_Lichsu VALUES (" + person.MaID + ",'" + DateTime.Now + "',NULL,N'" + sql.GetLocalIPAddress() + "',0)"; sql.ExecuteData(s); form_Main = new F_Main(this); form_Main.Show(); khay_HeThong.Visible = true; khay_HeThong.ShowBalloonTip(10); this.Hide(); } catch { DevExpress.XtraEditors.XtraMessageBox.Show("Bạn chưa kết nối CSDL !", "Cảnh Báo"); form_DangNhap_CauHinh = new F_DangNhap_CauHinh(); form_DangNhap_CauHinh.Show(); } Cursor = Cursors.Default; }
private void simpleButton_OK_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textEdit_Username.Text) || String.IsNullOrEmpty(textEdit_Password.Text) || String.IsNullOrEmpty(textEdit_HT.Text) || String.IsNullOrEmpty(textEdit_DiaChi.Text)) { DevExpress.XtraEditors.XtraMessageBox.Show("Vui Lòng Nhập Đầy Đủ Thông Tin !"); return; } DialogResult re = DialogResult.No; re = DevExpress.XtraEditors.XtraMessageBox.Show("Bạn thực sự muốn thêm '" + textEdit_Username.Text + "' ?", "Cảnh Báo", MessageBoxButtons.YesNo); if (re == DialogResult.Yes) { try { SQLConnect sql = F_DangNhap.SQL_con_object as SQLConnect; string s1 = "SELECT TenDangNhap FROM Taikhoan WHERE TenDangNhap='" + textEdit_Username.Text + "'"; if (!String.IsNullOrEmpty(sql.GetData(s1, 0))) { DevExpress.XtraEditors.XtraMessageBox.Show("Tên đăng nhập đã tồn tại !", "Cảnh Báo"); return; } string user = textEdit_Username.Text; string pass = textEdit_Password.Text; string HoTen = textEdit_HT.Text; string NgaySinh = dateEdit_NS.DateTime.Month + "/" + dateEdit_NS.DateTime.Day + "/" + dateEdit_NS.DateTime.Year; string DiaChi = textEdit_DiaChi.Text; string gtinh = "Nam"; if (radioGroup_GT.SelectedIndex.ToString().Equals("0")) { gtinh = "Nam"; } else { gtinh = "Nữ"; } int quyen = radioGroup_CapQuyen.SelectedIndex; string s2 = "INSERT INTO Taikhoan(TenDangNhap, MatKhau, HoTen, NgaySinh, QueQuan, GioiTinh, Cap, NgayTao) VALUES (N'" + user + "',N'" + sql.StringToMD5(pass) + "',N'" + HoTen + "',N'" + NgaySinh + "',N'" + DiaChi + "',N'" + gtinh + "'," + quyen + ",'" + DateTime.Now + "');"; sql.ExecuteData(s2); DevExpress.XtraEditors.XtraMessageBox.Show("Thêm thành công !"); this.Close(); } catch { } } }
private void simpleButton_OK_Click(object sender, EventArgs e) { try { NguoiDung nguoi = F_DangNhap.person_object as NguoiDung; SQLConnect sql = F_DangNhap.SQL_con_object as SQLConnect; string mkCu = this.textEdit_MKhauCu.Text; string mkMoi = this.textEdit_MKhauMoi.Text; string nLai = this.textEdit_NhapLai.Text; if (string.IsNullOrEmpty(mkCu) || string.IsNullOrEmpty(mkMoi) || string.IsNullOrEmpty(nLai)) { DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng nhập đầy đủ thông tin !"); return; } mkCu = sql.StringToMD5(mkCu); if (!mkCu.Equals(nguoi.MatKhau.ToString())) { DevExpress.XtraEditors.XtraMessageBox.Show("Mật khẩu cũ không khớp !"); return; } if (!mkMoi.Equals(nLai)) { DevExpress.XtraEditors.XtraMessageBox.Show("Hai mật khẩu mới không trùng nhau !"); return; } nguoi.MatKhau = sql.StringToMD5(mkMoi); String s = "UPDATE Table_NhanVien SET MatKhau='" + nguoi.MatKhau.ToString() + "' WHERE MaID=" + nguoi.MaID.ToString(); sql.ExecuteData(s); DevExpress.XtraEditors.XtraMessageBox.Show("Cập nhật thành công !"); this.Close(); } catch { DevExpress.XtraEditors.XtraMessageBox.Show("Đã xảy ra lỗi !"); } }
private void simpleButton_OK_Click(object sender, EventArgs e) { try { SqlConnection sqlcon; if (comboBoxEdit_Server.Text.Equals("") || comboBoxEdit_Database.Text.Equals("")) { DevExpress.XtraEditors.XtraMessageBox.Show("Chưa có thông tin máy chủ hoặc CSDL !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } else { if (radioGroup_Authentication.SelectedIndex.ToString().Equals("0")) { sqlcon = new SqlConnection("Server=" + comboBoxEdit_Server.Text + "; Database=" + comboBoxEdit_Database.Text + "; Trusted_Connection=True"); } else { if (textEdit_Username.Text.Equals("") || textEdit_Password.Text.Equals("")) { DevExpress.XtraEditors.XtraMessageBox.Show("Chưa có thông tin Tên người dùng hoặc mật khẩu !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } else { sqlcon = new SqlConnection("@”Data Source=" + comboBoxEdit_Server.Text + ";Initial Catalog=" + comboBoxEdit_Database.Text + ";User ID=" + textEdit_Username.Text + ";password="******"Kết nối thành công !"); this.Close(); } catch { DevExpress.XtraEditors.XtraMessageBox.Show("Đã xảy ra lỗi !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } }
public F_Main_ThemToChuc(F_Main_TenToChuc frm, string ma, int so) { InitializeComponent(); sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; this.formTenToChuc = frm; this.maToChuc = ma; this.soduan = so; this.Text = "Chỉnh sửa thông tin tổ chức"; string s = "SELECT [MaTochuc] ,[TenTochuc] ,[Diachi] ,[Masothue] ,[Giamdoc] ,convert(NVARCHAR, NgayTL, 101) as NgayTL FROM [GIAODAT].[dbo].[TenTochuc] WHERE MaTochuc='" + ma + "' "; textEdit_maToChuc.Text = sql.GetData(s, 0); textEdit_TenToChuc.Text = sql.GetData(s, 1); textEdit_DiaChi.Text = sql.GetData(s, 2); textEdit_MST.Text = sql.GetData(s, 3); textEdit_GiamDoc.Text = sql.GetData(s, 4); dateEdit_NgayThanhLap.EditValue = sql.GetData(s, 5); simpleButton_NhapLai.Enabled = false; }
private void F_Main_NguonGocDat_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSDiaDiem table_DSNguonGocDat = new DataTable(); col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Mã"; table_DSNguonGocDat.Columns.Add(col1); col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Tên loại đất"; table_DSNguonGocDat.Columns.Add(col2); col3 = new DataColumn(); col3.DataType = System.Type.GetType("System.Int32"); col3.ColumnName = "Số dự án"; table_DSNguonGocDat.Columns.Add(col3); col4 = new DataColumn(); col4.DataType = System.Type.GetType("System.Double"); col4.ColumnName = "Tổng diện tích (m2)"; table_DSNguonGocDat.Columns.Add(col4); gridControl1.DataSource = table_DSNguonGocDat; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsView.ColumnAutoWidth = false; gridView1.Columns[0].Width = 40; gridView1.Columns[1].Width = 200; gridView1.Columns[2].Width = 60; gridView1.Columns[3].Width = 100; DataColumn[] Array_col1 = { col1, col2, col3, col4 }; string s = "SELECT t1.MaLD,t1.TenLD,ISNULL(t2.SoDuAn, 0 ) as DuAn,ISNULL(t2.TongDT, 0 ) as DT FROM (SELECT MaLD,TenLD FROM DMLoaidat) t1 LEFT JOIN (SELECT a.MaLD, COUNT(a.IDGD) as SoDuAn, SUM(a.DT) as TongDT FROM (SELECT IDGD,MaLD, SUM(Dientich) as DT FROM LDTruocGiao GROUP BY IDGD,MaLD) a GROUP BY a.MaLD) t2 ON t1.MaLD = t2.MaLD ORDER BY DuAn desc"; sql.ViewDataTable(s, table_DSNguonGocDat, Array_col1); //GridControl2 DSDuAn table_DSDuAn = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Địa điểm"; table_DSDuAn.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Huyện"; table_DSDuAn.Columns.Add(c3); c3_5 = new DataColumn(); c3_5.DataType = System.Type.GetType("System.Double"); c3_5.ColumnName = "Diện tích theo nguồn gốc đất (m2)"; table_DSDuAn.Columns.Add(c3_5); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.Double"); c4.ColumnName = "Diện tích trước giao (m2)"; table_DSDuAn.Columns.Add(c4); c5 = new DataColumn(); c5.DataType = System.Type.GetType("System.Double"); c5.ColumnName = "Diện tích sau giao (m2)"; table_DSDuAn.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Số quyết định"; table_DSDuAn.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Ngày quyết định"; table_DSDuAn.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Ngày giao"; table_DSDuAn.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Thời hạn"; table_DSDuAn.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn.Columns.Add(c11); gridControl2.Width = int.MaxValue; gridControl2.DataSource = table_DSDuAn; gridView2.OptionsBehavior.Editable = false; gridView2.OptionsView.ColumnAutoWidth = false; gridView2.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView2.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView2.Columns[0].Width = 25; gridView2.Columns[1].Width = 300; gridView2.Columns[2].Width = 250; gridView2.Columns[3].Width = 110; gridView2.Columns[4].Width = 170; gridView2.Columns[5].Width = 130; gridView2.Columns[6].Width = 120; gridView2.Columns[7].Width = 90; gridView2.Columns[8].Width = 90; gridView2.Columns[9].Width = 70; gridView2.Columns[10].Width = 70; gridView2.Columns[11].Width = 320; gridView2.Columns[12].Width = 150; Cursor = Cursors.Default; }
private void F_Main_ThoiHanSuDung_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl2 DSDuAn table_DSDuAn = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Ngày giao"; table_DSDuAn.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Hết hạn"; table_DSDuAn.Columns.Add(c3); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.String"); c4.ColumnName = "Còn lại"; table_DSDuAn.Columns.Add(c4); //c5 = new DataColumn(); //c5.DataType = System.Type.GetType("System.String"); //c5.ColumnName = "Số tháng còn lại khoảng"; //table_DSDuAn.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Địa điểm"; table_DSDuAn.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Mã huyện"; table_DSDuAn.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Số quyết định"; table_DSDuAn.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Ngày quyết định"; table_DSDuAn.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn.Columns.Add(c11); gridControl1.Width = int.MaxValue; gridControl1.DataSource = table_DSDuAn; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsView.ColumnAutoWidth = false; gridView1.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView1.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView1.Columns[0].Width = 25; gridView1.Columns[1].Width = 350; gridView1.Columns[2].Width = 90; gridView1.Columns[3].Width = 90; gridView1.Columns[4].Width = 120; //gridView1.Columns[5].Width = 150; gridView1.Columns[5].Width = 250; gridView1.Columns[6].Width = 110; gridView1.Columns[7].Width = 90; gridView1.Columns[8].Width = 90; gridView1.Columns[9].Width = 370; gridView1.Columns[10].Width = 200; this.ShowAllData(-1); Cursor = Cursors.Default; }
private void F_Main_HinhThucSuDung_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSHinhThucSuDung table_DSHinhThucSuDung = new DataTable(); col0 = new DataColumn(); col0.DataType = System.Type.GetType("System.Int32"); col0.ColumnName = "STT"; table_DSHinhThucSuDung.Columns.Add(col0); col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Mã"; table_DSHinhThucSuDung.Columns.Add(col1); col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Hình thức sử dụng"; table_DSHinhThucSuDung.Columns.Add(col2); col3 = new DataColumn(); col3.DataType = System.Type.GetType("System.Int32"); col3.ColumnName = "Số tổ chức"; table_DSHinhThucSuDung.Columns.Add(col3); col4 = new DataColumn(); col4.DataType = System.Type.GetType("System.Int32"); col4.ColumnName = "Số dự án"; table_DSHinhThucSuDung.Columns.Add(col4); gridControl1.DataSource = table_DSHinhThucSuDung; gridView1.OptionsBehavior.Editable = false; //gridView1.OptionsView.ColumnAutoWidth = false; gridView1.Columns[0].Width = 25; gridView1.Columns[1].Width = 80; gridView1.Columns[2].Width = 300; //gridView1.Columns[2].Width = 60; //gridView1.Columns[3].Width = 50; DataColumn[] Array_col1 = { col0, col1, col2, col3, col4 }; string s = "SELECT ROW_NUMBER() OVER(ORDER BY t1.MaHinhthuc asc) AS Row#, t1.MaHinhthuc, t1.TenHinhthuc, ISNULL(t2.SoToChuc, 0 ) as SoToChuc, ISNULL(t2.SoDuAn, 0 ) as SoDuAn FROM (SELECT MaHinhthuc,TenHinhthuc FROM DMHinhthucsudung) t1 LEFT JOIN (SELECT a.MaHinhthuc, a.SoDuAn , b.SoToChuc FROM (SELECT MaHinhthuc, COUNT(IDGD) as SoDuAn FROM Giaodat GROUP BY MaHinhthuc) a, (SELECT a.MaHinhthuc, COUNT(a.MaHinhthuc) as SoToChuc FROM (SELECT MaHinhthuc FROM Giaodat GROUP BY MaHinhthuc, MaTochuc) a GROUP BY a.MaHinhthuc) b WHERE a.MaHinhthuc=b.MaHinhthuc) t2 ON t1.MaHinhthuc = t2.MaHinhthuc"; sql.ViewDataTable(s, table_DSHinhThucSuDung, Array_col1); string TCThueDat = "SELECT a.TongSoToChuc, b.TongDT FROM (SELECT SUM(a.SoToChuc) as TongSoToChuc FROM (SELECT a.MaHinhthuc, COUNT(a.MaHinhthuc) as SoToChuc FROM (SELECT MaHinhthuc FROM Giaodat WHERE MaHinhthuc = 'DT-KCN-THN' or MaHinhthuc = 'DT-KCN-TML' or MaHinhthuc = 'DT-THN' or MaHinhthuc = 'DT-TML' GROUP BY MaHinhthuc, MaTochuc) a GROUP BY a.MaHinhthuc) a) a, (SELECT SUM(b.TongDTTruoc) as TongDT FROM (SELECT LDTruocGiao.IDGD, SUM(Dientich) as TongDTTruoc FROM LDTruocGiao, Giaodat WHERE Giaodat.IDGD = LDTruocGiao.IDGD and (MaHinhthuc = 'DT-KCN-THN' or MaHinhthuc = 'DT-KCN-TML' or MaHinhthuc = 'DT-THN' or MaHinhthuc = 'DT-TML') GROUP BY LDTruocGiao.IDGD) b) b"; string TCGiaoDat = "SELECT a.TongSoToChuc, b.TongDT FROM (SELECT SUM(a.SoToChuc) as TongSoToChuc FROM (SELECT a.MaHinhthuc, COUNT(a.MaHinhthuc) as SoToChuc FROM (SELECT MaHinhthuc FROM Giaodat WHERE MaHinhthuc = 'DG-CTT' or MaHinhthuc = 'DG-KTT' or MaHinhthuc = 'DG-QL' or MaHinhthuc = 'CNQ-KTT' or MaHinhthuc = 'CNQ-CTT' GROUP BY MaHinhthuc, MaTochuc) a GROUP BY a.MaHinhthuc) a) a, (SELECT SUM(b.TongDTTruoc) as TongDT FROM (SELECT LDTruocGiao.IDGD, SUM(Dientich) as TongDTTruoc FROM LDTruocGiao, Giaodat WHERE Giaodat.IDGD = LDTruocGiao.IDGD and (MaHinhthuc = 'DG-CTT' or MaHinhthuc = 'DG-KTT' or MaHinhthuc = 'DG-QL' or MaHinhthuc = 'CNQ-KTT' or MaHinhthuc = 'CNQ-CTT') GROUP BY LDTruocGiao.IDGD) b) b"; groupControl2.Text = "Có " + sql.GetData(TCThueDat, 0) + " tổ chức thuê đất, tổng diện tích đất cho thuê là " + sql.GetData(TCThueDat, 1) + " m2 || Có " + sql.GetData(TCGiaoDat, 0) + " tổ chức được giao đất, tổng diện tích đất giao là " + sql.GetData(TCGiaoDat, 1) + " m2 "; //Gridcontrol2 DSToChuc table_DSToChuc = new DataTable(); co0 = new DataColumn(); co0.DataType = System.Type.GetType("System.Int32"); co0.ColumnName = "STT"; table_DSToChuc.Columns.Add(co0); co1 = new DataColumn(); co1.DataType = System.Type.GetType("System.String"); co1.ColumnName = "Mã tổ chức"; table_DSToChuc.Columns.Add(co1); co2 = new DataColumn(); co2.DataType = System.Type.GetType("System.String"); co2.ColumnName = "Tên tổ chức"; table_DSToChuc.Columns.Add(co2); co3 = new DataColumn(); co3.DataType = System.Type.GetType("System.Int32"); co3.ColumnName = "Số dự án với hình thức sử dụng"; table_DSToChuc.Columns.Add(co3); co4 = new DataColumn(); co4.DataType = System.Type.GetType("System.String"); co4.ColumnName = "Địa chỉ"; table_DSToChuc.Columns.Add(co4); co5 = new DataColumn(); co5.DataType = System.Type.GetType("System.String"); co5.ColumnName = "Mã số thuế"; table_DSToChuc.Columns.Add(co5); co6 = new DataColumn(); co6.DataType = System.Type.GetType("System.String"); co6.ColumnName = "Giám đốc"; table_DSToChuc.Columns.Add(co6); co7 = new DataColumn(); co7.DataType = System.Type.GetType("System.String"); co7.ColumnName = "Ngày thành lập"; table_DSToChuc.Columns.Add(co7); gridControl2.Width = int.MaxValue; gridControl2.DataSource = table_DSToChuc; gridView2.OptionsBehavior.Editable = false; gridView2.OptionsView.ColumnAutoWidth = false; gridView2.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView2.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView2.Columns[0].Width = 25; gridView2.Columns[1].Width = 70; gridView2.Columns[2].Width = 300; gridView2.Columns[3].Width = 170; gridView2.Columns[4].Width = 350; gridView2.Columns[5].Width = 100; gridView2.Columns[6].Width = 100; gridView2.Columns[7].Width = 100; //GridControl3 DSDuAn table_DSDuAn = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Địa điểm"; table_DSDuAn.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Huyện"; table_DSDuAn.Columns.Add(c3); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.Double"); c4.ColumnName = "Diện tích trước giao (m2)"; table_DSDuAn.Columns.Add(c4); c5 = new DataColumn(); c5.DataType = System.Type.GetType("System.Double"); c5.ColumnName = "Diện tích sau giao (m2)"; table_DSDuAn.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Số quyết định"; table_DSDuAn.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Ngày quyết định"; table_DSDuAn.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Ngày giao"; table_DSDuAn.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Thời hạn"; table_DSDuAn.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn.Columns.Add(c11); gridControl3.Width = int.MaxValue; gridControl3.DataSource = table_DSDuAn; gridView3.OptionsBehavior.Editable = false; gridView3.OptionsView.ColumnAutoWidth = false; gridView3.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView3.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView3.Columns[0].Width = 25; gridView3.Columns[1].Width = 300; gridView3.Columns[2].Width = 250; gridView3.Columns[3].Width = 110; gridView3.Columns[4].Width = 130; gridView3.Columns[5].Width = 120; gridView3.Columns[6].Width = 90; gridView3.Columns[7].Width = 90; gridView3.Columns[8].Width = 70; gridView3.Columns[9].Width = 70; gridView3.Columns[10].Width = 300; gridView3.Columns[11].Width = 150; Cursor = Cursors.Default; }
private void XtraForm1_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl Columns table_Columns = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_Columns.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên cột"; table_Columns.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.Double"); c2.ColumnName = "Độ rộng"; table_Columns.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.Int32"); c3.ColumnName = "Hiện"; table_Columns.Columns.Add(c3); gridControl1.DataSource = table_Columns; RepositoryItemTrackBar trackBaritem = new RepositoryItemTrackBar(); trackBaritem.Minimum = 10; trackBaritem.Maximum = 500; gridView1.Columns[2].ColumnEdit = trackBaritem; RepositoryItemCheckEdit checkEdititem = new RepositoryItemCheckEdit(); checkEdititem.ValueChecked = 1; checkEdititem.ValueUnchecked = 0; gridView1.Columns[3].ColumnEdit = checkEdititem; gridView1.Columns[0].Width = 20; gridView1.Columns[1].Width = 100; gridView1.Columns[2].Width = 200; gridView1.Columns[3].Width = 50; gridView1.Columns[0].OptionsColumn.AllowEdit = false; gridView1.Columns[1].OptionsColumn.AllowEdit = false; this.InsertDataTable(table_In, false); trackBarControl_DoRong.Properties.Minimum = 30; trackBarControl_DoRong.Properties.Maximum = 1000; trackBarControl_DoRong.EditValue = xtra.xrTable1.WidthF; trackBarControl_ViTri_X.Properties.Minimum = 0; trackBarControl_ViTri_X.Properties.Maximum = 300; trackBarControl_ViTri_X.EditValue = xtra.xrTable1.LocationF.X; this.documentViewer1.PrintingSystem = xtra.PrintingSystem; xtra.CreateDocument(); Cursor = Cursors.Default; }
private void F_Main_DMToChuc_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //Gridcontrol2 DSToChuc table_DSToChuc = new DataTable(); co0 = new DataColumn(); co0.DataType = System.Type.GetType("System.Int32"); co0.ColumnName = "STT"; table_DSToChuc.Columns.Add(co0); co1 = new DataColumn(); co1.DataType = System.Type.GetType("System.String"); co1.ColumnName = "Mã tổ chức"; table_DSToChuc.Columns.Add(co1); co2 = new DataColumn(); co2.DataType = System.Type.GetType("System.String"); co2.ColumnName = "Tên tổ chức"; table_DSToChuc.Columns.Add(co2); co3 = new DataColumn(); co3.DataType = System.Type.GetType("System.String"); co3.ColumnName = "Địa chỉ"; table_DSToChuc.Columns.Add(co3); co4 = new DataColumn(); co4.DataType = System.Type.GetType("System.String"); co4.ColumnName = "Mã số thuế"; table_DSToChuc.Columns.Add(co4); co5 = new DataColumn(); co5.DataType = System.Type.GetType("System.String"); co5.ColumnName = "Giám đốc"; table_DSToChuc.Columns.Add(co5); co6 = new DataColumn(); co6.DataType = System.Type.GetType("System.String"); co6.ColumnName = "Ngày thành lập"; table_DSToChuc.Columns.Add(co6); gridControl1.Width = int.MaxValue; gridControl1.DataSource = table_DSToChuc; gridView1.OptionsBehavior.Editable = false; //gridView1.OptionsView.ColumnAutoWidth = false; gridView1.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView1.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView1.Columns[0].Width = 5; gridView1.Columns[1].Width = 70; gridView1.Columns[2].Width = 300; gridView1.Columns[3].Width = 350; gridView1.Columns[4].Width = 100; gridView1.Columns[5].Width = 100; gridView1.Columns[6].Width = 100; //Chèn dữ liệu vào gridcontrol string s1 = "SELECT COUNT(IDTC) as SoToChuc FROM TenTochuc"; groupControl1.Text = "Danh sách tổ chức | Tổng số tổ chức : " + sql.GetData(s1, 0); DataColumn[] Array_col2 = { co0, co1, co2, co3, co4, co5, co6 }; s1 = "SELECT ROW_NUMBER() OVER(ORDER BY [TenTochuc] ASC) AS Row#,[MaTochuc],[TenTochuc],[Diachi],[Masothue],[Giamdoc],convert(NVARCHAR, TenTochuc.NgayTL, 103) as NgayTL FROM [GIAODAT].[dbo].[TenTochuc]"; table_DSToChuc.Clear(); sql.ViewDataTable(s1, table_DSToChuc, Array_col2); Cursor = Cursors.Default; }
private void F_Main_TenDuAn_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSTenToChuc table_DSTenDuAn = new DataTable(); col0 = new DataColumn(); col0.DataType = System.Type.GetType("System.Int32"); col0.ColumnName = "STT"; table_DSTenDuAn.Columns.Add(col0); col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "ID"; table_DSTenDuAn.Columns.Add(col1); col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Tên dự án"; table_DSTenDuAn.Columns.Add(col2); gridControl1.DataSource = table_DSTenDuAn; gridView1.OptionsBehavior.Editable = false; //gridView1.OptionsView.ColumnAutoWidth = false; gridView1.Columns[0].Width = 20; gridView1.Columns[1].Width = 20; gridView1.Columns[2].Width = 200; DataColumn[] Array_col1 = { col0, col1, col2 }; string s = "SELECT ROW_NUMBER() OVER(ORDER BY TenDuan asc) AS Row#,[IDGD],[TenDuan] FROM [GIAODAT].[dbo].[Giaodat]"; sql.ViewDataTable(s, table_DSTenDuAn, Array_col1); //Gridcontrol2 Trươc giao table_Truoc = new DataTable(); col_truoc1 = new DataColumn(); col_truoc1.DataType = System.Type.GetType("System.String"); col_truoc1.ColumnName = "Loại đất"; table_Truoc.Columns.Add(col_truoc1); col_truoc2 = new DataColumn(); col_truoc2.DataType = Type.GetType("System.Double"); col_truoc2.ColumnName = "Diện tích (m2)"; table_Truoc.Columns.Add(col_truoc2); gridControl2.DataSource = table_Truoc; gridView2.OptionsBehavior.Editable = false; gridView2.Columns[0].Width = 150; //Gridcontrol3 Sau giao table_Sau = new DataTable(); col_sau1 = new DataColumn(); col_sau1.DataType = System.Type.GetType("System.String"); col_sau1.ColumnName = "Loại đất"; table_Sau.Columns.Add(col_sau1); col_sau2 = new DataColumn(); col_sau2.DataType = Type.GetType("System.Double"); col_sau2.ColumnName = "Diện tích (m2)"; table_Sau.Columns.Add(col_sau2); gridControl3.DataSource = table_Sau; gridView3.OptionsBehavior.Editable = false; gridView3.Columns[0].Width = 150; Cursor = Cursors.Default; }
private void F_Main_DSachDiaDiem_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSDiaDiem table_DSDiaDiem = new DataTable(); col0 = new DataColumn(); col0.DataType = System.Type.GetType("System.Int32"); col0.ColumnName = "STT"; table_DSDiaDiem.Columns.Add(col0); col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Mã"; table_DSDiaDiem.Columns.Add(col1); col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Tên Huyện"; table_DSDiaDiem.Columns.Add(col2); col3 = new DataColumn(); col3.DataType = System.Type.GetType("System.Int32"); col3.ColumnName = "Số tổ chức"; table_DSDiaDiem.Columns.Add(col3); col4 = new DataColumn(); col4.DataType = System.Type.GetType("System.Int32"); col4.ColumnName = "Số dự án"; table_DSDiaDiem.Columns.Add(col4); gridControl1.DataSource = table_DSDiaDiem; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsView.ColumnAutoWidth = false; gridView1.Columns[0].Width = 25; gridView1.Columns[1].Width = 40; gridView1.Columns[2].Width = 107; gridView1.Columns[3].Width = 60; gridView1.Columns[4].Width = 50; DataColumn[] Array_col1 = { col0, col1, col2, col3, col4 }; string s = "SELECT ROW_NUMBER() OVER(ORDER BY t1.TenDvhc asc) AS Row#, t1.MaDvhc, t1.TenDvhc, ISNULL(t2.SoToChuc, 0 ) as SoToChuc, ISNULL(t2.SoDuAn, 0 ) as SoDuAn FROM (SELECT MaDvhc,TenDvhc FROM DMDvhc) t1 LEFT JOIN (SELECT a.MaDvhc, a.SoDuAn , b.SoToChuc FROM (SELECT MaDvhc, COUNT(IDGD) as SoDuAn FROM Giaodat GROUP BY MaDvhc) a, (SELECT a.MaDvhc, COUNT(a.MaDvhc) as SoToChuc FROM (SELECT MaDvhc FROM Giaodat GROUP BY MaDvhc, MaTochuc) a GROUP BY a.MaDvhc) b WHERE a.MaDvhc=b.MaDvhc) t2 ON t1.MaDvhc = t2.MaDvhc"; sql.ViewDataTable(s, table_DSDiaDiem, Array_col1); //Gridcontrol2 DSToChuc table_DSToChuc = new DataTable(); co0 = new DataColumn(); co0.DataType = System.Type.GetType("System.Int32"); co0.ColumnName = "STT"; table_DSToChuc.Columns.Add(co0); co1 = new DataColumn(); co1.DataType = System.Type.GetType("System.String"); co1.ColumnName = "Mã tổ chức"; table_DSToChuc.Columns.Add(co1); co2 = new DataColumn(); co2.DataType = System.Type.GetType("System.String"); co2.ColumnName = "Tên tổ chức"; table_DSToChuc.Columns.Add(co2); co3 = new DataColumn(); co3.DataType = System.Type.GetType("System.Int32"); co3.ColumnName = "Số dự án ở Huyện"; table_DSToChuc.Columns.Add(co3); co4 = new DataColumn(); co4.DataType = System.Type.GetType("System.String"); co4.ColumnName = "Địa chỉ"; table_DSToChuc.Columns.Add(co4); co5 = new DataColumn(); co5.DataType = System.Type.GetType("System.String"); co5.ColumnName = "Mã số thuế"; table_DSToChuc.Columns.Add(co5); co6 = new DataColumn(); co6.DataType = System.Type.GetType("System.String"); co6.ColumnName = "Giám đốc"; table_DSToChuc.Columns.Add(co6); co7 = new DataColumn(); co7.DataType = System.Type.GetType("System.String"); co7.ColumnName = "Ngày thành lập"; table_DSToChuc.Columns.Add(co7); gridControl2.Width = int.MaxValue; gridControl2.DataSource = table_DSToChuc; gridView2.OptionsBehavior.Editable = false; gridView2.OptionsView.ColumnAutoWidth = false; gridView2.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView2.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView2.Columns[0].Width = 25; gridView2.Columns[1].Width = 70; gridView2.Columns[2].Width = 300; gridView2.Columns[3].Width = 110; gridView2.Columns[4].Width = 350; gridView2.Columns[5].Width = 100; gridView2.Columns[6].Width = 100; gridView2.Columns[7].Width = 100; //GridControl3 DSDuAn table_DSDuAn = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Địa điểm"; table_DSDuAn.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Huyện"; table_DSDuAn.Columns.Add(c3); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.Double"); c4.ColumnName = "Diện tích trước giao (m2)"; table_DSDuAn.Columns.Add(c4); c5 = new DataColumn(); c5.DataType = System.Type.GetType("System.Double"); c5.ColumnName = "Diện tích sau giao (m2)"; table_DSDuAn.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Số quyết định"; table_DSDuAn.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Ngày quyết định"; table_DSDuAn.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Ngày giao"; table_DSDuAn.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Thời hạn"; table_DSDuAn.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn.Columns.Add(c11); gridControl3.Width = int.MaxValue; gridControl3.DataSource = table_DSDuAn; gridView3.OptionsBehavior.Editable = false; gridView3.OptionsView.ColumnAutoWidth = false; gridView3.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView3.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView3.Columns[0].Width = 25; gridView3.Columns[1].Width = 300; gridView3.Columns[2].Width = 250; gridView3.Columns[3].Width = 110; gridView3.Columns[4].Width = 130; gridView3.Columns[5].Width = 120; gridView3.Columns[6].Width = 90; gridView3.Columns[7].Width = 90; gridView3.Columns[8].Width = 70; gridView3.Columns[9].Width = 70; gridView3.Columns[10].Width = 300; gridView3.Columns[11].Width = 150; Cursor = Cursors.Default; }
public F_XemDuAn(string soQD) { InitializeComponent(); System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //Gridcontrol2 Trươc giao table_Truoc = new DataTable(); col_truoc1 = new DataColumn(); col_truoc1.DataType = System.Type.GetType("System.String"); col_truoc1.ColumnName = "Loại đất"; table_Truoc.Columns.Add(col_truoc1); col_truoc2 = new DataColumn(); col_truoc2.DataType = Type.GetType("System.Double"); col_truoc2.ColumnName = "Diện tích (m2)"; table_Truoc.Columns.Add(col_truoc2); gridControl2.DataSource = table_Truoc; gridView2.OptionsBehavior.Editable = false; gridView2.Columns[0].Width = 150; //Gridcontrol3 Sau giao table_Sau = new DataTable(); col_sau1 = new DataColumn(); col_sau1.DataType = System.Type.GetType("System.String"); col_sau1.ColumnName = "Loại đất"; table_Sau.Columns.Add(col_sau1); col_sau2 = new DataColumn(); col_sau2.DataType = Type.GetType("System.Double"); col_sau2.ColumnName = "Diện tích (m2)"; table_Sau.Columns.Add(col_sau2); gridControl3.DataSource = table_Sau; gridView3.OptionsBehavior.Editable = false; gridView3.Columns[0].Width = 150; // Chèn dữ liệu string s = "SELECT Giaodat.IDGD, Giaodat.TenDuan, Giaodat.Diadiem, DMDvhc.TenDvhc, Giaodat.SoQD, convert(NVARCHAR, Giaodat.NgayQD, 103) as NgayQD, convert(NVARCHAR, Giaodat.Ngaygiao, 103) as NgayGiao, convert(NVARCHAR, Giaodat.Thoihan, 103) as ThoiHan, DMHinhthucsudung.TenHinhthuc, Giaodat.TinhtrangPL, TenTochuc.TenTochuc, a.TongDTTruoc, b.TongDTDuoc FROM Giaodat, TenTochuc, DMDvhc, DMHinhthucsudung,( SELECT LDTruocGiao.IDGD, SUM(Dientich) as TongDTTruoc FROM LDTruocGiao, Giaodat WHERE Giaodat.IDGD = LDTruocGiao.IDGD GROUP BY LDTruocGiao.IDGD ) a, (SELECT LDDuocGiao.IDGD, SUM(Dientich) as TongDTDuoc FROM LDDuocGiao, Giaodat WHERE Giaodat.IDGD = LDDuocGiao.IDGD GROUP BY LDDuocGiao.IDGD) b WHERE Giaodat.SoQD='" + soQD + "' and Giaodat.MaTochuc = TenTochuc.MaTochuc and Giaodat.MaDvhc = DMDvhc.MaDvhc and Giaodat.MaHinhthuc = DMHinhthucsudung.MaHinhthuc and Giaodat.IDGD = a.IDGD and Giaodat.IDGD = b.IDGD"; labelControl_Ma.Text = sql.GetData(s, 0); labelControl_TenDA.Text = sql.GetData(s, 1); labelControl_DiaDiem.Text = sql.GetData(s, 2); labelControl_Huyen.Text = sql.GetData(s, 3); labelControl_SoQD.Text = sql.GetData(s, 4); labelControl_NgayQD.Text = sql.GetData(s, 5); labelControl_NgayGiao.Text = sql.GetData(s, 6); labelControl_ThoiHan.Text = sql.GetData(s, 7); labelControl_HinhThuc.Text = sql.GetData(s, 8); labelControl_TinhTrang.Text = sql.GetData(s, 9); labelControl_ToChuc.Text = sql.GetData(s, 10); groupControl4.Text = "Tổng diện tích trước giao : " + sql.GetData(s, 11) + " m2"; groupControl5.Text = "Tổng diện tích sau giao : " + sql.GetData(s, 12) + " m2"; DataColumn[] Array_col2 = { col_truoc1, col_truoc2 }; s = "SELECT DMLoaidat.TenLD,Dientich FROM DMLoaidat,LDTruocGiao WHERE LDTruocGiao.MaLD = DMLoaidat.MaLD and IDGD = " + labelControl_Ma.Text; table_Truoc.Clear(); sql.ViewDataTable(s, table_Truoc, Array_col2); DataColumn[] Array_col3 = { col_sau1, col_sau2 }; s = "SELECT DMLoaidat.TenLD,Dientich FROM DMLoaidat,LDDuocGiao WHERE LDDuocGiao.MaLD = DMLoaidat.MaLD and IDGD = " + labelControl_Ma.Text; table_Sau.Clear(); sql.ViewDataTable(s, table_Sau, Array_col3); Cursor = Cursors.Default; }
private void F_Main_QuyetDinh_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSTenToChuc table_DSQuyetDinh = new DataTable(); col0 = new DataColumn(); col0.DataType = System.Type.GetType("System.Int32"); col0.ColumnName = "STT"; table_DSQuyetDinh.Columns.Add(col0); col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Số quyết định"; table_DSQuyetDinh.Columns.Add(col1); col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Ngày quyết định"; table_DSQuyetDinh.Columns.Add(col2); gridControl1.DataSource = table_DSQuyetDinh; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsView.ColumnAutoWidth = true; gridView1.Columns[0].Width = 25; //gridView1.Columns[1].Width = 275; DataColumn[] Array_col1 = { col0, col1, col2 }; string s = "SELECT ROW_NUMBER() OVER(ORDER BY [NgayQD] DESC) AS Row#,[SoQD],convert(NVARCHAR,[NgayQD],103) as Ngay FROM [GIAODAT].[dbo].[Giaodat] "; sql.ViewDataTable(s, table_DSQuyetDinh, Array_col1); //Gridcontrol2 Trươc giao table_Truoc = new DataTable(); col_truoc1 = new DataColumn(); col_truoc1.DataType = System.Type.GetType("System.String"); col_truoc1.ColumnName = "Loại đất"; table_Truoc.Columns.Add(col_truoc1); col_truoc2 = new DataColumn(); col_truoc2.DataType = Type.GetType("System.Double"); col_truoc2.ColumnName = "Diện tích (m2)"; table_Truoc.Columns.Add(col_truoc2); gridControl2.DataSource = table_Truoc; gridView2.OptionsBehavior.Editable = false; gridView2.Columns[0].Width = 150; //Gridcontrol3 Sau giao table_Sau = new DataTable(); col_sau1 = new DataColumn(); col_sau1.DataType = System.Type.GetType("System.String"); col_sau1.ColumnName = "Loại đất"; table_Sau.Columns.Add(col_sau1); col_sau2 = new DataColumn(); col_sau2.DataType = Type.GetType("System.Double"); col_sau2.ColumnName = "Diện tích (m2)"; table_Sau.Columns.Add(col_sau2); gridControl3.DataSource = table_Sau; gridView3.OptionsBehavior.Editable = false; gridView3.Columns[0].Width = 150; Cursor = Cursors.Default; }
private void F_Main_TiepNhanHoSo_Load(object sender, EventArgs e) { sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //Lookupedit Huyen DataTable table_Huyen = new DataTable(); DataColumn col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Mã"; table_Huyen.Columns.Add(col1); DataColumn col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Đơn vị"; table_Huyen.Columns.Add(col2); lookUpEdit_Huyen.Properties.DataSource = table_Huyen; lookUpEdit_Huyen.Properties.DisplayMember = "Đơn vị"; lookUpEdit_Huyen.Properties.ValueMember = "Mã"; DataColumn[] Array_col1 = { col1, col2 }; string s1 = "SELECT [MaDvhc],[TenDvhc] FROM [GIAODAT].[dbo].[DMDvhc] ORDER BY TenDvhc asc"; sql.ViewDataTable(s1, table_Huyen, Array_col1); //Lookupedit Hình thức sử dụng DataTable table_HinhThucSuDung = new DataTable(); DataColumn column1 = new DataColumn(); column1.DataType = System.Type.GetType("System.String"); column1.ColumnName = "Mã"; table_HinhThucSuDung.Columns.Add(column1); DataColumn column2 = new DataColumn(); column2.DataType = System.Type.GetType("System.String"); column2.ColumnName = "Hình thức"; table_HinhThucSuDung.Columns.Add(column2); lookUpEdit_HinhThuc.Properties.DataSource = table_HinhThucSuDung; lookUpEdit_HinhThuc.Properties.DisplayMember = "Hình thức"; lookUpEdit_HinhThuc.Properties.ValueMember = "Mã"; DataColumn[] Array_col2 = { column1, column2 }; string s2 = "SELECT [MaHinhthuc],[TenHinhthuc] FROM [GIAODAT].[dbo].[DMHinhthucsudung] ORDER BY TenHinhthuc asc"; sql.ViewDataTable(s2, table_HinhThucSuDung, Array_col2); //Lookupedit Tình trạng pháp lý DataTable table_TinhTrangPL = new DataTable(); DataColumn cot = new DataColumn(); cot.DataType = System.Type.GetType("System.String"); cot.ColumnName = "Tình trạng"; table_TinhTrangPL.Columns.Add(cot); lookUpEdit_TinhTrangPL.Properties.DataSource = table_TinhTrangPL; lookUpEdit_TinhTrangPL.Properties.DisplayMember = "Tình trạng"; lookUpEdit_TinhTrangPL.Properties.ValueMember = "Tình trạng"; table_TinhTrangPL.BeginLoadData(); DataRow row = table_TinhTrangPL.NewRow(); row[0] = "Đã cấp giấy chứng nhận"; table_TinhTrangPL.Rows.Add(row); row = table_TinhTrangPL.NewRow(); row[0] = "Chưa cấp giấy chứng nhận"; table_TinhTrangPL.Rows.Add(row); table_TinhTrangPL.EndLoadData(); //Lookupedit Loai đất DataTable table_LoaiDat = new DataTable(); DataColumn col_loaidat1 = new DataColumn(); col_loaidat1.DataType = System.Type.GetType("System.String"); col_loaidat1.ColumnName = "Mã"; table_LoaiDat.Columns.Add(col_loaidat1); DataColumn col_loaidat2 = new DataColumn(); col_loaidat2.DataType = System.Type.GetType("System.String"); col_loaidat2.ColumnName = "Loại đất"; table_LoaiDat.Columns.Add(col_loaidat2); DataColumn[] Array_col3 = { col_loaidat1, col_loaidat2 }; string s3 = "SELECT [MaLD],[TenLD] FROM [GIAODAT].[dbo].[DMLoaidat] ORDER BY TenLD asc"; sql.ViewDataTable(s3, table_LoaiDat, Array_col3); //Gridcontrol Trươc giao table_Truoc = new DataTable(); DataColumn col_truoc1 = new DataColumn(); col_truoc1.DataType = System.Type.GetType("System.String"); col_truoc1.ColumnName = "Loại đất"; table_Truoc.Columns.Add(col_truoc1); DataColumn col_truoc2 = new DataColumn(); col_truoc2.DataType = Type.GetType("System.Double"); col_truoc2.ColumnName = "Diện tích (m2)"; table_Truoc.Columns.Add(col_truoc2); gridControl1.DataSource = table_Truoc; RepositoryItemLookUpEdit riLookup1 = new RepositoryItemLookUpEdit(); riLookup1.DataSource = table_LoaiDat; riLookup1.DisplayMember = "Loại đất"; riLookup1.ValueMember = "Mã"; gridView1.Columns[0].ColumnEdit = riLookup1; gridView1.Columns[0].Width = 200; //Gridcontrol Sau giao table_Sau = new DataTable(); DataColumn col_sau1 = new DataColumn(); col_sau1.DataType = System.Type.GetType("System.String"); col_sau1.ColumnName = "Loại đất"; table_Sau.Columns.Add(col_sau1); DataColumn col_sau2 = new DataColumn(); col_sau2.DataType = Type.GetType("System.Double"); col_sau2.ColumnName = "Diện tích (m2)"; table_Sau.Columns.Add(col_sau2); gridControl2.DataSource = table_Sau; RepositoryItemLookUpEdit riLookup2 = new RepositoryItemLookUpEdit(); riLookup2.DataSource = table_LoaiDat; riLookup2.DisplayMember = "Loại đất"; riLookup2.ValueMember = "Mã"; gridView2.Columns[0].ColumnEdit = riLookup2; gridView2.Columns[0].Width = 200; }
private void F_Main_TinhTrangPL_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSDuAn_DaCap table_DSDuAn_DaCap = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn_DaCap.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn_DaCap.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Địa điểm"; table_DSDuAn_DaCap.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Huyện"; table_DSDuAn_DaCap.Columns.Add(c3); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.Double"); c4.ColumnName = "Diện tích trước giao (m2)"; table_DSDuAn_DaCap.Columns.Add(c4); c5 = new DataColumn(); c5.DataType = System.Type.GetType("System.Double"); c5.ColumnName = "Diện tích sau giao (m2)"; table_DSDuAn_DaCap.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Số quyết định"; table_DSDuAn_DaCap.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Ngày quyết định"; table_DSDuAn_DaCap.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Ngày giao"; table_DSDuAn_DaCap.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Thời hạn"; table_DSDuAn_DaCap.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn_DaCap.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn_DaCap.Columns.Add(c11); gridControl1.Width = int.MaxValue; gridControl1.DataSource = table_DSDuAn_DaCap; gridView1.OptionsBehavior.Editable = false; gridView1.OptionsView.ColumnAutoWidth = false; gridView1.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView1.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView1.Columns[0].Width = 25; gridView1.Columns[1].Width = 300; gridView1.Columns[2].Width = 250; gridView1.Columns[3].Width = 110; gridView1.Columns[4].Width = 130; gridView1.Columns[5].Width = 120; gridView1.Columns[6].Width = 90; gridView1.Columns[7].Width = 90; gridView1.Columns[8].Width = 70; gridView1.Columns[9].Width = 70; gridView1.Columns[10].Width = 300; gridView1.Columns[11].Width = 150; // Chèn dữ liệu đã cấp string daCap = "SELECT COUNT(TinhtrangPL) as SoDuAn FROM Giaodat WHERE TinhtrangPL = N'Đã cấp giấy chứng nhận'"; groupControl1.Text = "Danh sách dự án | Tổng số dự án đã cấp giấy chứng nhận : " + sql.GetData(daCap, 0); DataColumn[] Array_col2 = { c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11 }; string s1 = "SELECT ROW_NUMBER() OVER(ORDER BY Giaodat.TenDuan asc) AS Row#, Giaodat.TenDuan, Giaodat.Diadiem, DMDvhc.TenDvhc, a.TongDTTruoc, b.TongDTDuoc, Giaodat.SoQD, convert(NVARCHAR, Giaodat.NgayQD, 103) as NgayQD, convert(NVARCHAR, Giaodat.Ngaygiao, 103) as NgayGiao, convert(NVARCHAR, Giaodat.Thoihan, 103) as ThoiHan, DMHinhthucsudung.TenHinhthuc, Giaodat.TinhtrangPL FROM Giaodat, DMDvhc, DMHinhthucsudung,( SELECT LDTruocGiao.IDGD, SUM(Dientich) as TongDTTruoc FROM LDTruocGiao, Giaodat WHERE Giaodat.IDGD = LDTruocGiao.IDGD GROUP BY LDTruocGiao.IDGD ) a, (SELECT LDDuocGiao.IDGD, SUM(Dientich) as TongDTDuoc FROM LDDuocGiao, Giaodat WHERE Giaodat.IDGD = LDDuocGiao.IDGD GROUP BY LDDuocGiao.IDGD) b WHERE Giaodat.TinhtrangPL = N'Đã cấp giấy chứng nhận' and Giaodat.MaDvhc = DMDvhc.MaDvhc and Giaodat.MaHinhthuc = DMHinhthucsudung.MaHinhthuc and Giaodat.IDGD = a.IDGD and Giaodat.IDGD = b.IDGD GROUP BY Giaodat.TenDuan, Giaodat.Diadiem, a.TongDTTruoc, b.TongDTDuoc, DMDvhc.TenDvhc, Giaodat.SoQD, Giaodat.NgayQD, Giaodat.Ngaygiao, Giaodat.Thoihan, DMHinhthucsudung.TenHinhthuc, Giaodat.TinhtrangPL"; table_DSDuAn_DaCap.Clear(); sql.ViewDataTable(s1, table_DSDuAn_DaCap, Array_col2); //GridControl DSDuAn_ChuaCap table_DSDuAn_ChuaCap = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn_ChuaCap.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn_ChuaCap.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Địa điểm"; table_DSDuAn_ChuaCap.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Huyện"; table_DSDuAn_ChuaCap.Columns.Add(c3); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.Double"); c4.ColumnName = "Diện tích trước giao (m2)"; table_DSDuAn_ChuaCap.Columns.Add(c4); c5 = new DataColumn(); c5.DataType = System.Type.GetType("System.Double"); c5.ColumnName = "Diện tích sau giao (m2)"; table_DSDuAn_ChuaCap.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Số quyết định"; table_DSDuAn_ChuaCap.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Ngày quyết định"; table_DSDuAn_ChuaCap.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Ngày giao"; table_DSDuAn_ChuaCap.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Thời hạn"; table_DSDuAn_ChuaCap.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn_ChuaCap.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn_ChuaCap.Columns.Add(c11); gridControl2.Width = int.MaxValue; gridControl2.DataSource = table_DSDuAn_ChuaCap; gridView2.OptionsBehavior.Editable = false; gridView2.OptionsView.ColumnAutoWidth = false; gridView2.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView2.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView2.Columns[0].Width = 25; gridView2.Columns[1].Width = 300; gridView2.Columns[2].Width = 250; gridView2.Columns[3].Width = 110; gridView2.Columns[4].Width = 130; gridView2.Columns[5].Width = 120; gridView2.Columns[6].Width = 90; gridView2.Columns[7].Width = 90; gridView2.Columns[8].Width = 70; gridView2.Columns[9].Width = 70; gridView2.Columns[10].Width = 300; gridView2.Columns[11].Width = 150; // Chèn dữ liệu chưa cấp string chuaCap = "SELECT COUNT(TinhtrangPL) as SoDuAn FROM Giaodat WHERE TinhtrangPL = N'Chưa cấp giấy chứng nhận'"; groupControl2.Text = "Danh sách dự án | Tổng số dự án chưa cấp giấy chứng nhận : " + sql.GetData(chuaCap, 0); DataColumn[] Array_col3 = { c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11 }; string s2 = "SELECT ROW_NUMBER() OVER(ORDER BY Giaodat.TenDuan asc) AS Row#, Giaodat.TenDuan, Giaodat.Diadiem, DMDvhc.TenDvhc, a.TongDTTruoc, b.TongDTDuoc, Giaodat.SoQD, convert(NVARCHAR, Giaodat.NgayQD, 103) as NgayQD, convert(NVARCHAR, Giaodat.Ngaygiao, 103) as NgayGiao, convert(NVARCHAR, Giaodat.Thoihan, 103) as ThoiHan, DMHinhthucsudung.TenHinhthuc, Giaodat.TinhtrangPL FROM Giaodat, DMDvhc, DMHinhthucsudung,( SELECT LDTruocGiao.IDGD, SUM(Dientich) as TongDTTruoc FROM LDTruocGiao, Giaodat WHERE Giaodat.IDGD = LDTruocGiao.IDGD GROUP BY LDTruocGiao.IDGD ) a, (SELECT LDDuocGiao.IDGD, SUM(Dientich) as TongDTDuoc FROM LDDuocGiao, Giaodat WHERE Giaodat.IDGD = LDDuocGiao.IDGD GROUP BY LDDuocGiao.IDGD) b WHERE Giaodat.TinhtrangPL = N'Chưa cấp giấy chứng nhận' and Giaodat.MaDvhc = DMDvhc.MaDvhc and Giaodat.MaHinhthuc = DMHinhthucsudung.MaHinhthuc and Giaodat.IDGD = a.IDGD and Giaodat.IDGD = b.IDGD GROUP BY Giaodat.TenDuan, Giaodat.Diadiem, a.TongDTTruoc, b.TongDTDuoc, DMDvhc.TenDvhc, Giaodat.SoQD, Giaodat.NgayQD, Giaodat.Ngaygiao, Giaodat.Thoihan, DMHinhthucsudung.TenHinhthuc, Giaodat.TinhtrangPL"; table_DSDuAn_ChuaCap.Clear(); sql.ViewDataTable(s2, table_DSDuAn_ChuaCap, Array_col3); Cursor = Cursors.Default; }
private void F_Main_TenToChuc_Load(object sender, EventArgs e) { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; //GridControl DSTenToChuc table_DSTenToChuc = new DataTable(); col0 = new DataColumn(); col0.DataType = System.Type.GetType("System.Int32"); col0.ColumnName = "STT"; table_DSTenToChuc.Columns.Add(col0); col1 = new DataColumn(); col1.DataType = System.Type.GetType("System.String"); col1.ColumnName = "Mã TC"; table_DSTenToChuc.Columns.Add(col1); col2 = new DataColumn(); col2.DataType = System.Type.GetType("System.String"); col2.ColumnName = "Tên tổ chức"; table_DSTenToChuc.Columns.Add(col2); col3 = new DataColumn(); col3.DataType = System.Type.GetType("System.Int32"); col3.ColumnName = "Số dự án"; table_DSTenToChuc.Columns.Add(col3); gridControl1.DataSource = table_DSTenToChuc; gridView1.OptionsBehavior.Editable = false; gridView1.Columns[0].Width = 5; gridView1.Columns[1].Width = 20; gridView1.Columns[2].Width = 70; gridView1.Columns[3].Width = 20; DataColumn[] Array_col1 = { col0, col1, col2, col3 }; string s = "SELECT ROW_NUMBER() OVER(ORDER BY t1.TenTochuc asc) AS Row#,t1.MaTochuc,t1.TenTochuc,ISNULL(t2.soduan, 0 ) as SoDuAn FROM (Select MaTochuc,TenTochuc from TenTochuc) t1 LEFT JOIN (Select MaTochuc, COUNT(MaTochuc) as soduan from Giaodat group by MaTochuc) t2 ON t1.MaTochuc = t2.MaTochuc WHERE t2.soduan IS NULL OR t2.soduan >= 0"; sql.ViewDataTable(s, table_DSTenToChuc, Array_col1); //GridControl DSDuAn table_DSDuAn = new DataTable(); c0 = new DataColumn(); c0.DataType = System.Type.GetType("System.Int32"); c0.ColumnName = "STT"; table_DSDuAn.Columns.Add(c0); c1 = new DataColumn(); c1.DataType = System.Type.GetType("System.String"); c1.ColumnName = "Tên dự án"; table_DSDuAn.Columns.Add(c1); c2 = new DataColumn(); c2.DataType = System.Type.GetType("System.String"); c2.ColumnName = "Địa điểm"; table_DSDuAn.Columns.Add(c2); c3 = new DataColumn(); c3.DataType = System.Type.GetType("System.String"); c3.ColumnName = "Huyện"; table_DSDuAn.Columns.Add(c3); c4 = new DataColumn(); c4.DataType = System.Type.GetType("System.Double"); c4.ColumnName = "Diện tích trước giao (m2)"; table_DSDuAn.Columns.Add(c4); c5 = new DataColumn(); c5.DataType = System.Type.GetType("System.Double"); c5.ColumnName = "Diện tích sau giao (m2)"; table_DSDuAn.Columns.Add(c5); c6 = new DataColumn(); c6.DataType = System.Type.GetType("System.String"); c6.ColumnName = "Số quyết định"; table_DSDuAn.Columns.Add(c6); c7 = new DataColumn(); c7.DataType = System.Type.GetType("System.String"); c7.ColumnName = "Ngày quyết định"; table_DSDuAn.Columns.Add(c7); c8 = new DataColumn(); c8.DataType = System.Type.GetType("System.String"); c8.ColumnName = "Ngày giao"; table_DSDuAn.Columns.Add(c8); c9 = new DataColumn(); c9.DataType = System.Type.GetType("System.String"); c9.ColumnName = "Thời hạn"; table_DSDuAn.Columns.Add(c9); c10 = new DataColumn(); c10.DataType = System.Type.GetType("System.String"); c10.ColumnName = "Hình thức sử dụng"; table_DSDuAn.Columns.Add(c10); c11 = new DataColumn(); c11.DataType = System.Type.GetType("System.String"); c11.ColumnName = "Tình trạng pháp lý"; table_DSDuAn.Columns.Add(c11); gridControl2.Width = int.MaxValue; gridControl2.DataSource = table_DSDuAn; gridView2.OptionsBehavior.Editable = false; gridView2.OptionsView.ColumnAutoWidth = false; gridView2.ScrollStyle = DevExpress.XtraGrid.Views.Grid.ScrollStyleFlags.LiveHorzScroll; gridView2.HorzScrollVisibility = DevExpress.XtraGrid.Views.Base.ScrollVisibility.Always; gridView2.Columns[0].Width = 25; gridView2.Columns[1].Width = 300; gridView2.Columns[2].Width = 250; gridView2.Columns[3].Width = 110; gridView2.Columns[4].Width = 130; gridView2.Columns[5].Width = 120; gridView2.Columns[6].Width = 90; gridView2.Columns[7].Width = 90; gridView2.Columns[8].Width = 70; gridView2.Columns[9].Width = 70; gridView2.Columns[10].Width = 300; gridView2.Columns[11].Width = 150; Cursor = Cursors.Default; }
public F_Main_ThemToChuc() { InitializeComponent(); sql = F_DangNhap.SQL_con_object as SQLConnect; nguoi = F_DangNhap.person_object as NguoiDung; }