using DevExpress.XtraEditors;
|
using NetTaste;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using Yw;
|
using Yw.WinFrmUI;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class RoleProjectMenuPage : DocumentPage
|
{
|
public RoleProjectMenuPage()
|
{
|
InitializeComponent();
|
this.treeList1.InitialMultiColSettings();
|
|
this.roleTreeListCtrl1.FocusedChangedEvent += RoleTreeListCtrl1_FocusedChangedEvent;
|
}
|
|
public override void InitialDataSource()
|
{
|
this.roleTreeListCtrl1.InitialData();
|
}
|
|
private List<RoleProjcetMenuViewModel> _allBindingList;
|
|
private long _roleID;
|
|
/// <summary>
|
/// 聚焦改变事件
|
/// </summary>
|
private async void RoleTreeListCtrl1_FocusedChangedEvent(Yw.Vmo.Role obj)
|
{
|
_roleID = obj.ID;
|
|
_allBindingList = new List<RoleProjcetMenuViewModel>();
|
var allList = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.GetAuthorizeMenuList(1, obj.ID);
|
foreach (var item in allList)
|
{
|
_allBindingList.Add(new RoleProjcetMenuViewModel(item));
|
}
|
this.roleProjcetMenuViewModelBindingSource.DataSource = _allBindingList;
|
this.roleProjcetMenuViewModelBindingSource.ResetBindings(false);
|
}
|
|
//保存
|
private async void BtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
var menuList = new List<long>();
|
foreach (var item in _allBindingList)
|
{
|
if (item.Have)
|
{
|
menuList.Add(item.ID);
|
}
|
}
|
var bol = await BLLFactory<Yw.BLL.RoleProjectMenuMapping>.Instance.Set(1, _roleID, menuList);
|
if (bol)
|
{
|
TipFormHelper.ShowSucceed("保存成功!");
|
}
|
else
|
{
|
TipFormHelper.ShowError("保存失败!");
|
}
|
}
|
}
|
}
|