Exemplo n.º 1
0
        private static void EditUser(object id)
        {
            if (id == null)
            {
                return;
            }

            if (BusinessDomain.RestrictionTree.GetRestriction("mnuEditUsersbtnEdit") != UserRestrictionState.Allowed)
            {
                return;
            }

            User user = User.GetById((int)id);

            if (!user.CanEdit())
            {
                return;
            }

            using (EditNewUser dialog = new EditNewUser(user))
                if (dialog.Run() == ResponseType.Ok)
                {
                    using (new DbMasterScope(BusinessDomain.DataAccessProvider))
                        dialog.GetUser().CommitChanges();
                }
        }
Exemplo n.º 2
0
        private void btnAdd_Clicked(object sender, EventArgs e)
        {
            using (EditNewUser choose = new EditNewUser(null, UsersGroup.DefaultGroupId)) {
                if (choose.Run() != ResponseType.Ok)
                {
                    return;
                }

                using (new DbMasterScope(BusinessDomain.DataAccessProvider))
                    choose.GetUser().CommitChanges();
            }

            RefreshUsersTable();
        }
Exemplo n.º 3
0
        private void btnEdit_Clicked(object sender, EventArgs e)
        {
            Button btn  = (Button)sender;
            User   user = (User)btn.Data ["User"];

            using (EditNewUser choose = new EditNewUser(user, UsersGroup.DefaultGroupId)) {
                if (choose.Run() != ResponseType.Ok)
                {
                    return;
                }

                using (new DbMasterScope(BusinessDomain.DataAccessProvider))
                    choose.GetUser().CommitChanges();
            }

            RefreshUsersTable();
        }