Esempio n. 1
0
        private void bbiAddSystem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            BDictSystem   system = new BDictSystem();
            FrmSystemEdit frm    = new FrmSystemEdit();

            if (this.roleList == null)
            {
                //  获取全部可用角色列表
                this.roleList = CommonDataHelper.GetRoleAll();
            }
            if (this.empList == null)
            {
                //  获取全部可用员工列表
                this.empList = CommonDataHelper.GetEmpAll();
            }

            frm.SetRefData(this.roleList, this.empList);
            frm.Init(true, system, new List <BDictRole>(), new List <DataEmpDir>());
            if (frm.ShowDialog() == DialogResult.OK)
            {
                system = frm.GetData();

                TreeListNode rnode = this.tlSysMenu.Nodes.Add(new object[] { system.Code, system.Name });
                rnode.Tag             = system;
                rnode.ImageIndex      = system.Id > 10000 ? 1 : 2;
                tlSysMenu.FocusedNode = rnode;
            }
            frm.Dispose();
        }
        private void selectEmp()
        {
            if (this.empList == null)
            {
                this.empList = CommonDataHelper.GetEmpAll();
            }

            FrmSelectEmp frm = new FrmSelectEmp();

            frm.SetDataSource(this.empList, this.gcEmp.DataSource as List <DataEmpDir>);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                List <DataEmpDir> new_selected = frm.EmpSelected;
                gcEmp.DataSource = new_selected;
            }
            frm.Dispose();
        }
        private void selectRole()
        {
            if (this.roleList == null)
            {
                this.roleList = CommonDataHelper.GetRoleAll();
            }

            FrmSelectRole frm = new FrmSelectRole();

            frm.SetDataSource(this.roleList, this.gcRole.DataSource as List <BDictRole>);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                List <BDictRole> new_selected = frm.RoleSelected;
                gcRole.DataSource = new_selected;
            }
            frm.Dispose();
        }
Esempio n. 4
0
        public override bool Init()
        {
            //  默认是操作员自己
            m_EmpId = EmpInfo.Id;
            if (this.beiEmp.ControlAuthority)
            {
                //  TODO: 查询员工信息列表
                List <DataEmpDir> emps = CommonDataHelper.GetEmpAll();

                this.rileEmp.DisplayMember = "Name";
                this.rileEmp.ValueMember   = "Id";
                this.rileEmp.DataSource    = emps;
                beiEmp.EditValue           = m_EmpId;
            }
            else
            {
                this.bsiEmpChoice.Visibility = BarItemVisibility.Never;
            }
            this.Fresh();

            return(base.Init());
        }
Esempio n. 5
0
        private void bbiEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (tlSysMenu.FocusedNode != null)
            {
                if (tlSysMenu.FocusedNode.Level == 0)
                {
                    //  系统修改
                    BDictSystem   system = tlSysMenu.FocusedNode.Tag as BDictSystem;
                    FrmSystemEdit frm    = new FrmSystemEdit();
                    if (this.roleList == null)
                    {
                        //  获取全部可用角色列表
                        this.roleList = CommonDataHelper.GetRoleAll();
                    }
                    if (this.empList == null)
                    {
                        //  获取全部可用员工列表
                        this.empList = CommonDataHelper.GetEmpAll();
                    }

                    frm.SetRefData(this.roleList, this.empList);
                    frm.Init(false, system, this.ucSystem1.GetRoles(), this.ucSystem1.GetEmps());
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        system = frm.GetData();
                        this.tlSysMenu.FocusedNode.SetValue(this.tlcCode, system.Code);
                        this.tlSysMenu.FocusedNode.SetValue(this.tlcName, system.Name);
                        this.tlSysMenu.FocusedNode.Tag = system;
                        this.ucSystem1.Init(system, frm.GetRoles(), frm.GetEmps());
                    }
                    frm.Dispose();
                }
                else
                {
                    //  菜单修改
                    BDictMenu   menu = tlSysMenu.FocusedNode.Tag as BDictMenu;
                    FrmMenuEdit frm  = new FrmMenuEdit();
                    if (this.roleList == null)
                    {
                        //  获取全部可用角色列表
                        this.roleList = CommonDataHelper.GetRoleAll();
                    }
                    if (this.empList == null)
                    {
                        //  获取全部可用员工列表
                        this.empList = CommonDataHelper.GetEmpAll();
                    }

                    frm.SetRefData(this.moduleList, this.objectList, this.roleList, this.empList);
                    frm.Init(false, menu, this.ucMenu1.GetRoles(), this.ucMenu1.GetEmps());
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        menu = frm.GetData();
                        this.tlSysMenu.FocusedNode.SetValue(this.tlcName, menu.Title);
                        this.tlSysMenu.FocusedNode.Tag = menu;
                        this.ucMenu1.Init(menu, frm.GetRoles(), frm.GetEmps());
                    }
                    frm.Dispose();
                }
            }
        }
Esempio n. 6
0
        private void bbiAddMenu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (tlSysMenu.FocusedNode == null)
            {
                return;
            }
            if ((tlSysMenu.FocusedNode.Tag as BDictMenu).ObjectCode != null)
            {
                MessageHelper.ShowWarning("该节点有对象,不能下挂菜单!");
                return;
            }
            if (tlSysMenu.FocusedNode.Level == 4)
            {
                MessageHelper.ShowWarning("菜单的层级目前至多为4级!");
                return;
            }

            //  计算下一个代码编号
            string code = string.Empty;

            if (tlSysMenu.FocusedNode.Nodes.Count > 0)
            {
                //  已经有节点,在最后节点编号基础上加1
                code = getNextMenuCode(tlSysMenu.FocusedNode.Nodes[tlSysMenu.FocusedNode.Nodes.Count - 1].GetValue(this.tlcCode).ToString());
            }
            else
            {
                if (tlSysMenu.FocusedNode.Level == 0)
                {
                    code = "1";
                }
                else
                {
                    code = tlSysMenu.FocusedNode.GetValue(this.tlcCode).ToString() + "1";
                }
            }

            //  获取系统ID
            int systemId = 0;

            if (tlSysMenu.FocusedNode.Level == 0)
            {
                systemId = (tlSysMenu.FocusedNode.Tag as BDictSystem).Id;
            }
            else
            {
                systemId = (tlSysMenu.FocusedNode.Tag as BDictMenu).SystemId;
            }

            BDictMenu menu = new BDictMenu();

            menu.Code     = code;
            menu.SystemId = systemId;
            menu.WinState = 1;

            FrmMenuEdit frm = new FrmMenuEdit();

            if (this.roleList == null)
            {
                //  获取全部可用角色列表
                this.roleList = CommonDataHelper.GetRoleAll();
            }
            if (this.empList == null)
            {
                //  获取全部可用员工列表
                this.empList = CommonDataHelper.GetEmpAll();
            }

            frm.SetRefData(this.moduleList, this.objectList, this.roleList, this.empList);
            frm.Init(true, menu, new List <BDictRole>(), new List <DataEmpDir>());
            if (frm.ShowDialog() == DialogResult.OK)
            {
                menu = frm.GetData();

                TreeListNode cnode = this.tlSysMenu.FocusedNode.Nodes.Add(new object[] { menu.Code, menu.Title });
                cnode.Tag             = menu;
                tlSysMenu.FocusedNode = cnode;
            }
            frm.Dispose();
        }