示例#1
0
        public async Task <ActionResult> DeleteSection(int sectionId)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var result = false;

            if (sectionId > 0)
            {
                result = await SectionManager.DeleteSectionAsync(sectionId);

                if (result)
                {
                    _cache.Remove(CacheKeys.AllSections);
                }
            }

            if (result)
            {
                return(Json(new { success = true }));
            }

            return(ValidationProblem("The section wasn't deleted. Likely because it contained one or more forums. First delete the forums, then delete the section."));
        }
示例#2
0
 /// <summary>
 /// Method to select an Section entity.
 /// </summary>
 /// <param name="op">Section entities select options to perform query.</param>
 /// <returns>An Section entity or null if not found.</returns>
 public SectionEntity SingleOrDefault(SectionOptionsSelect op)
 {
     using (Db.Context)
     {
         return(SectionManager.Select(op, false));
     }
 }
示例#3
0
        /// <summary>
        /// Method to get a list of Section entity.
        /// </summary>
        /// <param name="op">Sections entities list options to perform query.</param>
        /// <returns>A list of Section entities.</returns>

        public ObservableCollection <SectionEntity> List(SectionOptionsList op)
        {
            using (Db.Context)
            {
                return(new ObservableCollection <SectionEntity>(SectionManager.List(op)));
            }
        }
示例#4
0
    public void Initialize()
    {
        sectionManager = GetComponent <SectionManager>();
        weaponSystem   = GetComponent <WeaponSystem>();

        outlineHandler = GetComponent <OutlineHandler>();
    }
示例#5
0
 /// <summary>
 /// Method to select an Section entity.
 /// </summary>
 /// <param name="op">Section entities select options to perform query.</param>
 /// <returns>An Section entity or null if not found.</returns>
 public SectionEntity SingleOrNull(SectionOptionsSelect op)
 {
     using (Db.Context)
     {
         return(SectionManager.Select(op, true));
     }
 }
示例#6
0
 void Reset()
 {
     if (sectionManager == null)
     {
         sectionManager = new SectionManager(this);
     }
 }
示例#7
0
 // Use this for initialization
 void Start()
 {
     audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();
     player       = GameObject.Find("Player");
     section      = player.GetComponent <SectionManager> ();
     rb2d         = GetComponent <Rigidbody2D> ();
 }
示例#8
0
        /// <summary>
        /// Method to update a Section entity asynchronously.
        /// </summary>
        /// <param name="entity">A Section entity.</param>
        /// <param name="save">Save database changes ?</param>
        /// <returns>The updated <see cref="SectionEntity"/>.</returns>
        public async Task <SectionEntity> UpdateAsync(SectionEntity entity, bool save = true)
        {
            using (Db.Context)
            {
                // Try to attach entity to the database context.
                try
                {
                    Db.Context.Attach(entity);
                }
                catch (Exception e)
                {
                    log.Fatal(e.Output(), e);
                    throw e;
                }

                // Update entity.
                entity = await SectionManager.UpdateAsync(entity);

                // Check if entity is set to default.
                if (entity.IsDefault)
                {
                    await SetDefaultAsync(entity.PrimaryKey);
                }

                // Hack to delete unassociated dependencies.
                //await CleanDependenciesAsync("SectionsInACLGroups", "AclGroupId", entity.PrimaryKey, entity.AclGroupsPKeys);
                //await CleanDependenciesAsync("AlbumsInSections", "AlbumId", entity.PrimaryKey, entity.AlbumsPKeys);

                return(entity);
            }
        }
示例#9
0
 /// <summary>
 /// Method to set a <see cref="SectionEntity"/> to default.
 /// </summary>
 /// <param name="entityPK">A <see cref="SectionEntity"/> unique id or primary key.</param>
 public async Task <int> SetDefaultAsync(int entityPK)
 {
     using (Db.Context)
     {
         return(await SectionManager.SetDefaultAsync("Sections", "SectionId", entityPK));
     }
 }
