Exemple #1
0
        public JsonResult DeleteWorkflowaction(Workflowaction workflowaction)
        {
            var          isSuccess = true;
            var          message   = string.Empty;
            const string url       = "/Workflowaction/Index";

            permission = (RoleSubModuleItem)cacheProvider.Get(cacheKey) ?? roleSubModuleItemService.GetRoleSubModuleItemBySubModuleIdandRole(url,
                                                                                                                                             Helpers.UserSession.GetUserFromSession().RoleId);

            if (permission.DeleteOperation == true)
            {
                isSuccess = this.workflowactionService.DeleteWorkflowaction(workflowaction.Id);
                if (isSuccess)
                {
                    message = "Workflow action deleted successfully!";
                }
                else
                {
                    message = "Workflow action can't be deleted!";
                }
            }
            else
            {
                message = "You don't have permission to delete ";
            }


            return(Json(new
            {
                isSuccess = isSuccess,
                message = message
            }, JsonRequestBehavior.AllowGet));
        }
        public bool UpdateWorkflowaction(Workflowaction workflowaction)
        {
            bool isSuccess = true;

            try
            {
                workflowactionRepository.Update(workflowaction);
                this.SaveRecord();
                //ServiceUtil<Workflowaction>.WriteActionLog(workflowaction.Id, ENUMOperation.UPDATE, workflowaction);
            }
            catch (Exception ex)
            {
                isSuccess = false;
                logger.Error("Error in updating Workflowaction", ex);
            }
            return(isSuccess);
        }
Exemple #3
0
        public JsonResult CreateWorkflowaction(Workflowaction workflowaction)
        {
            var          isSuccess = false;
            var          message   = string.Empty;
            var          isNew     = workflowaction.Id == 0 ? true : false;
            const string url       = "/Workflowaction/Index";

            permission = (RoleSubModuleItem)cacheProvider.Get(cacheKey) ??
                         roleSubModuleItemService.GetRoleSubModuleItemBySubModuleIdandRole(url, Helpers.UserSession.GetUserFromSession().RoleId);

            if (isNew)
            {
                if (permission.CreateOperation == true)
                {
                    if (!CheckIsExist(workflowaction))
                    {
                        if (this.workflowactionService.CreateWorkflowaction(workflowaction))
                        {
                            isSuccess = true;
                            message   = "Workflow action saved successfully!";
                        }
                        else
                        {
                            message = "Workflow action could not be saved!";
                        }
                    }
                    else
                    {
                        isSuccess = false;
                        message   = "Can't save. Same workflow action name found!";
                    }
                }
                else
                {
                    message = "You don't have permission to create";
                }
            }
            else
            {
                if (permission.UpdateOperation == true)
                {
                    if (this.workflowactionService.UpdateWorkflowaction(workflowaction))
                    {
                        isSuccess = true;
                        message   = "Workflow action updated successfully!";
                    }
                    else
                    {
                        message = "Workflow action could not be updated!";
                    }
                }
                else
                {
                    message = "You don't have permission to update";
                }
            }

            return(Json(new
            {
                isSuccess = isSuccess,
                message = message,
            }, JsonRequestBehavior.AllowGet));
        }
 public bool CheckIsExist(Workflowaction workflowaction)
 {
     return(false);
     //return workflowactionRepository.Get(chk => chk.Name == workflowaction.Name) == null ? false : true;
 }