using Gs.DevApp.ToolBox; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; namespace Gs.DevApp.UserControl { public partial class SelectCw : DevExpress.XtraEditors.XtraForm { string _strGuid = ""; private List _filterList = new List(); public SelectCw(string strGuid) { _strGuid = strGuid; 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) { var _obj = new { guid = _strGuid //主建 }; try { var strJson = UtilityHelper.HttpPost("", "MesDepotsManager/GetModel", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { var dy = _rtn.rtnData; var _job = JObject.Parse(strJson); var array = new JArray(); foreach (var a in _job["rtnData"]["list"]) array.Add(a); var dt = JsonConvert.DeserializeObject(array.ToString()); if (dt.Rows.Count > 0) { gcMain.DataSource = dt; gcMain.ForceInitialize(); gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else { UtilityHelper.SetDefaultTable(gcMain, gridView1); } } else { MsgHelper.Warning("提示:" + _rtn.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["guid"].ToString(); if (string.IsNullOrEmpty(mxGuid)) { return; } var mxName = dr["depotSectionName"].ToString(); var list = new List(); list.Add(new { guid = mxGuid, name = mxName, }); UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list }); Close(); } } /// /// 选择后的回调事件 /// public event EventHandler UpdateParent; } }