示例#10
0
        public void SectionMananagerWithFreeRangeFollowedByAllocatedRange_FreeLastAllocatedRange_NoSections()
        {
            using (var sectionManager = SectionManager.Create(Allocator.Temp))
            {
                const int length1 = 11;
                const int length2 = 12;
                var       offset1 = sectionManager.AllocateRange(length1);
                var       offset2 = sectionManager.AllocateRange(length2);
                Assume.That(sectionManager.IsSectionFree(0), Is.False);
                sectionManager.FreeRange(offset1, length1);
                Assume.That(sectionManager.Count, Is.EqualTo(2));
                Assume.That(sectionManager.IsSectionFree(0), Is.True);
                Assume.That(sectionManager.IsSectionFree(1), Is.False);
                // x = free, o = allocated
                // xxxxxxx ooooooo

                // Allocate a section that fits exactly in our empty section
                sectionManager.FreeRange(offset2, length2);

                // xxxxxxx xxxxxxx
                // xxxxxxxxxxxxxx <- merged
                // <- last section is always removed
                Assert.AreEqual(0, sectionManager.Count);
            }
        }
示例#11
0
    private void BuildClassWeapon(WeaponItem wItem, MechManager mechManager, SectionManager sectionManager, int secIndex, int subIndex, int classIndex)
    {
        if (wItem == null)
        {
            return;
        }

        /* Create the Wep */
        GameObject newWeapon = Object.Instantiate(wItem.prefab);

        newWeapon.transform.parent           = sectionManager.GetSectionLinksByIndex(secIndex, classIndex)[subIndex];
        newWeapon.transform.localPosition    = Vector3.zero;
        newWeapon.transform.localEulerAngles = Vector3.zero;

        /* Add the weapons to the MechManager on the mech encapsulating object */
        mechManager.GetWeaponObjByIndex(secIndex).Add(newWeapon);

        /* Add the ref to the parent section to the weapon's script */
        newWeapon.GetComponent <WeaponExecutable>().sectionParent = sectionManager.GetSectionByIndex(secIndex);
        newWeapon.GetComponent <WeaponExecutable>().mechManager   = mechManager;

        // Move into modify???
        /* Create an executable for the weapon and add it to MechManager ref */
        mechManager.GetExecutableByIndex(secIndex).Add(newWeapon.GetComponent <WeaponExecutable>());
    }
示例#12
0
        public void SectionMananager_ReallocateRangeWithSmallerBlock_ReturnsSameOffset()
        {
            using (var sectionManager = SectionManager.Create(Allocator.Temp))
            {
                const int length  = 12;
                var       offset1 = sectionManager.AllocateRange(length);
                Assume.That(sectionManager.IsSectionFree(0), Is.False);
                Assume.That(sectionManager.Count, Is.EqualTo(1));
                Assume.That(sectionManager.GetSectionStart(0), Is.EqualTo(0));
                Assume.That(sectionManager.GetSectionLength(0), Is.EqualTo(length));
                Assume.That(sectionManager.IsSectionFree(0), Is.False);
                Assume.That(sectionManager.Count, Is.EqualTo(1));
                // x = free, o = allocated
                // oooooooo

                var offset4 = sectionManager.ReallocateRange(offset1, length, length - 3);
                Assume.That(sectionManager.Count, Is.EqualTo(1));

                //       ____ free
                //       |
                //       v
                // oooo xx
                // oooo <- empty section at end is removed
                Assert.AreEqual(offset4, offset1);
                Assert.AreEqual(sectionManager.GetSectionStart(0), 0);
                Assert.AreEqual(sectionManager.GetSectionLength(0), length - 3);
                Assume.That(sectionManager.IsSectionFree(0), Is.False);
            }
        }
示例#13
0
 void Reset()
 {
     if (sectionManager == null)
     {
         sectionManager = new SectionManager(this);
     }
 }
