using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Qcm.BLL; using Core.StlMes.Client.Qcm.model; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections.Generic; using System.Data; using System.Linq; namespace Core.StlMes.Client.Qcm { public partial class ComBasePhyRSizeFrm : FrmBase { private ComBasePhyRSizeBLL _PhyRSizeBLL; public ComBasePhyRSizeFrm() { InitializeComponent(); } private void ComBasePhyRSizeFrm_Load(object sender, EventArgs e) { _PhyRSizeBLL = new ComBasePhyRSizeBLL(ob); } 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() { this.comBasePhyEntityBindingSource.DataSource = _PhyRSizeBLL.QueryPhy(); } private void Save() { ultraGrid2.UpdateData(); if (ultraGrid1.ActiveRow == null) { MessageUtil.ShowWarning("请选择检验项!"); return; } ComBasePhyEntity phyEntity = (ComBasePhyEntity)ultraGrid1.ActiveRow.ListObject; IQueryable rows = ultraGrid2.Rows.AsQueryable().Where("Chk = 'True'"); if (rows.Count() == 0) { MessageUtil.ShowWarning("请至少勾选一条尺寸记录!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认保存?") == System.Windows.Forms.DialogResult.No) { return; } List parms = rows.Select( a => (ComBasePhyRSizeEntity)a.ListObject).ToList(); foreach (ComBasePhyRSizeEntity phyRSizeEntity in parms) { phyRSizeEntity.PhyCode = phyEntity.PhyCode; phyRSizeEntity.PhyName = phyEntity.PhyName; phyRSizeEntity.CreateName = UserInfo.GetUserName(); } _PhyRSizeBLL.Save(parms); MessageUtil.ShowTips("保存成功!"); Query(); } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { ComBasePhyEntity phyEntity = (ComBasePhyEntity)ultraGrid1.ActiveRow.ListObject; this.comBasePhyRSizeEntityBindingSource.DataSource = _PhyRSizeBLL.QueryPhySize(phyEntity.PhyCode); } private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { EntityHelper.ShowGridCaption(e.Layout.Bands[0]); } private void ultraGrid2_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { EntityHelper.ShowGridCaption(e.Layout.Bands[0]); } } }