| | |
| | | { |
| | | public partial class AddDivisonDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | private Yw.Vmo.DivisionVmo _model = null; |
| | | |
| | | public AddDivisonDlg() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | /// </summary> |
| | | public event Func<string, bool> VerifyTagNameExistEvent; |
| | | |
| | | private Yw.Vmo.DivisionVmo _model = null; |
| | | |
| | | /// <summary> |
| | | /// 绑定 |
| | | /// </summary> |
| | | public async void SetBindingData() |
| | | public async void SetBindingData(long id) |
| | | { |
| | | var list = new List<DivisionViewModel>(); |
| | | _model = new Yw.Vmo.DivisionVmo(); |
| | |
| | | list.Add(new DivisionViewModel(item)); |
| | | } |
| | | } |
| | | |
| | | treeListLookUpEdit1TreeList.DataSource = list; |
| | | if (id > 0) |
| | | { |
| | | this.textEditParents.EditValue = id; |
| | | // this.treeListLookUpEdit1TreeList.EditingValue = id; |
| | | } |
| | | } |
| | | |
| | | //确定 |
| | | private async void btnOk_Click(object sender, EventArgs e) |
| | | { |
| | | if (_model == null) |
| | | return; |
| | | if (!Valid()) |
| | | return; |
| | | _model.Name = this.NameTextEdit.Text.Trim(); |
| | | _model.Type = (Yw.Model.eDivisionType)this.TypeImageComboBoxEdit.EditValue; |
| | | _model.ADCode = this.ADCodeTextEdit.Text.Trim(); |
| | | _model.Description = this.DescriptionTextEdit.Text.Trim(); |
| | | _model.TagName = this.TagNameTextEdit.Text.Trim(); |
| | | if (this.ReloadDataEvent == null) |
| | | return; |
| | | if (!await this.ReloadDataEvent(_model, this.textEditParents.EditValue)) |
| | | { |
| | | MessageBoxHelper.ShowError("添加失败!"); |
| | | return; |
| | | } |
| | | MessageBoxHelper.ShowSuccess("添加成功!"); |
| | | this.DialogResult = System.Windows.Forms.DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | //验证 |
| | |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | //确定 |
| | | private async void btnOk_Click(object sender, EventArgs e) |
| | | { |
| | | if (_model == null) |
| | | return; |
| | | if (!Valid()) |
| | | return; |
| | | _model.Name = this.NameTextEdit.Text.Trim(); |
| | | _model.Type = (Yw.Model.eDivisionType)this.TypeImageComboBoxEdit.EditValue; |
| | | _model.ADCode = this.ADCodeTextEdit.Text.Trim(); |
| | | _model.Description = this.DescriptionTextEdit.Text.Trim(); |
| | | _model.TagName = this.TagNameTextEdit.Text.Trim(); |
| | | if (this.ReloadDataEvent == null) |
| | | return; |
| | | if (!await this.ReloadDataEvent(_model, this.textEditParents.EditValue)) |
| | | { |
| | | MessageBoxHelper.ShowError("添加失败!"); |
| | | return; |
| | | } |
| | | MessageBoxHelper.ShowSuccess("添加成功!"); |
| | | this.DialogResult = System.Windows.Forms.DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | } |
| | | } |