| | |
| | | using DevExpress.XtraEditors.Controls; |
| | | using Yw.Dto; |
| | | |
| | | namespace HStation.WinFrmUI.Basic |
| | | namespace HStation.WinFrmUI.Basic |
| | | { |
| | | public partial class SetSysPropForCatalogDlg : Form |
| | | { |
| | | public SetSysPropForCatalogDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.gridView1.Columns["GroupName"].Group(); |
| | | } |
| | | |
| | | public class CurrentViewModel |
| | | { |
| | | public CurrentViewModel(SysPropHaveLogicalTreeDto rhs) |
| | | { |
| | | if (rhs.LogicalType == "sys-prop") |
| | | { |
| | | Name = rhs.LogicalName; |
| | | ID = rhs.LogicalID; |
| | | IsHave = rhs.Have; |
| | | } |
| | | else |
| | | { |
| | | Name = rhs.LogicalName; |
| | | ID = rhs.LogicalID; |
| | | IsHave = rhs.Have; |
| | | } |
| | | } |
| | | |
| | | public string Name { get; set; } |
| | | public long ID { get; set; } |
| | | public long ParentID { get; set; } |
| | | public bool IsHave { get; set; } |
| | | } |
| | | |
| | | private List<CurrentViewModel> _allBindingList = new List<CurrentViewModel>(); |
| | | private List<SysPropMappingViewModel> _allBindingList = new List<SysPropMappingViewModel>(); |
| | | |
| | | private Yw.BLL.SysPropMapping _bll = null; |
| | | |
| | |
| | | { |
| | | foreach (var child in item.Children) |
| | | { |
| | | CheckedListBoxItem childitem = new CheckedListBoxItem(); |
| | | childitem.Value = child.LogicalID; |
| | | childitem.Description = child.LogicalName; |
| | | checkedListBoxControl1.Items.Add(childitem); |
| | | if (child.Have) |
| | | { |
| | | childitem.CheckState = CheckState.Checked; |
| | | } |
| | | var model = new SysPropMappingViewModel(); |
| | | model.GroupName = item.LogicalName; |
| | | model.ID = child.LogicalID; |
| | | model.Name = child.LogicalName; |
| | | model.IsHave = child.Have; |
| | | _allBindingList.Add(model); |
| | | } |
| | | } |
| | | } |
| | | this.sysCatalogPropViewModelBindingSource.DataSource = _allBindingList; |
| | | this.gridView1.ExpandAllGroups(); |
| | | } |
| | | |
| | | // 完成 |
| | | private async void BtnOk_Click(object sender, EventArgs e) |
| | | { |
| | | List<long> IdList = new List<long>(); |
| | | foreach (var item in checkedListBoxControl1.CheckedItems) |
| | | foreach (var item in _allBindingList) |
| | | { |
| | | if (item is CheckedListBoxItem checkedListBoxItem) |
| | | if (item.IsHave) |
| | | { |
| | | var model = item as CheckedListBoxItem; |
| | | if (model != null) |
| | | { |
| | | var value = model.Value; |
| | | IdList.Add(Convert.ToInt64(model.Value)); |
| | | } |
| | | IdList.Add(item.ID); |
| | | } |
| | | } |
| | | if (await _bll.Set(_CatlogID, IdList)) |