using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; namespace Gs.DevApp.UserControl { public partial class SelectOrg : DevExpress.XtraEditors.XtraForm { private List _filterList = new List(); public SelectOrg() { InitializeComponent(); getPageList(1); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false); } /// /// 查询事件 /// /// /// private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { Gs.DevApp.ToolBox.MsgHelper.ShowInformation("该窗体不支持查询,若想更新页面,请点击 刷新"); } /// /// 刷新事件 /// /// /// private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { _filterList.Clear(); getPageList(1); } /// /// /// 第几页 /// 每页几条 private void getPageList(int curPage) { gcMain.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); var pgq = new PageQueryModel(curPage, 999999, "FID", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { var strReturn = UtilityHelper.HttpPost("", "Organization/GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); if (dt.Rows.Count > 0) { gcMain.DataSource = dt; gcMain.ForceInitialize(); gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else UtilityHelper.SetDefaultTable(gcMain, gridView1); } else { ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg); } } catch (Exception ex) { MsgHelper.Warning("提示:" + ex.Message); } } private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var rowhandle = gridView1.FocusedRowHandle; if (rowhandle < 0) return; if (e.Button.Index == 0) { var dr = gridView1.GetDataRow(rowhandle); var mxGuid = dr["fid"].ToString(); if (string.IsNullOrEmpty(mxGuid)) { return; } var mxName = dr["name"].ToString(); var list = new List(); list.Add(new { guid = mxGuid, name = mxName, }); UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list }); Close(); } } /// /// 选择后的回调事件 /// public event EventHandler UpdateParent; } }