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.

65 line
2.1KB

  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 frmStartEndSubstring : Form
  13. {
  14. public CnasConditionMapValue conditionvalue { get; set; }
  15. public frmStartEndSubstring(CnasConditionMapValue conditionvalue)
  16. {
  17. InitializeComponent();
  18. this.conditionvalue = conditionvalue;
  19. }
  20. private void frmStartEndSubstring_Load(object sender, EventArgs e)
  21. {
  22. if (this.conditionvalue == null) return;
  23. if (this.conditionvalue.Value == null) return;
  24. if (this.conditionvalue.Condition != MapCondition.SubstringStartEnd) return;
  25. //根据旧值显示控件默认值
  26. if (this.conditionvalue.Value.ToString() != "")
  27. {
  28. string[] strConditionValues = this.conditionvalue.Value.ToString().Split(new string[] { "{", ",", "}" }, StringSplitOptions.RemoveEmptyEntries);
  29. if (strConditionValues.Length == 2)
  30. {
  31. this.txtPrama1.Text = strConditionValues[0];
  32. this.cbxPrama2.Text = strConditionValues[1];
  33. }
  34. }
  35. }
  36. private void btnOK_Click(object sender, EventArgs e)
  37. {
  38. if (this.txtPrama1.Text == "")
  39. {
  40. MessageBox.Show("参数1不能为空。");
  41. return;
  42. }
  43. if (this.cbxPrama2.Text == "")
  44. {
  45. MessageBox.Show("参数2不能为空。");
  46. return;
  47. }
  48. if (this.cbxPrama2.Text != "S" && this.cbxPrama2.Text != "E")
  49. {
  50. MessageBox.Show("参数2不符合规则,请重新选择。");
  51. return;
  52. }
  53. this.conditionvalue.Value = "{" + this.txtPrama1.Text + "," + this.cbxPrama2.Text + "}";
  54. this.DialogResult = DialogResult.OK;
  55. this.Close();
  56. }
  57. }
  58. }