Пример #1
0
        public string Withdraw()
        {
            string withdrawtaskid  = Request.Querys("withdrawtaskid");
            string withdrawgroupid = Request.Querys("withdrawgroupid");

            if (!withdrawgroupid.IsGuid(out Guid groupId) || !withdrawtaskid.IsGuid(out Guid taskId))
            {
                return("任务Id错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var groupTasks             = flowTask.GetListByGroupId(groupId);
            var tasks = groupTasks.FindAll(p => p.PrevId == taskId && p.Status == 0);
            List <Model.FlowTask> removeTasks = new List <Model.FlowTask>();

            foreach (var task in tasks)
            {
                removeTasks.Add(task);
            }
            List <Model.FlowTask> updateTasks = new List <Model.FlowTask>();
            var currentTask = groupTasks.Find(p => p.Id == taskId);

            if (null == currentTask)
            {
                return("未找到当前任务!");
            }
            currentTask.Status         = 0;
            currentTask.ExecuteType    = 0;
            currentTask.Comments       = "";
            currentTask.IsSign         = 0;
            currentTask.CompletedTime1 = new DateTime?();
            updateTasks.Add(currentTask);
            flowTask.Update(removeTasks, updateTasks, null, null);
            return("收回成功!");
        }
Пример #2
0
        public string SaveStatus()
        {
            string status = Request.Forms("status");
            string taskId = Request.Querys("taskid");

            if (!taskId.IsGuid(out Guid guid))
            {
                return("任务ID错误!");
            }
            if (!status.IsInt(out int i))
            {
                return("状态错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var    taskModel           = flowTask.Get(guid);
            string oldModel            = taskModel.ToString();

            if (null == taskModel)
            {
                return("未找到当前任务!");
            }
            taskModel.ExecuteType = i;
            if (i < 2)
            {
                taskModel.Status = i;
            }
            else
            {
                taskModel.Status = 2;
            }
            flowTask.Update(taskModel);
            Business.Log.Add("改变了任务状态-" + taskModel.Title, "", Business.Log.Type.流程运行, oldModel, taskModel.ToString());
            return("保存成功!");
        }
Пример #3
0
        /// <summary>
        /// 收回委托事项
        /// </summary>
        /// <returns></returns>
        public string EntrustWithdrawTask()
        {
            string taskid = Request.Querys("taskid");

            if (!taskid.IsGuid(out Guid tid))
            {
                return("任务ID错误!");
            }
            Business.FlowTask flowTask = new Business.FlowTask();
            var taskModel = flowTask.Get(tid);

            if (null == taskModel)
            {
                return("未找到任务!");
            }
            if (!taskModel.EntrustUserId.HasValue)
            {
                return("该任务不是委托任务!");
            }
            taskModel.ReceiveId     = taskModel.EntrustUserId.Value;
            taskModel.ReceiveName   = new Business.User().GetName(taskModel.EntrustUserId.Value);
            taskModel.EntrustUserId = new Guid?();
            taskModel.Note          = "";
            flowTask.Update(taskModel);
            return("收回成功,请到待办事项中查看!");
        }