| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.DocumentServices.ServiceModel.DataContracts; |
| | | using DevExpress.XtraEditors; |
| | | using System; |
| | | using System.Windows.Forms; |
| | | using Yw.WinFrmUI; |
| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | public event Func<Yw.Vmo.ProjectMenu, Task<bool>> ReloadDataEvent; |
| | | public event Func<Yw.Vmo.AddProjectMenuExVmo, Task<bool>> ReloadDataEvent; |
| | | |
| | | private Yw.Vmo.ProjectMenu _model = null; |
| | | private Yw.Vmo.ProjectMenuVmo _model = null; |
| | | |
| | | /// <summary> |
| | | /// 添加 |
| | | /// </summary> |
| | | public async void SetBindingData(long parentId) |
| | | { |
| | | _model = new Yw.Vmo.ProjectMenu(); |
| | | var allList = await new Yw.BLL.ProjectMenu().GetByProjectID(GlobalParas._GlobalParas.ProjectID); |
| | | this.treeListLookUpEdit1TreeList.DataSource = allList; |
| | | this.imageComboBoxMenuType.Properties.AddEnum(typeof(eMenuType)); |
| | | this.imageComboBoxMenuType.SelectedIndex = 0; |
| | | this.ComboBoxEditParentsChoice.EditValue = parentId; |
| | | _model.ProjectID = GlobalParas._GlobalParas.ProjectID; |
| | | } |
| | | |
| | | //验证 |
| | |
| | | { |
| | | if (!Valid()) |
| | | return; |
| | | _model.Name = this.NameTextEdit.Text.Trim(); |
| | | _model.Description = this.DescriptionMemoEdit.Text.Trim(); |
| | | _model.ParentID = this.ComboBoxEditParentsChoice.EditValue == null ? 0 : Convert.ToInt64(this.ComboBoxEditParentsChoice.EditValue); |
| | | _model.Type = (int)(eMenuType)this.imageComboBoxMenuType.EditValue; |
| | | _model.Permission = this.TxtEditPermission.Text.Trim(); |
| | | if (await this.ReloadDataEvent.Invoke(_model)) |
| | | var AddProject = new Yw.Vmo.AddProjectMenuExVmo(); |
| | | AddProject.Name = this.NameTextEdit.Text.Trim(); |
| | | AddProject.Description = this.DescriptionMemoEdit.Text.Trim(); |
| | | AddProject.ParentID = this.ComboBoxEditParentsChoice.EditValue == null ? 0 : Convert.ToInt64(this.ComboBoxEditParentsChoice.EditValue); |
| | | AddProject.Type = (int)(eMenuType)this.imageComboBoxMenuType.EditValue; |
| | | AddProject.Permission = this.TxtEditPermission.Text.Trim(); |
| | | AddProject.ProjectID = GlobalParas._GlobalParas.ProjectID; |
| | | AddProject.SoftwareIds = new List<long> { GlobalParas._GlobalParas.SoftwareID }; |
| | | if (await this.ReloadDataEvent.Invoke(AddProject)) |
| | | { |
| | | TipFormHelper.ShowSucceed("添加成功!!"); |
| | | } |
| | |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | private void simpleLabelDelete_Click(object sender, EventArgs e) |
| | | { |
| | | this.ComboBoxEditParentsChoice.EditValue = null; |
| | | } |
| | | } |
| | | } |