namespace HStation.WinFrmUI.Basic
|
{
|
public partial class SetSysPropForCatalogDlg : Form
|
{
|
public SetSysPropForCatalogDlg()
|
{
|
InitializeComponent();
|
this.gridView1.Columns["GroupName"].Group();
|
}
|
|
private List<SysPropMappingViewModel> _allBindingList = new List<SysPropMappingViewModel>();
|
|
private Yw.BLL.SysPropMapping _bll = null;
|
|
private long _CatlogID;
|
|
public async void SetBindingData(long ID)
|
{
|
_CatlogID = ID;
|
_bll = new Yw.BLL.SysPropMapping();
|
var PropTreeList = await _bll.GetHaveLogicalTreeList(ID);
|
foreach (var item in PropTreeList)
|
{
|
if (item.Children.Count > 0)
|
{
|
foreach (var child in item.Children)
|
{
|
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 _allBindingList)
|
{
|
if (item.IsHave)
|
{
|
IdList.Add(item.ID);
|
}
|
}
|
if (await _bll.Set(_CatlogID, IdList))
|
{
|
MessageBoxHelper.ShowSuccess("修改成功!");
|
}
|
else
|
{
|
MessageBoxHelper.ShowError("修改失败"!);
|
return;
|
}
|
this.Close();
|
}
|
}
|
}
|