CNAS取数仪器端升级
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

90 lignes
2.9KB

  1. using CnasSynchrousModel;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace CNAS_DBSync
  11. {
  12. public partial class frmAddSubtract : Form
  13. {
  14. public SyncInstrumentItemInfo syncInstrument { get; set; }
  15. public CnasConditionMapValue conditionvalue { get; set; }
  16. public frmAddSubtract(SyncInstrumentItemInfo syncInstrument, CnasConditionMapValue conditionvalue)
  17. {
  18. InitializeComponent();
  19. this.syncInstrument = syncInstrument;
  20. this.conditionvalue = conditionvalue;
  21. }
  22. private void frmAddSubtract_Load(object sender, EventArgs e)
  23. {
  24. if (conditionvalue == null) return;
  25. string strValue = "";
  26. if (conditionvalue.Value != null)
  27. strValue = conditionvalue.Value.ToString();
  28. if (strValue != "")
  29. {
  30. string[] strValues = strValue.Split(new string[] { "{", "}" }, StringSplitOptions.RemoveEmptyEntries);
  31. if (strValues.Length == 3)
  32. {
  33. txtPrama1.Text = "{" + strValues[0] +"}";
  34. cbxParams2.Text = strValues[1] == "Add" ?"数值相加": "数值相减";
  35. txtPrama3.Text = "{" + strValues[2]+ "}";
  36. }
  37. else
  38. {
  39. conditionvalue.Condition = new MapCondition();
  40. conditionvalue.Value = "";
  41. }
  42. }
  43. }
  44. private void btnSelect1_Click(object sender, EventArgs e)
  45. {
  46. frmSelectInstruItem frm = new frmSelectInstruItem(syncInstrument);
  47. if (frm.ShowDialog() == DialogResult.OK)
  48. {
  49. if (frm.strSelectedColumn != "")
  50. txtPrama1.Text = "{[" + frm.strSelectedColumn + "]}";
  51. }
  52. }
  53. private void btnSelect3_Click(object sender, EventArgs e)
  54. {
  55. frmSelectInstruItem frm = new frmSelectInstruItem(syncInstrument);
  56. if (frm.ShowDialog() == DialogResult.OK)
  57. {
  58. if (frm.strSelectedColumn != "")
  59. txtPrama3.Text = "{[" + frm.strSelectedColumn + "]}";
  60. }
  61. }
  62. private void btnOK_Click(object sender, EventArgs e)
  63. {
  64. if (this.txtPrama1.Text.Trim() == "" && this.cbxParams2.Text.Trim() == "" && this.txtPrama3.Text.Trim() == "")
  65. return;
  66. conditionvalue.Value = this.txtPrama1.Text;
  67. if (this.cbxParams2.Text != "")
  68. conditionvalue.Value += this.cbxParams2.Text=="数值相加"?"{Add}":"{Subtract}";
  69. if (this.txtPrama3.Text != "")
  70. conditionvalue.Value += this.txtPrama3.Text;
  71. this.DialogResult = DialogResult.OK;
  72. this.Close();
  73. }
  74. }
  75. }