示例#1
0
        private void newUser_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UserCategory          uc = bsCategory.Current as UserCategory;
            IList <SysOperButton> bs = bsSysOperButton.List as List <SysOperButton>;

            int count = uc.CategoryList.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                if (uc.CategoryList[i].CategoryCode == uc.CategoryCode)
                {
                    uc.CategoryList.RemoveAt(i);
                }
            }
            foreach (var item in bs)
            {
                if (item.IsSelect == true)
                {
                    uc.CategoryList.Add(new SysOprButtonToCategory()
                    {
                        CategoryCode = uc.CategoryCode,
                        ButtonName   = item.ButtonName,
                        ButtonType   = item.ButtonType
                    });
                }
            }

            bsCategory.ResetBindings(false);
            UserCategory curr = bsCategory.Current as UserCategory;

            if (curr == null)
            {
                MsgBox.ShowWarn("请先创建用户分类!");
                return;
            }
            using (FrmAddUser frm = new FrmAddUser(bsUser.Count.ToString(), 0, bsCategory.IndexOf(bsCategory.Current)))
            {
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    gvCategory.RefreshData();
                    //this.bsUser.DataSource = AGVDAccess.AGVClientDAccess.LoadUserByCategoryCode(curr.CategoryCode);
                    bsCategory.ResetBindings(false);
                    //  bsCategory.MoveLast();

                    gvCategory_FoucsedRowChanged(null, null);
                }
            }
        }
示例#2
0
        private void gvUser_DoubleClick(object sender, EventArgs e)
        {
            UserInfo user = bsUser.Current as UserInfo;

            if (user == null)
            {
                return;
            }
            using (FrmAddUser frm = new FrmAddUser(user.UserID, 1, bsCategory.IndexOf(bsCategory.Current)))
            {
                frm.txtUser = bsUser.Current as UserInfo;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    this.bsCategory.DataSource = AGVDAccess.AGVClientDAccess.get_Category();
                    bsCategory.ResetBindings(false);
                    bsCategory.MoveLast();
                    gvCategory_FoucsedRowChanged(null, null);
                }
            }
        }