using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Core.StlMes.Client.SaleOrder.ReviewForm { public partial class frmCraftSplineUnit : FrmBase { UltraGrid grid1 = null; public frmCraftSplineUnit() { InitializeComponent(); //UltraGrid grid = (UltraGrid)c_UltraGrid1; ////this.Controls.Remove(c_UltraGrid1); //grid1 = new UltraGrid(); //this.Controls.Add(grid1); ////this.panel1.Controls.Add(grid); } public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "Query": Query(); break; case "Save": Save(); break; case "Close": this.Close(); break; } } private void Query() { DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CraftSplineUnit.query", null, ob); GridHelper.CopyDataToDatatable(dt, dataTable1, true); } private void Save() { ArrayList list = new ArrayList(); var rows = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True"); if (rows.Count() == 0) { MessageUtil.ShowWarning("请选择一条记录保存!"); return; } foreach(var row in rows) { list.Add(row.GetValue("UNIT_CODE")); } if (MessageUtil.ShowYesNoAndQuestion("是否确认保存") == System.Windows.Forms.DialogResult.No) { return; } ServerHelper.SetData("com.steering.pss.sale.order.CraftSplineUnit.save", new object[]{list}, ob); MessageUtil.ShowTips("保存成功!"); } private void frmCraftSplineUnit_Load(object sender, EventArgs e) { //c_UltraGrid1.DisplayLayout.CopyFrom(ultraGrid1.DisplayLayout, PropertyCategories.All); try { this.Cursor = Cursors.WaitCursor; Query(); } finally { this.Cursor = Cursors.Default; } } private void frmCraftSplineUnit_Shown(object sender, EventArgs e) { } private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { ultraGrid1.UpdateData(); if (e.Cell.Column.Key == "CHK") { UltraGridRow chkRow = e.Cell.Row; foreach (UltraGridRow row in ultraGrid1.Rows) { if (row.Cells["CHK"].Value.ToString() == "True" && row != chkRow) { row.Cells["CHK"].Value = "False"; row.Update(); } } } } } }