Пример #1
0
        private bool DeleteItem()
        {
            bool success = false;

            try
            {
                GroupType item = new GroupType(ItemID);
                if (item.Delete())
                {
                    success = true;
                    ItemID  = 0;
                }
                else
                {
                    // display message that item is im use
                }
            }
            catch (Exception ex)
            {
                SPA.Error.WriteError(ex);
                if (ShowDebug)
                {
                    lblErrorMessage.Text = ex.ToString();
                }
            }
            return(success);
        }
Пример #2
0
        public void DeleteGroupType_WithGroup()
        {
            DatabaseFixtures dbFixtures = new DatabaseFixtures();

            using (ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope())
            {
                Tenant    tenant    = dbFixtures.CreateAndCommitOrganizationalStructureWithTwoTenants(ClientTransaction.Current);
                Group     group     = Group.FindByTenant(tenant.GetHandle()).Where(g => g.Name == "parentGroup0").Single();
                GroupType groupType = group.GroupType;

                groupType.Delete();
            }
        }
Пример #3
0
        public void DeleteGroupType_WithGroupTypePosition()
        {
            OrganizationalStructureTestHelper testHelper = new OrganizationalStructureTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                GroupType         groupType        = testHelper.CreateGroupType("GroupType");
                Position          position         = testHelper.CreatePosition("Position");
                GroupTypePosition concretePosition = testHelper.CreateGroupTypePosition(groupType, position);

                groupType.Delete();

                Assert.That(concretePosition.State, Is.EqualTo(StateType.Invalid));
            }
        }
Пример #4
0
        public void DeleteGroupType_WithAccessControlEntry()
        {
            DatabaseFixtures        dbFixtures = new DatabaseFixtures();
            AccessControlTestHelper testHelper = new AccessControlTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                dbFixtures.CreateEmptyDomain();
                GroupType          groupType = testHelper.CreateGroupType("GroupType");
                AccessControlEntry ace       = testHelper.CreateAceWithBranchOfOwningGroup(groupType);
                ClientTransaction.Current.Commit();

                groupType.Delete();

                ClientTransaction.Current.Commit();

                Assert.That(ace.State, Is.EqualTo(StateType.Invalid));
            }
        }