| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraTabbedMdi; |
| | | |
| | | namespace Yw.WinFrmUI |
| | | namespace Yw.WinFrmUI |
| | | { |
| | | public partial class AddHydroSceneDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public AddHydroSceneDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | this.layoutControl1.SetupLayoutControl(); |
| | | this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent; |
| | | } |
| | | |
| | | private static HydroSceneVmo _last = null; |
| | | |
| | | /// <summary> |
| | | /// 重载数据事件 |
| | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public async Task SetBindingData() |
| | | public async void SetBindingData() |
| | | { |
| | | _vmo = new HydroSceneVmo(); |
| | | |
| | | var allFlagList = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(Yw.Hydro.DataType.HydroScene); |
| | | var allFlagNameList = allFlagList?.Select(x => x.Name).Distinct().ToList(); |
| | | this.setFlagsEditCtrl1.SetBindingData(allFlagNameList, null); |
| | | this.setFlagsEditCtrl1.SetBindingData(allFlagList?.Select(x => x.Name).Distinct().ToList(), null); |
| | | if (_last != null) |
| | | { |
| | | this.txtName.EditValue = _last.Name; |
| | | this.txtCode.EditValue = _last.Code; |
| | | this.setFlagsEditCtrl1.SetBindingData(allFlagList?.Select(x => x.Name).Distinct().ToList(), _last.Flags); |
| | | this.txtTagName.EditValue = _last.TagName; |
| | | this.txtDescription.EditValue = _last.Description; |
| | | } |
| | | } |
| | | |
| | | //验证 |
| | |
| | | } |
| | | |
| | | //确定 |
| | | private async void btnOk_Click(object sender, EventArgs e) |
| | | private async void GeneralOkAndCancelCtrl1_OkEvent() |
| | | { |
| | | if (!await Valid()) |
| | | { |
| | |
| | | var id = await BLLFactory<Yw.BLL.HydroScene>.Instance.Insert(_vmo); |
| | | if (id < 1) |
| | | { |
| | | XtraMessageBox.Show("添加失败!"); |
| | | TipFormHelper.ShowError("添加失败!"); |
| | | return; |
| | | } |
| | | var vmo = await BLLFactory<Yw.BLL.HydroScene>.Instance.GetByID(id); |
| | | _last = vmo; |
| | | this.ReloadDataEvent?.Invoke(vmo); |
| | | |
| | | TipFormHelper.ShowSucceed("添加成功"); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |