duheng
2024-11-27 d573ccd77f6df9be1798bd36f37c3cadeae5b9c9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
namespace HStation.WinFrmUI.WE
{
    public partial class AddUtensilDlg : DevExpress.XtraEditors.XtraForm
    {
        public AddUtensilDlg()
        {
            InitializeComponent();
            //      this.IconOptions.Icon = WinFrmUI.Properties.Resources.App;
            //      this.dataLayoutControl1.SetupLayoutControl();
        }
 
        /// <summary>
        /// 回调事件
        /// </summary>
        //  public event Func<Model.WaterEquivalent, bool> ReloadDataEvent;
 
        //    private BLL.WaterUtensil _BLLwaterUtensil = new BLL.WaterUtensil();
 
        /// <summary>
        /// 验证识别码是否存在事件
        /// </summary>
        public event Func<string, bool> VerifyTagNameExistEvent;
 
        //  private Model.WaterEquivalent _model = null;
 
        //  private List<Model.WaterUtensil> AllwaterUtensilList = null;
 
        /// <summary>
        /// 绑定
        /// </summary>
        public void SetBindingData()
        {
            /*   _model = new Model.WaterEquivalent();
               AllwaterUtensilList = _BLLwaterUtensil.GetAll();
               foreach (var item in AllwaterUtensilList)
               {
                   var imageItem = new ImageComboBoxItem(item.Name, item.ID);
                   NameComboBoxEdit.Properties.Items.Add(imageItem);
               }*/
        }
 
        //验证
        private bool Valid()
        {
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.NameComboBoxEdit.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.NameComboBoxEdit, "必填项");
                return false;
            }
            return true;
        }
 
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            /*  if (_model == null)
                  return;
              if (!Valid())
                  return;
              if (this.NameComboBoxEdit.EditValue != null)
              {
                  _model.WaterUtensilID = (long)NameComboBoxEdit.EditValue;
              }
              if (!string.IsNullOrEmpty(this.TextEditAmount.EditValue?.ToString()))
              {
                  _model.Count = Convert.ToInt32(this.TextEditAmount.EditValue);
              }
              if (!string.IsNullOrEmpty(textEditWaterEquivalent.EditValue?.ToString()))
              {
                  _model.RatedFlow = Convert.ToDouble(textEditWaterEquivalent.EditValue);
              }
              if (!string.IsNullOrEmpty(TextMinRatedFlo.EditValue?.ToString()))
              {
                  _model.MinRatedFlow = Convert.ToDouble(TextMinRatedFlo.EditValue);
              }
              _model.BelongType = "EquivalentTemplate";
              if (this.ReloadDataEvent == null)
                  return;
              if (!this.ReloadDataEvent(_model))
              {
                  MessageBoxHelper.ShowError("添加失败!");
                  return;
              }
              MessageBoxHelper.ShowSuccess("添加成功!");
              this.DialogResult = System.Windows.Forms.DialogResult.OK;
              this.Close();*/
        }
    }
}