コード例 #1
0
ファイル: FrmRoleMgr.cs プロジェクト: radtek/smartaccess
        private void FrmRoleMgr_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                    var models = roleBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in models)
                        {
                            AddModel(item);
                        }
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载角色异常:" + ex.Message);
                    log.Error("加载角色异常:", ex);
                }
            });

            waiting.Show(this, 300);
        }
コード例 #2
0
ファイル: DeptMgr.cs プロジェクト: radtek/smartaccess
        private void ShowRoles(decimal orgId)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                var roles = roleBll.GetModelList("ID IN (SELECT RF.ROLE_ID FROM SMT_ROLE_FUN RF WHERE RF.FUN_ID=" + orgId + " and RF.ROLE_TYPE=2)");
                this.Invoke(new Action(() =>
                {
                    DoShowRolesToGrid(roles);
                }));
            });

            waiting.Show(this);
        }
コード例 #3
0
        private void FrmRolesSelector_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                    var models = roleBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        this.advRoleTree.Nodes[0].Nodes.Clear();
                        if (models.Count == 0)
                        {
                            WinInfoHelper.ShowInfoWindow(this, "没有获取到角色列表!");
                            return;
                        }
                        foreach (var item in models)
                        {
                            Node node    = new Node(item.ROLE_NAME);
                            node.Tooltip = item.ROLE_DESC;
                            advRoleTree.Nodes[0].Nodes.Add(node);
                            node.Tag = item;
                            if (_selectedids != null && _selectedids.Count > 0)
                            {
                                if (_selectedids.Contains(item.ID))
                                {
                                    node.Checked = true;
                                }
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载角色列表异常:" + ex.Message);
                    log.Error("加载角色列表异常:", ex);
                }
            });

            waiting.Show(this);
        }
コード例 #4
0
        private void Init()
        {
            if (_userInfo != null)
            {
                this.Text = "编辑用户";
                if (_userInfo.USER_NAME == "admin")
                {
                    tbUserName.ReadOnly = true;
                    cboRole.Enabled     = false;
                }
                tbUserName.Text  = _userInfo.USER_NAME;
                tbPwd.Text       = _userInfo.PASS_WORD;
                tbRealName.Text  = _userInfo.REAL_NAME;
                cbEnable.Checked = _userInfo.IS_ENABLE;
                tbTel.Text       = _userInfo.TELEPHONE;
                tbAddress.Text   = _userInfo.ADDRESS;
                tbEmail.Text     = _userInfo.EMAIL;
                tbQQ.Text        = _userInfo.QQ;
            }
            else
            {
                this.Text = "新建用户";
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    var depts = DeptDataHelper.GetDepts(true);
                    this.Invoke(new Action(() =>
                    {
                        var nodes = DeptDataHelper.ToTree(depts);
                        cbtDept.Nodes.AddRange(nodes.ToArray());
                        foreach (DevComponents.AdvTree.Node item in cbtDept.Nodes)
                        {
                            item.ExpandAll();
                        }
                        if (_userInfo != null && _userInfo.ORG_ID != null)
                        {
                            decimal id = (decimal)_userInfo.ORG_ID;
                            if (id >= 0)
                            {
                                var node = FindNode(id);

                                if (node != null)
                                {
                                    cbtDept.SelectedNode = node;
                                }
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载部门异常!" + ex.Message);
                    log.Error("加载部门异常:", ex);
                }
            });

            waiting.Show(this, 300);

            CtrlWaiting waiting1 = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                    var models = roleBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in models)
                        {
                            ComboItem cbi = new ComboItem(item.ROLE_NAME);
                            cbi.Tag       = item;
                            cboRole.Items.Add(cbi);
                            if (_userInfo != null && _userInfo.ROLE_ID != null && _userInfo.ROLE_ID == item.ID)
                            {
                                cboRole.SelectedItem = cbi;
                            }
                        }
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载角色异常!" + ex.Message);
                    log.Error("加载角色异常:", ex);
                }
            });

            waiting1.Show(this, 300);
        }