FrmBuySupplier.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System.Net;
  14. using System.Collections;
  15. using CoreFS.SA06;
  16. namespace Core.StlMes.Client.BuyBillet
  17. {
  18. public partial class FrmBuySupplier : FrmBase
  19. {
  20. private new CoreFS.CA06.OpeBase ob = new OpeBase();
  21. private DataTable dt;
  22. public FrmBuySupplier(OpeBase ops)
  23. {
  24. this.ob = ops;
  25. InitializeComponent();
  26. }
  27. private void ultraGrid1_bind()
  28. {
  29. dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.queryBUY_BASE_CUSTOMERALL", new object[] { }, this.ob);
  30. this.ultraGrid1.DataSource = dt;
  31. }
  32. private void FrmBuySupplier_Load(object sender, EventArgs e)
  33. {
  34. ultraGrid1_bind();
  35. }
  36. private void ts_btn_AddNew_Click(object sender, EventArgs e)
  37. {
  38. DataRow row = dt.NewRow();
  39. dt.Rows.Add(row);
  40. }
  41. private void ts_btn_Save_Click(object sender, EventArgs e)
  42. {
  43. this.ultraGrid1.UpdateData();
  44. SaveToDB();
  45. MessageBox.Show("操作成功!");
  46. }
  47. private void SaveToDB()
  48. {
  49. int result = (from rows in dt.AsEnumerable()
  50. where rows.RowState == DataRowState.Modified
  51. select rows).Count();
  52. if (result >0)
  53. {
  54. var resultrows = from rows in dt.AsEnumerable()
  55. where rows.RowState == DataRowState.Modified
  56. select rows;
  57. foreach (var row in resultrows)
  58. {
  59. string CUSTOMER_NO = row["CUSTOMER_NO"].ToString();
  60. string CUSTOMER_NM = row["CUSTOMER_NM"].ToString();
  61. string REGION_NO = row["REGION_NO"].ToString();
  62. string WET_D = row["WET_D"].ToString();
  63. string WET_DG = row["WET_DG"].ToString();
  64. string WET_DGF = row["WET_DGF"].ToString();
  65. 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);
  66. }
  67. }
  68. }
  69. }
  70. }