using System; using System.Collections.Generic; using System.Linq; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.LgClassModel; using Infragistics.Win.UltraWinGrid; namespace Core.StlMes.Client.LgCommon.公共自定义控件.实绩管理 { public partial class ucNewResCcmCast : ucNewResBase { private string _castNo; private StlCcmMouldinfoEntity _data; public ucNewResCcmCast() { InitializeComponent(); ClsControlPack.SetUltraGridStyle(ugData, 1); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); EntityHelper.ShowGridCaption(ugData.DisplayLayout.Bands[0]); SetData(new List {new StlCcmMouldinfoEntity()}); foreach (var ugc in ugData.DisplayLayout.Bands[0].Columns) ugc.CellActivation = Activation.AllowEdit; } protected override void Refresh() { QueryDate(_castNo); } public void QueryDate(string castNo) { _castNo = castNo; _data = GetStlCcmMouldinfoEntity(_castNo); SetData(new List { _data }); } public StlCcmMouldinfoEntity GetStlCcmMouldinfoEntity(string castNo) { try { var list = EntityHelper.GetData( "Core.LgMes.Server.LgDeviceManager.PerformanceManage.SelectStlCcmMouldinfoEntity", new object[] {castNo}, Ob); if ((list == null) || (list.Count <= 0)) return new StlCcmMouldinfoEntity {Mouldno = castNo}; return list.FirstOrDefault(); } catch (Exception) { return new StlCcmMouldinfoEntity {Mouldno = castNo}; } } public bool SaveStlCcmMouldinfoEntity() { try { if (!HasChanged || _data == null ) return true; ServerHelper.SetData("Core.LgMes.Server.LgDeviceManager.PerformanceManage.SaveStlCcmMouldinfoEntity", new object[] { _data, _castNo }, Ob); Refresh(); return true; } catch (Exception) { return false; } } } }