using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PnCost.Models; using Core.StlMes.Client.PnCost.NewCost.弹窗; 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.PnCost { public partial class FrmTqnqD03 : FrmBase { public FrmTqnqD03() { InitializeComponent(); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "doQuery": Query(); break; case "doSave": doSave(); break; //case "doAdd": // doAdd(); // break; //case "doBbsc": // doAdd(); // break; //case "doSeeBb": // doAdd(); // break; //case "doDelete": // this.doDelete(); // break; //case "Close": // this.doDelete(); // break; } } private void doSave() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" XUANZE = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要修改的数据!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { Tqnqd03Entity entity = (Tqnqd03Entity)uRow.ListObject; entity.RecRevisor = UserInfo.GetUserName(); string tqnqd03Entity = JSONFormat.Format(entity); parm.Add(tqnqd03Entity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.cost.FrmTqnqd03"; ccp.MethodName = "doSave"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("操作成功")) { // DoQueryInList(); Query(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } protected override void OnLoad(EventArgs e) { base.OnLoad(e); ultraGrid1.ClickCellButton += new CellEventHandler(ugData_ClickCellButton); Query(); //doQueryBaseinfo(); } protected virtual void ugData_ClickCellButton(object sender, CellEventArgs e) { UltraGridCell cell = ultraGrid1.ActiveCell; UltraGridRow row = e.Cell.Row; string strKey = this.ultraGrid1.ActiveCell.Column.ToString(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" XUANZE = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择数据!"); return; } if (strKey.Equals("SubBacklog")) { Frmjz frm = new Frmjz(this.ob); frm.bh = row.Cells["ProcessCode"].Value.ToString(); frm.gx = row.Cells["WholeBacklog"].Value.ToString(); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { row.Cells["SubBacklog"].Value = frm.SubBackLog; row.Cells["UnitPrice"].Value = frm.UnitPrice; row.Cells["Chencailv"].Value = frm.Chencailv; } } } private void Query() { string gx = gxtexe.Text; string gztype = gzTypeText.Text; string ph = phtext.Text; string bz = bztext.Text; List listSource = EntityHelper.GetData( "com.steering.mes.cost.FrmTqnqd03.Query", new object[] {gx,gztype,ph,bz}, this.ob); tqnqd03EntityBindingSource.DataSource = listSource; GridHelper.RefreshAndAutoSize(ultraGrid1); } } }