CNAS取数仪器端升级
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 line
2.1KB

  1. using CnasSynchronusClient;
  2. using CnasSynchrousModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace CNAS_DBSync
  12. {
  13. public partial class frmSelectInstruItem : Form
  14. {
  15. private SyncInstrumentItemInfo syncInstrument;
  16. public string strSelectedColumn = "";
  17. public frmSelectInstruItem(SyncInstrumentItemInfo syncInstrument)
  18. {
  19. InitializeComponent();
  20. this.syncInstrument = syncInstrument;
  21. }
  22. private void btnCancel_Click(object sender, EventArgs e)
  23. {
  24. this.Close();
  25. }
  26. private void btnOK_Click(object sender, EventArgs e)
  27. {
  28. strSelectedColumn = dgvInstruDS.Rows[dgvInstruDS.CurrentCell.RowIndex].Cells["InstruFieldName"].Value.ToString();
  29. this.DialogResult = DialogResult.OK;
  30. this.Close();
  31. }
  32. private void frmSelectInstruItem_Load(object sender, EventArgs e)
  33. {
  34. InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrument.SyncInstrumentDSInfo, new object[] { "", "", "" });
  35. Dictionary<string,DataTable> dictInstruTables = instrumentData.GetInstrumentData();
  36. string strTableName_Instru = syncInstrument.LstSyncPramas[0].SourceTable;
  37. if (dictInstruTables.ContainsKey(strTableName_Instru))
  38. {
  39. DataTable dt = dictInstruTables[strTableName_Instru];
  40. if (dt != null)
  41. {
  42. DataTable dtInstruShow = new DataTable();
  43. dtInstruShow.Columns.Add("InstruFieldName");
  44. dtInstruShow.Columns.Add("InstruDataType");
  45. foreach (DataColumn dc in dt.Columns)
  46. {
  47. dtInstruShow.Rows.Add(new object[] { dc.ColumnName, dc.DataType });
  48. }
  49. dgvInstruDS.DataSource = dtInstruShow;
  50. }
  51. }
  52. }
  53. }
  54. }