using DevExpress.XtraEditors; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.DevApp.DevFrm.BasicData { public partial class Frm_SupplierSrm : DevExpress.XtraEditors.XtraForm { public Frm_SupplierSrm() { InitializeComponent(); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", (value) => { }, null, false); getPageList(1, 999999); } /// /// /// 第几页 /// 每页几条 private void getPageList(int curPage, int pageSize) { var _sbSqlWhere = new StringBuilder(); _sbSqlWhere.Append(" and 1=1"); var pgq = new PageQueryModel(curPage, 999999, "b.create_date", "desc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { var strReturn = UtilityHelper.HttpPost("", "MesSupplierManager/GetSrmListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); gcMain.DataSource = dt; gcMain.ForceInitialize(); gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else { ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg); } } catch (Exception ex) { MsgHelper.ShowError("提示:" + 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["id"].ToString(); if (!MsgHelper.AskQuestion("你选择了1条数据,确定移出吗?")) return; var _obj = new { suppId = mxGuid, joinType = -1, }; try { var strJson = UtilityHelper.HttpPost("", "MesSupplierManager/" + "SrmJoin", JsonConvert.SerializeObject(_obj)); var _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode > 0) { MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg); getPageList(1, 999999); } else MsgHelper.ShowError("提示:" + _rtn.rtnMsg); } catch (Exception ex) { MsgHelper.ShowError("提示:" + ex.Message); } } } } }