using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using System.Net; using System.Collections; using CoreFS.SA06; namespace Core.StlMes.Client.BuyBillet { public partial class FrmBuySupplier : FrmBase { private new CoreFS.CA06.OpeBase ob = new OpeBase(); private DataTable dt; public FrmBuySupplier(OpeBase ops) { this.ob = ops; InitializeComponent(); } private void ultraGrid1_bind() { dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.queryBUY_BASE_CUSTOMERALL", new object[] { }, this.ob); this.ultraGrid1.DataSource = dt; } private void FrmBuySupplier_Load(object sender, EventArgs e) { ultraGrid1_bind(); } private void ts_btn_AddNew_Click(object sender, EventArgs e) { DataRow row = dt.NewRow(); dt.Rows.Add(row); } private void ts_btn_Save_Click(object sender, EventArgs e) { this.ultraGrid1.UpdateData(); SaveToDB(); MessageBox.Show("操作成功!"); } private void SaveToDB() { int result = (from rows in dt.AsEnumerable() where rows.RowState == DataRowState.Modified select rows).Count(); if (result >0) { var resultrows = from rows in dt.AsEnumerable() where rows.RowState == DataRowState.Modified select rows; foreach (var row in resultrows) { string CUSTOMER_NO = row["CUSTOMER_NO"].ToString(); string CUSTOMER_NM = row["CUSTOMER_NM"].ToString(); string REGION_NO = row["REGION_NO"].ToString(); string WET_D = row["WET_D"].ToString(); string WET_DG = row["WET_DG"].ToString(); string WET_DGF = row["WET_DGF"].ToString(); ServerHelper.SetData("com.steering.pss.buybillet.Buybillet.updateBUY_BASE_CUSTOMER", new object[] { CUSTOMER_NO, CUSTOMER_NM, REGION_NO, WET_D, WET_DG, WET_DGF }, this.ob); } } } } }