private JsonResult AddFinalDecision(int id, string text, FinalDecisionType finalDecisionType)
        {
            var result = new JsonOperationModel(false, GlobalStrings.CanNotAddDecision);

            var completed = TryAddFinalDecision(id, finalDecisionType, text);
            if (completed)
                result.IsSucceeded = true;

            return Json(result);
        }
        public JsonResult AddPreliminaryDecisionComment(int id, string text)
        {
            var result = new JsonOperationModel(false, GlobalStrings.CanNotAddPreliminaryDecisionComment);

            var commented = TryAddPreliminaryDecisionComment(id, text);
            if (commented)
                result.IsSucceeded = true;

            return Json(result);
        }
        private JsonResult TryDismiss(Guid id)
        {
            var result = new JsonOperationModel(false, String.Empty);

            try
            {
                this.Service.DismissNotification(this.SecurityToken, id);
                result.IsSucceeded = true;
            }
            catch (Exception) { result.IsSucceeded = false; }

            return Json(result);
        }
        private JsonResult TryAddReplyToPost(int id, Guid postId, string text)
        {
            var result = new JsonOperationModel(false, GlobalStrings.CanNotAddReplyOnPost);

            try
            {
                this.Service.ReplyOnPost(this.SecurityToken, id, postId, Guid.NewGuid(), text);
                result.IsSucceeded = true;                
                return Json(result);
            }
            catch (Exception)
            {
                return Json(result);
            }
        }
        public JsonResult Reopen(int id)
        {
            var result = new JsonOperationModel(false, String.Empty);

            try
            {
                this.Service.ReopenCase(this.SecurityToken, id);
                result.Result = "Reopen";
                result.IsSucceeded = true;
            }
            catch (ForbiddenException) { result.Result = GlobalStrings.Forbidden; }
            catch (CaseDoesNotExistException) { result.Result = GlobalStrings.CaseDoesNotExist; }
            catch (Exception) { result.Result = GlobalStrings.SomethingWentWrong; }

            return Json(result);
        }
        public JsonResult DeleteUser(Guid identifier)
        {
            var opResult = new JsonOperationModel(false, String.Empty);

            try
            {
                this.Service.DeleteUser(this.SecurityToken, identifier);

                opResult.Result = GlobalStrings.UserDeletedSuccessfully;
                opResult.IsSucceeded = true;
            }
            catch (UserDoesNotExistException)
            {
                opResult.Result = GlobalStrings.UserDoesNotExists;
            }
            catch (Exception)
            {
                opResult.Result = GlobalStrings.SomethingWentWrong;
            }

            return Json(opResult);
        }
        public JsonResult ResetSecurePhrase(Guid identifier)
        {
            var opResult = new JsonOperationModel(false, String.Empty);

            try
            {
                var user = this.Service.GetUser(this.SecurityToken, identifier);
                this.Service.InitiateResetSecurePhrase(this.SecurityToken, user.Email);

                opResult.Result = String.Format(GlobalStrings.UserResetSecurePhraseRequested, user.FullName());
                opResult.IsSucceeded = true;
            }
            catch (UserDoesNotExistException)
            {
                opResult.Result = GlobalStrings.UserDoesNotExists;
            }
            catch (Exception)
            {
                opResult.Result = GlobalStrings.SomethingWentWrong;
            }

            return Json(opResult);
        }
Ejemplo n.º 8
0
        public JsonResult Update(int row, int col, Guid value)
        {
            var result = new JsonOperationModel(false, String.Empty);

            try
            {
                this.Service.UpdateScheduleCell(this.SecurityToken, row, col, value);
                var user = this.Service.GetUser(this.SecurityToken, value);
                var message = String.Format(GlobalStrings.SuccessfullyUpdatedSchedule, user.FullName());
                result.IsSucceeded = true;
                result.Result = message;
            }
            catch (ForbiddenException)
            {
                result.Result = GlobalStrings.Forbidden;
            }
            catch (ArgumentException)
            {
                result.Result = GlobalStrings.IncorrectData;
            }
            catch (UserDoesNotExistException)
            {
                result.Result = GlobalStrings.UserDoesNotExists;
            }
            catch (Exception)
            {
                result.Result = GlobalStrings.SomethingWentWrong;
            }
            
            return Json(result);
        }
        public JsonResult UpdateUserCaseAssignment(Guid userId, string value)
        {
            var opResult = new JsonOperationModel(false, String.Empty);

            try
            {
                var caseIds = GetCasesIds(value);
                this.Service.UpdateUserAssigments(this.SecurityToken, userId, caseIds);

                opResult.Result = GlobalStrings.AssignmentSuccessfullyChanged;
                opResult.IsSucceeded = true;
            }
            catch (ForbiddenException)
            {
                opResult.Result = GlobalStrings.Forbidden;
            }
            catch (UserDoesNotExistException)
            {
                opResult.Result = GlobalStrings.UserDoesNotExists;
            }
            catch (Exception)
            {
                opResult.Result = GlobalStrings.SomethingWentWrong;
            }

            return Json(opResult);
        }
        private JsonResult TryAddPartiesComment(int id, string text)
        {
            var result = new JsonOperationModel(false, GlobalStrings.CanNotAddComment);

            try
            {
                this.Service.AddPartiesComment(this.SecurityToken, id, text, new NewDocument[0]);
                result.IsSucceeded = true;
                return Json(result);
            }
            catch (Exception)
            {
                return Json(result);
            }
        }