public async Task<ActionResult> MoveToQueue(int threadId = 0, int pageNo = 1, int queueId = 0)
		{
			var (result, thread) = await PerformSecurityCheckAsync(threadId);
			if(result != null)
			{
				return result;
			}

			var containingQueue = await SupportQueueGuiHelper.GetQueueOfThreadAsync(threadId);

			// now set the queue if: 
			// a) the thread isn't in a queue and the selected queueID > 0 (so not None)
			// b) the thread is in a queue and the selected queueuID isn't the id of the queue containing the thread
			if(((containingQueue == null) && (queueId > 0)) || ((containingQueue != null) && (containingQueue.QueueID != queueId)))
			{
				// Set the queue. if the new queue is 0, remove from queue.
				if(queueId > 0)
				{
					await SupportQueueManager.AddThreadToQueueAsync(threadId, queueId, this.HttpContext.Session.GetUserID(), null);
				}
				else
				{
					await SupportQueueManager.RemoveThreadFromQueueAsync(threadId, null);
				}
				// reset the cached value how much messages are in the queues. 
				ApplicationAdapter.InvalidateCachedNumberOfThreadsInSupportQueues();
			}

			return RedirectToAction("Index", "Thread", new {threadId = threadId, pageNo = pageNo});
		}
        /// <summary>
        /// Handles the PerformWork event of the _supportQueueDS control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="SD.LLBLGen.Pro.ORMSupportClasses.PerformWorkEventArgs"/> instance containing the event data.</param>
        protected void _supportQueueDS_PerformWork(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformWorkEventArgs e)
        {
            SupportQueueManager.PersistSupportQueueUnitOfWork(e.Uow);

            // invalidate cache
            CacheManager.InvalidateCachedItem(CacheKeys.AllSupportQueues);
        }
Beispiel #3
0
        protected void btnSet_Click(object sender, EventArgs e)
        {
            if (!_userMayManageSupportQueueContents)
            {
                return;
            }

            // move this thread to a support queue.
            // check the selected ID to see if it is the same as the current Queue. If so, ignore, otherwise set the queue.
            int selectedQueueID = HnDGeneralUtils.TryConvertToInt(cbxSupportQueues.SelectedValue);

            SupportQueueEntity containingQueue = SupportQueueGuiHelper.GetQueueOfThread(_thread.ThreadID);

            // now set the queue if:
            // a) the thread isn't in a queue and the selected queueID > 0 (so not None)
            // b) the thread is in a queue and the selected queueuID isn't the id of the queue containing the thread
            if (((containingQueue == null) && (selectedQueueID != -1)) || ((containingQueue != null) && (containingQueue.QueueID != selectedQueueID)))
            {
                // Set the queue. if the new queue is -1, remove from queue.
                if (selectedQueueID > 0)
                {
                    SupportQueueManager.AddThreadToQueue(_thread.ThreadID, selectedQueueID, SessionAdapter.GetUserID(), null);
                }
                else
                {
                    SupportQueueManager.RemoveThreadFromQueue(_thread.ThreadID, null);
                }
            }

            // done redirect to this page to refresh.
            Response.Redirect("Messages.aspx?ThreadID=" + _thread.ThreadID + "&StartAtMessage=" + _startMessageNo);
        }
		public async Task<ActionResult> ReleaseThread(int threadId, int pageNo)
		{
			var (result, thread) = await PerformSecurityCheckAsync(threadId);
			if(result != null)
			{
				return result;
			}

			await SupportQueueManager.ReleaseClaimOnThreadAsync(threadId);
			return RedirectToAction("Index", "Thread", new {threadId = threadId, pageNo = pageNo});
		}
		public async Task<ActionResult> ClaimThread(int threadId, int pageNo)
		{
			var (result, thread) = await PerformSecurityCheckAsync(threadId);
			if(result != null)
			{
				return result;
			}

			await SupportQueueManager.ClaimThreadAsync(this.HttpContext.Session.GetUserID(), threadId);
			return RedirectToAction("Index", "Thread", new {threadId = threadId, pageNo = pageNo});
		}
