Пример #1
0
        public Boolean UpdateGetWork()
        {
            Boolean success = false;

            StringBuilder sqlStatement = new StringBuilder();

            WorkQueue updatedWorkQueue = null;


            try {
                if (!application.SessionWorkQueueHasManagePermission(id))
                {
                    throw new ApplicationException("Permission Denied. Not a manager of the Work Queue.");
                }

                updatedWorkQueue = new WorkQueue(application, id);

                if (modifiedAccountInfo.ActionDate != updatedWorkQueue.ModifiedAccountInfo.ActionDate)
                {
                    throw new ApplicationException("Permission Denied. Work Queue has been modified since last retreived from the database.");
                }


                updatedWorkQueue.GetWorkViewId = getWorkViewId;

                updatedWorkQueue.GetWorkUseGrouping = getWorkUseGrouping;

                updatedWorkQueue.GetWorkUserViews = getWorkUserViews;


                success = updatedWorkQueue.Save(false);
            }

            catch (Exception applicationException) {
                success = false;

                application.SetLastException(applicationException);
            }

            return(success);
        }
Пример #2
0
        public Boolean MoveToQueue(Int64 destinationWorkQueueId, Boolean validatePermission)
        {
            Boolean success = false;

            application.SetLastException(null);

            WorkQueue destinationWorkQueue = application.WorkQueueGet(destinationWorkQueueId);

            if (WorkQueue == null)
            {
                throw new ApplicationException("Unable to reference Source Work Queue.");
            }

            if (destinationWorkQueue == null)
            {
                throw new ApplicationException("Unable to reference Destination Work Queue.");
            }

            try {
                if (validatePermission)
                {
                    if (!WorkQueue.HasManagePermission)
                    {
                        throw new ApplicationException("Permission Denied on Source Work Queue.");
                    }

                    if (!destinationWorkQueue.HasManagePermission)
                    {
                        throw new ApplicationException("Permission Denied on Destination Work Queue.");
                    }
                }


                if (workQueueId != destinationWorkQueueId)
                {
                    workQueue = null;

                    StringBuilder sqlStatement = new StringBuilder();

                    sqlStatement.Append("EXEC WorkQueueItem_MoveToQueue " + Id.ToString() + ", " + destinationWorkQueueId.ToString() + ", ");

                    sqlStatement.Append("NULL, ");

                    Server.Data.AuthorityAccountStamp assignmentAccountInfo = new Mercury.Server.Data.AuthorityAccountStamp(application.Session);

                    sqlStatement.Append("'" + assignmentAccountInfo.SecurityAuthorityNameSql + "', '" + assignmentAccountInfo.UserAccountIdSql + "', '" + assignmentAccountInfo.UserAccountNameSql + "'");


                    success = application.EnvironmentDatabase.ExecuteSqlStatement(sqlStatement.ToString(), 0);

                    if (!success)
                    {
                        throw application.EnvironmentDatabase.LastException;
                    }
                }
            }

            catch (Exception applicationException) {
                application.SetLastException(applicationException);

                success = false;
            }

            return(success);
        }