示例#14
0
        public void SectionMananagerWithFreeRangeFollowedByAllocatedRange_FreeRangeAtBeginning_AllocatedSectionFollowedByFreeSectionFollowedByAllocatedSection()
        {
            using (var sectionManager = SectionManager.Create(Allocator.Temp))
            {
                const int length  = 10;
                var       offset1 = sectionManager.AllocateRange(length);
                var       offset2 = sectionManager.AllocateRange(length);
                Assume.That(sectionManager.IsSectionFree(0), Is.False);
                sectionManager.FreeRange(offset1, length);
                Assume.That(sectionManager.Count, Is.EqualTo(2));
                Assume.That(sectionManager.IsSectionFree(0), Is.True);
                Assume.That(sectionManager.IsSectionFree(1), Is.False);
                // x = free, o = allocated
                // xxxxxxx ooooooo

                // Allocate a section that fits in our empty section
                var offset3 = sectionManager.AllocateRange(length - 1);
                Assume.That(offset3, Is.EqualTo(offset1));

                // oooooo x ooooooo
                Assert.AreEqual(3, sectionManager.Count);
                Assert.AreEqual(sectionManager.GetSectionStart(0), 0);
                Assert.AreEqual(sectionManager.GetSectionLength(0), length - 1);
                Assert.AreEqual(sectionManager.GetSectionStart(1), length - 1);
                Assert.AreEqual(sectionManager.GetSectionLength(1), 1);
                Assert.AreEqual(sectionManager.GetSectionStart(2), length);
                Assert.AreEqual(sectionManager.GetSectionLength(2), length);
                Assume.That(sectionManager.IsSectionFree(0), Is.False);
                Assume.That(sectionManager.IsSectionFree(1), Is.True);
                Assume.That(sectionManager.IsSectionFree(2), Is.False);
            }
        }
示例#15
0
 public EmployeeEntry()
 {
     _branchManager       = new BranchManager();
     _employeeUserManager = new EmployeeUserManager();
     _roleManager         = new RoleManager();
     _sectionManager      = new SectionManager();
     _designationManager  = new DesignationManager();
 }
示例#16
0
        private void InitialisePage()
        {
            iframe = "ilboinnerframe";

            GoBack = new Button("Go Back", By.Id("span_lnkpreferences"), name, iframe);
            ManageRequestQuickLinks = SectionManager.GetManageRequestQuickLinks();
            MyPreferenceSetting     = new Button("My Preference Setting", By.XPath("//td[@id='ext-gen834']//div[@qtip='Go back']"), name);
        }
 public QuestionController(
     QuestionManager questionManager,
     SectionManager sectionManager
     )
 {
     _questionManager = questionManager;
     _sectionManager  = sectionManager;
 }
示例#18
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") || collision.gameObject.CompareTag("Disabled"))
     {
         SectionManager sectionManager = SectionManager.Instance;
         sectionManager.SpawnSection();
     }
 }
示例#19
0
 public SectionController(
     SectionManager sectionManager,
     ExamManager examManager
     )
 {
     _sectionManager = sectionManager;
     _examManager    = examManager;
 }
示例#20
0
 public ExamDocumentsController(
     ExamManager examManager,
     SectionManager sectionManager
     )
 {
     _examManager    = examManager;
     _sectionManager = sectionManager;
 }
示例#21
0
    private void Awake()
    {
        sectionManager = FindObjectOfType <SectionManager>();

        foreach (var screen in screens)
        {
            screen.GetComponent <CanvasGroup>().DOFade(0, 0);
        }
    }
示例#22
0
    private void Awake()
    {
        if (SectionManager.instance == null)
        {
            SectionManager.instance = this;
        }

        sectionButtons = new List <SectionButton>();
        sections       = new List <float>();
    }
示例#23
0
        private void btnSave_ServerClick(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                // Save the form contents.
                int sectionID = SectionManager.AddNewSection(tbxSectionName.Value, tbxSectionDescription.Text, HnDGeneralUtils.TryConvertToShort(tbxOrderNo.Text));

                // done, redirect to self
                Response.Redirect("AddSection.aspx", true);
            }
        }
