using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.Sys { public partial class SysHelp : DevExpress.XtraEditors.XtraForm { string _webServiceName = "MenuAction/"; List _filterList = new List(); public SysHelp() { InitializeComponent(); this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; getPageList(1, UtilityHelper.GetPageSize()); gridView1.CustomDrawRowIndicator += (s, e) => { if (e.Info.IsRowIndicator && e.RowHandle >= 0) { e.Info.DisplayText = (e.RowHandle + 1).ToString(); } }; gridView1.CustomDrawEmptyForeground += (s, e) => { string str = "暂未查找到匹配的数据!"; Font f = new Font("微软雅黑", 16); Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5); e.Graphics.DrawString(str, f, Brushes.Gray, r); }; } /// /// 查询事件 /// /// /// private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } /// /// 查询回调 /// /// /// private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; getPageList(1, UtilityHelper.GetPageSize()); } /// /// 刷新事件 /// /// /// private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { getPageList(1, UtilityHelper.GetPageSize()); } /// /// /// /// 第几页 /// 每页几条 private void getPageList(int curPage, int pageSize) { System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); _sbSqlWhere.Append(" and a.CATEGORY=1 and a.UP_GUID is not null"); PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "a.idx", "asc", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json); ReturnModel dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); gcMain.DataSource = dt; gcMain.ForceInitialize(); //gridColumnSex.GroupIndex = 0;//性别列为第一组 //gridColumndateofbirth.GroupIndex = 1;//出生日期列为第二组 gridView1.ExpandAllGroups();//展开所有组 } else { ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg); } } catch (Exception ex) { ToolBox.MsgHelper.Warning("提示:" + ex.Message); } } } }