Beispiel #6
0
        public async Task <ActionResult> UpdateQueues(string threadClaimButton)
        {
            if (!this.HttpContext.Session.HasSystemActionRight(ActionRights.QueueContentManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var buttonIdClicked = threadClaimButton ?? string.Empty;

            if (string.IsNullOrWhiteSpace(buttonIdClicked))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var idFragments = buttonIdClicked.Split('_');

            if (idFragments.Length != 2)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var threadId = 0;

            if (!Int32.TryParse(idFragments[1], out threadId))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var(result, thread) = await PerformSecurityCheckAsync(threadId);

            if (result != null)
            {
                return(result);
            }

            switch (idFragments[0])
            {
            case "releaseButton":
                await SupportQueueManager.ReleaseClaimOnThreadAsync(threadId);

                break;

            case "claimButton":
                await SupportQueueManager.ClaimThreadAsync(this.HttpContext.Session.GetUserID(), threadId);

                break;

            default:
                return(RedirectToAction("Index", "Home"));
            }

            // it's either claim or release, go back to the original view for all queues
            return(RedirectToAction("ListQueues", "SupportQueue"));
        }
Beispiel #7
0
        protected void btnRelease_Click(object sender, EventArgs e)
        {
            if (!_userMayManageSupportQueueContents)
            {
                return;
            }

            // release any claim on this thread.
            SupportQueueManager.ReleaseClaimOnThread(_thread.ThreadID);
            // done redirect to this page to refresh.
            Response.Redirect("Messages.aspx?ThreadID=" + _thread.ThreadID + "&StartAtMessage=" + _startMessageNo);
        }
Beispiel #8
0
        protected void btnClaim_Click(object sender, EventArgs e)
        {
            if (!_userMayManageSupportQueueContents)
            {
                return;
            }

            // claim this thread
            SupportQueueManager.ClaimThread(SessionAdapter.GetUserID(), _thread.ThreadID);
            // done redirect to this page to refresh.
            Response.Redirect("Messages.aspx?ThreadID=" + _thread.ThreadID + "&StartAtMessage=" + _startMessageNo);
        }
        public async Task <ActionResult> UpdateSupportQueue([FromBody] SupportQueueDto toUpdate)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var result = await SupportQueueManager.ModifySupportQueueAsync(toUpdate);

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

            // jsGrid requires the updated object as return value.
            return(Json(toUpdate));
        }
        public async Task <ActionResult> InsertSupportQueue([FromBody] SupportQueueDto toInsert)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var queueId = await SupportQueueManager.CreateNewSupportQueueAsync(toInsert);

            if (queueId > 0)
            {
                _cache.Remove(CacheKeys.AllSupportQueues);
                toInsert.QueueID = queueId;
            }

            // jsGrid requires the inserted object as return value.
            return(Json(toInsert));
        }
Beispiel #11
0
        /// <summary>
        /// Handles the ItemCommand event of the rpThreads control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterCommandEventArgs"/> instance containing the event data.</param>
        protected void rpThreads_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "ReleaseClaim":
                // release a claim on the thread.
                SupportQueueManager.ReleaseClaimOnThread(HnDGeneralUtils.TryConvertToInt((string)e.CommandArgument));
                // done, refresh
                Response.Redirect("SupportQueues.aspx", true);
                break;

            case "Claim":
                // claim the thread specified for the current user
                SupportQueueManager.ClaimThread(SessionAdapter.GetUserID(), HnDGeneralUtils.TryConvertToInt((string)e.CommandArgument));

                // done, refresh
                Response.Redirect("SupportQueues.aspx", true);
                break;
            }
        }
        public async Task <ActionResult> DeleteSupportQueue(int queueId)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var result = false;

            if (queueId > 0)
            {
                result = await SupportQueueManager.DeleteSupportQueueAsync(queueId);

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

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