#region using System; using System.Collections.Generic; using CSFrameworkV5.Business.BLL_Permission; using CSFrameworkV5.Interfaces; using CSFrameworkV5.Library.UIForm; #endregion namespace CSFrameworkV5.Library.PermissionForms { public partial class frmGroupOrganization_UserPicker : frmBaseDialog { private Action> _callback; /// /// 不查询当前组的用户(过滤) /// private string _currentGroupCode; private string _currentGroupName; public frmGroupOrganization_UserPicker() { InitializeComponent(); } private void btnCancel_Click(object sender, EventArgs e) { Close(); } private void btnFindUser_Click(object sender, EventArgs e) { var dt = new bllUser().SearchEx(txtUserText.Text, _currentGroupCode); listUsers.DisplayMember = "UserName"; listUsers.ValueMember = "Account"; listUsers.DataSource = dt; } private void btnOk_Click(object sender, EventArgs e) { if (listUsers.CheckedItems.Count > 0) { if (_callback != null) _callback(GetResult()); Close(); } else { MsgEx.ShowWaring("请勾选用户!"); } } /// /// /// /// public static List Execute( Action> callback, string currentGroupCode = "", string currentGroupName = "") { var form = new frmGroupOrganization_UserPicker(); form._currentGroupCode = currentGroupCode; form._currentGroupName = currentGroupName; form.lblMsg.Text = $"当前部门【{currentGroupName}】"; form._callback = callback; form.ShowDialog(); return form.GetResult(); } private void frmGroupOrganization_UserPicker_Load(object sender, EventArgs e) { btnFindUser_Click(btnFindUser, new EventArgs()); } private List GetResult() { var list = new List(); foreach (var o in listUsers.CheckedItems) list.Add(o as AccountModel); return list; } } }