/// <summary> /// SaveUserTask /// </summary> /// <param name="userTask"></param> public void SaveUserTask(UserTaskModel userTask) { UserTaskDC userTaskDC = Mapper.Map <UserTaskModel, UserTaskDC>(userTask); ServiceResponse <int> saveUserTaskServiceResponse = _workflowProxy.Execute(opt => opt.SaveUserTask(userTaskDC)); if (saveUserTaskServiceResponse.Status != ResponseStatus.Success) { HandleError(saveUserTaskServiceResponse.Status, saveUserTaskServiceResponse.ResponseMessage); } else { userTask.TaskId = saveUserTaskServiceResponse.Result; } }
/// <summary> /// GetUserTask /// </summary> /// <param name="userTaskId"></param> /// <returns></returns> public ServiceResponse <UserTaskDC> GetUserTask(int userTaskId) { ServiceResponse <UserTaskDC> getUserTaskServiceResponse = new ServiceResponse <UserTaskDC>(); try { SetContext(); UserTask userTask = _workflowManager.GetUserTask(userTaskId); UserTaskDC userTaskDC = Mapper.Map <UserTask, UserTaskDC>(userTask); userTaskDC.AssignedUserName = userTask.UserMembership != null ? userTask.UserMembership.UserName : null; userTaskDC.AssignedByUserName = userTask.UserMembership != null ? userTask.UserMembership.UserName : null; getUserTaskServiceResponse.Result = userTaskDC; } catch (Exception ex) { HandleError(ex, getUserTaskServiceResponse); } return(getUserTaskServiceResponse); }
/// <summary> /// GetUserTasks /// </summary> /// <param name="userTasksRequest"></param> /// <returns></returns> public ServiceResponse <List <UserTaskDC> > GetUserTasks(UserTasksRequestDC userTasksRequest) { ServiceResponse <List <UserTaskDC> > getUserTasksServiceResponse = new ServiceResponse <List <UserTaskDC> >(); try { SetContext(); List <UserTask> userTasks = _workflowManager.GetUserTasks((ContextEnum)userTasksRequest.ContextId, userTasksRequest.AssignedTo, userTasksRequest.FromDate, userTasksRequest.ToDate, userTasksRequest.ActiveTasks); getUserTasksServiceResponse.Result = new List <UserTaskDC>(); foreach (UserTask userTask in userTasks) { UserTaskDC userTaskDC = Mapper.Map <UserTask, UserTaskDC>(userTask); userTaskDC.AssignedUserName = userTask.UserMembership != null ? userTask.UserMembership.UserName : null; userTaskDC.AssignedByUserName = userTask.UserMembership != null ? userTask.UserMembership.UserName : null; getUserTasksServiceResponse.Result.Add(userTaskDC); } } catch (Exception ex) { HandleError(ex, getUserTasksServiceResponse); } return(getUserTasksServiceResponse); }
/// <summary> /// SaveUserTask /// </summary> /// <param name="userTask"></param> /// <returns></returns> public ServiceResponse <int> SaveUserTask(UserTaskDC userTask) { ServiceResponse <int> saveUserTaskServiceResponse = new ServiceResponse <int>(); try { SetContext(); UserTask userTaskModel = Mapper.Map <UserTaskDC, UserTask>(userTask); if (!string.IsNullOrEmpty(userTask.AssignedUserName)) { SecurityManager securityManager = new SecurityManager(); UserMembership user = securityManager.FindUser(userTask.AssignedUserName); userTask.AssignedUserId = user.UserId; } _workflowManager.SaveUserTask(userTaskModel); saveUserTaskServiceResponse.Result = userTask.TaskId; } catch (Exception ex) { HandleError(ex, saveUserTaskServiceResponse); } return(saveUserTaskServiceResponse); }