示例#24
0
 /// <summary>
 /// Method to register entities context manager.
 /// </summary>
 protected void RegisterContext()
 {
     AclActions = new AclActionManager(context);
     AclGroups  = new AclGroupManager(context);
     Albums     = new AlbumManager(context);
     Infos      = new InfoManager(context);
     Pictures   = new PictureManager(context);
     Sections   = new SectionManager(context);
     Users      = new UserManager(context);
     Versions   = new VersionManager(context);
 }
示例#25
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
 private void InitialisePage()
 {
     FirstHeaderSearchSuggestionOption = new Label("First Search Suggestion Option", By.XPath("//div[contains(@class,'x-grid3-col-bpcsearch_cell_5')]"), name);
     HeaderSearchBox = new InputBox("Header Search", By.Id("bpcsearch"), name);
     MyLeave         = SectionManager.GetMyLeave();
     UserGroupPopUp  = new UserGroupPopUp();
     HomeTickerDown  = new Link("Home Ticker Down", By.Id("bannerCollapse"), name);
     TopPanelToggle  = new Button("Top Panel Selectable Toggle", By.XPath("//div[@id='top-panel']//em/button[contains(@class,'x-btn-text x-icon-bpc')]"), name);
     UserGroup       = new Label("User Group", By.XPath("//em/button/div[@style='color:#fff;']"), name);
     UserInfoClick   = new DropDown("User Info Click", By.XPath("//tr[@id='ext-gen778']/td[@class='x-btn-right']"), name);
 }
示例#27
0
 public async Task <int> DeleteDependenciesAsync(string entityPK, int sectionId, List <int> entityPKs)
 {
     using (Db.Context)
     {
         return(await SectionManager.DeleteDependencyAsync
                (
                    new EntityManagerDeleteDependency { Name = "", key = "SectionId", keyList = entityPK },
                    sectionId,
                    entityPKs
                ));
     }
 }
示例#28
0
 public async Task <int> CleanDependenciesAsync(string dependencyName, string dependencyPKName, int sectionId, IEnumerable <int> dependenciesPKs)
 {
     using (Db.Context)
     {
         return(await SectionManager.CleanDependencyAsync
                (
                    new EntityManagerDeleteDependency { Name = dependencyName, key = "SectionId", keyList = dependencyPKName },
                    sectionId,
                    dependenciesPKs
                ));
     }
 }
示例#29
0
        /// <summary>
        /// Gets <see cref="Section"/>'s allowed by the current user and filtered by entities.
        /// </summary>
        /// <param name="entitySchema"><see cref="EntitySchema"/> instance.</param>
        /// <returns>Return <see cref="Section"/>'s allowed by the current user and filtered by entities.</returns>
        private IEnumerable <Section> GetSections(EntitySchema entitySchema)
        {
            var currentUserWorkplaces = GetCurrentUserWorkplaces();

            LogInfoObjectList("Allowed workplaces", currentUserWorkplaces);
            var workplacesSectionsIds = GetWorkplacesSectionIds(currentUserWorkplaces);
            var sections = SectionManager.GetSectionsByEntityUId(entitySchema.UId);

            LogInfoObjectList($"Allowed schema '{entitySchema.Name}' sections", sections);
            var sectionType = GetSectionType();

            return(sections.Where(s => workplacesSectionsIds.Contains(s.Id) && s.Type == sectionType));
        }
示例#30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="SectionId"></param>
        /// <returns></returns>

        public SectionEntity Delete(int alGroupId)
        {
            SectionEntity item = SingleOrNull(new SectionOptionsSelect {
                PrimaryKey = alGroupId
            });

            using (Db.Context)
            {
                item = SectionManager.Delete(item);
            }

            return(item);
        }
示例#31
0
 private void buttonItem2_Click(object sender, EventArgs e)
 {
     try
     {
         SectionManager.Clean();
         SectionManager.FixedSectionValues.Clear();
         extentionsfrm1.ResetAll();
     }
     catch (Exception ex)
     {
         Log.ShowInfo(ex.Message, "RESET GENERATOR");
     }
 }