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.")); }
/// <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)); } }
/// <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))); } }
public void Initialize() { sectionManager = GetComponent <SectionManager>(); weaponSystem = GetComponent <WeaponSystem>(); outlineHandler = GetComponent <OutlineHandler>(); }
/// <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)); } }
void Reset() { if (sectionManager == null) { sectionManager = new SectionManager(this); } }
// Use this for initialization void Start() { audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>(); player = GameObject.Find("Player"); section = player.GetComponent <SectionManager> (); rb2d = GetComponent <Rigidbody2D> (); }
/// <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); } }
/// <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)); } }
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); } }
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>()); }
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); } }
void Reset() { if (sectionManager == null) { sectionManager = new SectionManager(this); } }
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); } }
public EmployeeEntry() { _branchManager = new BranchManager(); _employeeUserManager = new EmployeeUserManager(); _roleManager = new RoleManager(); _sectionManager = new SectionManager(); _designationManager = new DesignationManager(); }
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; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player") || collision.gameObject.CompareTag("Disabled")) { SectionManager sectionManager = SectionManager.Instance; sectionManager.SpawnSection(); } }
public SectionController( SectionManager sectionManager, ExamManager examManager ) { _sectionManager = sectionManager; _examManager = examManager; }
public ExamDocumentsController( ExamManager examManager, SectionManager sectionManager ) { _examManager = examManager; _sectionManager = sectionManager; }
private void Awake() { sectionManager = FindObjectOfType <SectionManager>(); foreach (var screen in screens) { screen.GetComponent <CanvasGroup>().DOFade(0, 0); } }
private void Awake() { if (SectionManager.instance == null) { SectionManager.instance = this; } sectionButtons = new List <SectionButton>(); sections = new List <float>(); }
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); } }
/// <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); }
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); }
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 )); } }
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 )); } }
/// <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)); }
/// <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); }
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"); } }