Пример #1
0
        private void tvTodolist_Item_Selected(object sender, RoutedEventArgs e)
        {
            dynamic  data     = sender;
            TodoWork todoWork = data.SelectedItem;

            if (btnEdit.IsChecked == true)
            {
                todoForm = new TodoForm(todoWork, todoList);
                todoForm.ShowDialog();
            }
            else
            {
                TodoTaskData todoTaskData = new TodoTaskData();
                if (todoWork.StatusId == 5)
                {
                    todoWork.StatusId = 1;
                    if (todoTaskData.CheckTodo(todoWork))
                    {
                        todoList.Add(todoWork);
                        doneList.Remove(todoWork);
                    }
                }
                else
                {
                    todoWork.StatusId = 5;
                    if (todoTaskData.CheckTodo(todoWork))
                    {
                        doneList.Add(todoWork);
                        todoList.Remove(todoWork);
                    }
                }
            }
        }
Пример #2
0
        public OAMQMessages BuildMessage(TodoWork todo)
        {
            OAMQMessages message = new OAMQMessages();

            message.Sender     = SystemNameByOA;
            message.Sendertime = WebHelper.DateTimeNow;
            if (todo.ProcessCode == string.Empty)
            {
                message.Flowtype = string.Empty;
            }
            else
            {
                message.Flowtype = WorkflowEngine.WorkflowService.ProcessNameList[todo.ProcessID];
            }
            message.FlowID            = todo.ProcessInstanceID.ToString();
            message.Title             = todo.InstanceName;
            message.Nodename          = todo.NodeName + ObjectHelper.EnumDescription((CommonConsts.NodeType)todo.NodeType);
            message.PtpUrl            = string.Format(FormUrl, todo.BizProcessID);
            message.Userid            = TodoWorkAdapter.Instance.GetLoginNameByUid(todo.UserID);
            message.CreatorName       = TodoWorkAdapter.Instance.GetLoginNameByUid(todo.CreateProcessUserID);
            message.CreateTime        = todo.CreateProcessTime;
            message.ModifierName      = TodoWorkAdapter.Instance.GetLoginNameByUid(todo.CreateProcessUserID);
            message.ModifyTime        = WebHelper.DateTimeNow;
            message.Operatetime       = todo.CreatedTime;
            message.Flowmess          = 1; //待办
            message.Viewtype          = 0; //未读
            message.Status            = 0;
            message.ErrorCount        = 0;
            message.MessageCreateTime = WebHelper.DateTimeNow;
            message.TodoType          = todo.TodoType;
            message.TodoID            = todo.ID;
            message.BizID             = todo.BizProcessID;
            return(message);
        }
Пример #3
0
        /// <summary>
        /// Thay đổi trạng thái todo work
        /// 1: Not Done
        /// 2: Early
        /// 3: Doing
        /// 4: Late
        /// 5: Done
        /// 6: Removed
        /// </summary>
        /// <param name="newTodo">StatusId, TaskId</param>
        /// <returns>Success: true</returns>
        public Boolean CheckTodo(TodoWork newTodo)
        {
            Boolean result = false;

            string        strConnection = DataProvider.DataProvider.getConnectionString();
            string        SQL           = "update Work set StatusId = @StatusId where TaskId = @TaskId";
            SqlConnection cnn           = new SqlConnection(strConnection);
            SqlCommand    cmd           = new SqlCommand(SQL, cnn);

            cmd.Parameters.AddWithValue("@StatusId", newTodo.StatusId);
            cmd.Parameters.AddWithValue("@TaskId", newTodo.TaskId);

            try
            {
                if (cnn.State == ConnectionState.Closed)
                {
                    cnn.Open();
                }

                result = cmd.ExecuteNonQuery() == 1;
            }
            catch (SqlException se)
            {
                result = false;
            }
            finally
            {
                cnn.Close();
            }

            return(result);
        }
        protected override void OnPreInit(EventArgs e)
        {
            string bid = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["bid"]))
            {
                bid = Request.QueryString["bid"];
            }

            if (!string.IsNullOrEmpty(Request.QueryString["uid"]))
            {
                int.TryParse(Request.QueryString["uid"], out uid);
            }
            ProcessInstance p = ProcessInstanceAdapter.Instance.LoadByBizProcessID(bid);

            _instance = new WorkflowInstance(p);
            List <TodoWork> td = _instance.TodoWorks;

            foreach (var item in td)
            {
                if (item.UserID == uid)
                {
                    _todoWork = item; break;
                }
            }
            base.OnPreInit(e);
        }
Пример #5
0
        /// <summary>
        /// Lấy ra tất cả các TodoWork để show lên
        /// </summary>
        /// <returns>List các TodoWork</returns>
        public List <TodoWork> GetAllTodoWorkForShow()
        {
            List <TodoWork> result = new List <TodoWork>();

            foreach (DataRow row in GetTodoTasks().Rows)
            {
                TodoWork todo = new TodoWork();
                Work     work = GetTodoWorkForShow(int.Parse(row["Id"].ToString()));

                Console.WriteLine(row["Id"].ToString());

                todo.TaskId      = int.Parse(row["Id"].ToString());
                todo.WorkId      = work.Id;
                todo.Title       = row["Title"].ToString();
                todo.Description = work.Description;
                todo.StatusId    = 1;
                if (work.DeadLine != null)
                {
                    todo.Deadline = work.DeadLine as dynamic;
                }
                if (work.AlertTime != null)
                {
                    todo.AlertTime = work.AlertTime as dynamic;
                }
                result.Add(todo);
            }

            return(result);
        }
Пример #6
0
 /// <summary>
 /// 关闭工作流待办
 /// </summary>
 /// <param name="todo"></param>
 public void CloseWorkflowTodo(TodoWork todo)
 {
     try
     {
         OAMQMessages msg = OAService.OAServiceInstance.BuildMessage(todo);
         using (TransactionScope trans = TransactionScopeFactory.Create())
         {
             //删除通知待办
             TodoWorkAdapter.Instance.Delete(todo.ID);
             bool sendMessage     = true;
             bool needDoneMessage = true;
             if (OAMessageExceptionList.ContainsKey(todo.ProcessCode.ToLower().Trim()))
             {
                 needDoneMessage = false;
                 if (OAMessageExceptionList[todo.ProcessCode.ToLower().Trim()].ToString() == todo.NodeType.ToString())
                 {
                     sendMessage = false;;
                 }
             }
             if (sendMessage)
             {
                 OAService.OAServiceInstance.CloseOATodo(msg, needDoneMessage);
             }
             trans.Complete();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #7
0
        /// <summary>
        /// 关闭通知类待办
        /// </summary>
        /// <param name="bizProcessID"></param>
        /// <param name="userID"></param>
        /// <param name="todoWorkID"></param>
        /// <param name="projectID"></param>
        public void CloseNotificationTodo(int bizProcessID, int userID, int todoWorkID, int projectID)
        {
            TodoWork todo = TodoWorkAdapter.Instance.Load(todoWorkID);

            if (todo == null)
            {
                throw new Exception("没有找到指定的待办。");
            }
            else if (todo.BizProcessID != bizProcessID || todo.ProjectID != projectID || todo.UserID != userID)
            {
                throw new Exception("用户无权限或该待办不存在。");
            }
            else if (todo.TodoType != (int)CommonConsts.TodoType.Notification)
            {
                throw new Exception("无法处理未知的待办类型。");
            }
            else
            {
                try
                {
                    OAMQMessages msg = OAService.OAServiceInstance.BuildMessage(todo);
                    using (TransactionScope trans = TransactionScopeFactory.Create())
                    {
                        //删除通知待办,暂不生成已办日志
                        TodoWorkAdapter.Instance.Delete(todo.ID);
                        OAService.OAServiceInstance.CloseOATodo(msg);
                        trans.Complete();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public void TodoWorkAdapterDeleteTest()
        {
            TodoWorkAdapter ta = new TodoWorkAdapter();
            TodoWork        t  = ta.GetModelByID("F2A5A00F-EA09-4974-8D48-EAAB9430807E");

            ta.Delete("10387189-2142-4572-9834-F05F04C0F931");
            ta.Delete(t);
        }
        public void TodoWorkAdapterUpdateTest()
        {
            TodoWorkAdapter ta = new TodoWorkAdapter();
            TodoWork        tw = ta.Load("201B8623-C22B-4339-9E3B-97C1B214680A");

            tw.UserName       = tw.UserName + "UDP";
            tw.Status         = 1000;
            tw.ModifyUserName = "******";
            tw.CreateTime     = tw.CreateTime.AddYears(10);
            ta.Update(tw);
        }
Пример #10
0
 public TodoForm(TodoWork todoWork, ObservableCollection <TodoWork> todoList)
 {
     InitializeComponent();
     setUpCbAlert();
     btnDelete.Visibility = Visibility.Visible;
     this.todoList        = todoList;
     this.todoWork        = todoWork;
     btnEdit.Content      = "Update";
     txtTitle.Text        = todoWork.Title;
     txtDescription.Text  = todoWork.Description;
     setTimeForm();
 }
Пример #11
0
        public Boolean SaveTodoTaskWithAlert(TodoWork todo)
        {
            Boolean result = false;

            string strConnection = DataProvider.DataProvider.getConnectionString();

            string SQL = "insert into Task (Title, TypeId) output Inserted.Id values (@Title, @TypeId)";

            SqlConnection cnn = new SqlConnection(strConnection);
            SqlCommand    cmd = new SqlCommand(SQL, cnn);

            cmd.Parameters.AddWithValue("@Title", todo.Title);
            cmd.Parameters.AddWithValue("@TypeId", WeekyTaskData.TYPE_TODO);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable      dt = new DataTable();

            try
            {
                if (cnn.State == ConnectionState.Closed)
                {
                    cnn.Open();
                }

                da.Fill(dt);

                int newId = int.Parse(dt.Rows[0]["Id"].ToString());

                string nSQL = "insert into Work (TaskId, Description, StartTime, Deadline, AlertTime, StatusId) values (@NewId, @Description, @StartTime, @Dealine, @AlertTime, @StatusId)";

                cmd = new SqlCommand(nSQL, cnn);

                cmd.Parameters.AddWithValue("@NewId", newId);
                cmd.Parameters.AddWithValue("@Description", todo.Description);
                cmd.Parameters.AddWithValue("@StartTime", DateTime.Now.ToString("yyyyMMdd"));
                cmd.Parameters.AddWithValue("@Dealine", todo.Deadline);
                cmd.Parameters.AddWithValue("@AlertTime", todo.AlertTime);
                cmd.Parameters.AddWithValue("@StatusId", WeekyTaskData.STATUS_NOT_DONE);

                result = cmd.ExecuteNonQuery() == 1;
            }
            catch (SqlException se)
            {
            }
            finally
            {
                cnn.Close();
            }

            return(result);
        }
Пример #12
0
        /// <summary>
        /// 创建通知类的待办
        /// </summary>
        /// <param name="bizProcessID">业务相关ID</param>
        /// <param name="todoTitle">待办标题</param>
        /// <param name="receiveUserID">接收用户ID</param>
        /// <param name="receiveUserName">接收用户姓名</param>
        /// <param name="receiveUserCode">接收用户代码</param>
        /// <param name="receivecUserID">接收用户cUserID</param>
        /// <param name="createUserID">创建者ID</param>
        /// <param name="createUserName">创建者姓名</param>
        /// <param name="createUserCode">创建者代码</param>
        /// <param name="createcUserID">创建者cUserID</param>
        public void CreateNotificationTodo(int bizProcessID, string todoTitle,
                                           int receiveUserID, string receiveUserName, string receiveUserCode, int receivecUserID,
                                           int createUserID, string createUserName, string createUserCode, int createcUserID, int projectID)
        {
            TodoWork todo = new TodoWork();

            todo.NodeType     = 0;
            todo.BizProcessID = bizProcessID;
            todo.InstanceName = todoTitle;
            //todo.NodeInstanceID = 0;
            todo.NodeInstanceID = 0;
            todo.NodeName       = "";
            //todo.ProcessID = 0;
            //todo.ProcessInstanceID = 0;
            //todo.PreviousNodeInstanceID = 0;
            todo.ProcessID              = 0;
            todo.ProcessInstanceID      = 0;
            todo.PreviousNodeInstanceID = 0;
            todo.ProcessCode            = "";
            todo.Status   = (int)CommonConsts.TodoStatus.Unread;
            todo.TodoType = (int)CommonConsts.TodoType.Notification;
            todo.cUserID  = receivecUserID;
            todo.UserCode = receiveUserCode;
            todo.UserID   = receiveUserID;
            todo.UserName = receiveUserName;

            todo.CreatedTime = WebHelper.DateTimeNow;
            todo.ModifyTime  = WebHelper.DateTimeNow;

            todo.CreateProcessTime = WebHelper.DateTimeNow;

            todo.CreateProcessUserName = createUserName;
            todo.ProjectID             = projectID;
            try
            {
                OAMQMessages msg = OAService.OAServiceInstance.BuildMessage(todo);
                using (TransactionScope trans = new TransactionScope())
                {
                    TodoWorkAdapter.Instance.Insert(todo);
                    OAService.OAServiceInstance.CreateOATodo(msg);
                    trans.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #13
0
        public Boolean UpdateTodoWithAlertTime(TodoWork newTodo)
        {
            Boolean result = false;

            string        strConnection = DataProvider.DataProvider.getConnectionString();
            string        SQL           = "update Task set Title = @Title where Id = @TaskId";
            SqlConnection cnn           = new SqlConnection(strConnection);
            SqlCommand    cmd           = new SqlCommand(SQL, cnn);

            cmd.Parameters.AddWithValue("@Title", newTodo.Title);
            cmd.Parameters.AddWithValue("@TaskId", newTodo.TaskId);

            try
            {
                if (cnn.State == ConnectionState.Closed)
                {
                    cnn.Open();
                }

                result = cmd.ExecuteNonQuery() > 0;

                string nSQL = "update Work set [Description] = @Description, Deadline = @Deadline, AlertTime = @AlertTime where TaskId = @TaskId";

                cmd = new SqlCommand(nSQL, cnn);

                cmd.Parameters.AddWithValue("@Description", newTodo.Description);
                cmd.Parameters.AddWithValue("@Deadline", newTodo.Deadline);
                cmd.Parameters.AddWithValue("@AlertTime", newTodo.AlertTime);
                cmd.Parameters.AddWithValue("@TaskId", newTodo.TaskId);

                result = cmd.ExecuteNonQuery() == 1;
            }
            catch (SqlException se)
            {
                result = false;
            }
            finally
            {
                cnn.Close();
            }

            return(result);
        }
Пример #14
0
        /// <summary>
        /// 标记OA中的待办为已读
        /// </summary>
        /// <param name="todo"></param>
        public void UpdateOATodoReaded(TodoWork todo)
        {
            if (NeedSendOAMessage == true)
            {
                OAMQMessages message = OAMQMessagesAdapter.Instance.LoadByProcessInstanceID(todo.ProcessInstanceID);

                if (message == null)
                {
                    message = BuildMessage(todo);
                    //message.ID = Guid.NewGuid().ToString();
                    message.Sendertime        = WebHelper.DateTimeNow;
                    message.Viewtype          = -2; //已读
                    message.Status            = 0;
                    message.ErrorCount        = 0;
                    message.MessageCreateTime = WebHelper.DateTimeNow;
                    OAMQMessagesAdapter.Instance.Insert(message);
                }
            }
        }
        public void TodoWorkAdapterInsertTest()
        {
            TodoWorkAdapter ta = new TodoWorkAdapter();
            TodoWork        tw = new TodoWork()
            {
                BizProcessID          = "Unit_test",
                CreatedTime           = DateTime.Now,
                CreateProcesscUserID  = "1",
                CreateProcessTime     = DateTime.Now,
                CreateProcessUserCode = "unit_test",
                CreateProcessUserID   = 1,
                CreateProcessUserName = "******",
                CreateTime            = DateTime.Now,
                CreatorName           = "unit_test",
                cUserID                = "0",
                ID                     = Guid.NewGuid().ToString(),
                InstanceName           = "UINT_TEST_INSTANCE",
                IsDeleted              = false,
                ModifycUserID          = "2",
                ModifyTime             = DateTime.Now,
                ModifyUserCode         = "test",
                ModifyUserID           = 2,
                ModifyUserName         = "******",
                NodeInstanceID         = "D225C0B8-ABAC-487C-BB76-553FBCFE83F6",
                NodeName               = "test_add",
                NodeType               = 1,
                PreviousNodeInstanceID = "8AE10C4B-F27B-4566-89DD-FF3ACC4A9EFF",
                ProcessCode            = "unit_test",
                ProcessID              = "71173453-63e0-4b56-9d0d-4314d05326d6",
                ProcessInstanceID      = "DD03D6D7-817E-4AEA-9B28-E0A732E98AbC",
                ProjectID              = "",
                Status                 = 0,
                TodoType               = 2,
                UserCode               = "test",
                UserID                 = 1,
                UserName               = "******"
            };

            ta.Insert(tw);
        }
Пример #16
0
        /// <summary>
        /// 构建待办
        /// </summary>
        /// <param name="todoType"></param>
        /// <param name="process"></param>
        /// <param name="nodeInstance"></param>
        /// <returns></returns>
        public static TodoWork BuildTodo(CommonConsts.TodoType todoType, ProcessInstance process, ProcessNodeInstance nodeInstance)
        {
            TodoWork todo = new TodoWork();

            todo.NodeType               = nodeInstance.NodeType;
            todo.BizProcessID           = nodeInstance.BizProcessID;
            todo.CreatedTime            = WebHelper.DateTimeNow;
            todo.ModifyTime             = WebHelper.DateTimeNow;
            todo.InstanceName           = process.InstanceName;
            todo.NodeInstanceID         = nodeInstance.ID;
            todo.NodeName               = nodeInstance.NodeName;
            todo.ProcessID              = nodeInstance.ProcessID;
            todo.ProcessInstanceID      = nodeInstance.ProcessInstanceID;
            todo.PreviousNodeInstanceID = nodeInstance.PreviousNodeInstanceID;
            todo.ProcessCode            = process.ProcessCode;
            todo.Status   = (int)CommonConsts.TodoStatus.Unread;
            todo.TodoType = (int)todoType;
            todo.cUserID  = nodeInstance.cUserID == 0 ? 0 : nodeInstance.cUserID;
            todo.UserCode = string.IsNullOrEmpty(nodeInstance.UserCode) ? "" : nodeInstance.UserCode;
            todo.UserID   = nodeInstance.UserID;
            todo.UserName = nodeInstance.UserName;


            todo.CreateProcessTime = process.CreateTime;

            todo.CreateProcessUserName = process.UserName;

            todo.CreateProcessUserID = process.UserID;
            todo.ProjectID           = process.ProjectID;
            //add czq
            todo.CreateTime   = WebHelper.DateTimeNow;
            todo.CreatorName  = WebHelper.GetCurrentUser().LoginName;
            todo.IsDeleted    = false;
            todo.ModifyTime   = WebHelper.DateTimeNow;
            todo.ModifierName = WebHelper.GetCurrentUser().LoginName;
            return(todo);
        }
Пример #17
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (!validInput())
            {
                return;
            }

            bool         check        = false;
            TodoTaskData todoTaskData = new TodoTaskData();

            if (btnEdit.Content.Equals("Add"))
            {
                TodoWork newTodoWork = new TodoWork()
                {
                    Title       = txtTitle.Text,
                    Description = txtDescription.Text
                };
                DateTime?deadline = GetDateTimeFromForm();
                if (deadline == null)
                {
                    check = todoTaskData.SaveTodoTask(newTodoWork);
                }
                else
                {
                    newTodoWork.Deadline = deadline as dynamic;
                    dynamic minute = (cbAlert.SelectedValue as dynamic).Value;
                    if (minute != null)
                    {
                        newTodoWork.AlertTime = newTodoWork.Deadline.AddMinutes(-1 * minute);
                        check = todoTaskData.SaveTodoTaskWithAlert(newTodoWork);
                    }
                    else
                    {
                        check = todoTaskData.SaveTodoTaskWithDealine(newTodoWork);
                    }
                }
                if (check)
                {
                    DataTable InsertId = todoTaskData.GetInsertTodoTaskId();
                    try
                    {
                        newTodoWork.TaskId = InsertId.Select()[0].ItemArray[0] as dynamic;
                    }
                    catch (Exception ex)
                    {
                    }
                    todoList.Add(newTodoWork);
                    this.Close();
                }
                else
                {
                    tbMessage.Text = "Add fail! Please try again";
                }
            }
            else
            {
                todoWork.Title       = txtTitle.Text;
                todoWork.Description = txtDescription.Text;
                DateTime?deadline = GetDateTimeFromForm();
                if (deadline == null)
                {
                    check = todoTaskData.UpdateTodo(todoWork);
                }
                else
                {
                    todoWork.Deadline = deadline as dynamic;
                    dynamic minute = (cbAlert.SelectedValue as dynamic).Value;
                    if (minute != null)
                    {
                        todoWork.AlertTime = todoWork.Deadline.AddMinutes(-1 * minute);
                        check = todoTaskData.UpdateTodoWithAlertTime(todoWork);
                    }
                    else
                    {
                        check = todoTaskData.UpdateTodoWithDeadline(todoWork);
                        todoWork.AlertTime = new DateTime();
                    }
                }
                if (check)
                {
                    CollectionViewSource.GetDefaultView(todoList).Refresh();
                    this.Close();
                }
                else
                {
                    tbMessage.Text = "Update fail! Please try again";
                }
            }
        }
Пример #18
0
        /// <summary>
        /// 更新节点使用
        /// </summary>
        /// <param name="bizID">BizProcessID</param>
        /// <param name="nodeID">NodeInstanceID</param>
        /// <param name="uid">UserID</param>
        /// <param name="userName">UserName</param>
        /// <returns></returns>
        public int UpdateNodeInstance(int bizID, int nodeID, int uid, string userName)
        {
            WorkflowInstance           instance         = WorkflowEngine.WorkflowService.GetWorkflowInstance(bizID);
            List <ProcessNodeInstance> nodeInstanceList = ProcessNodeInstanceAdapter.Instance.LoadList(instance.ProcessInstance.ID);
            ProcessNodeInstance        nodeInstance     = nodeInstanceList.Find(p => p.ID == nodeID);
            TodoWork todo   = null;
            int      result = 0;

            foreach (var item in instance.TodoWorks)
            {
                if (item.TodoType == (int)Wanda.Lib.LightWorkflow.CommonConsts.TodoType.TODO)
                {
                    todo = item;
                    using (TransactionScope trans = TransactionScopeFactory.Create())
                    {
                        //待办的处理方式:
                        //删除待办
                        WorkflowEngine.WorkflowService.CloseWorkflowTodo(todo);
                        //生成已办日志
                        ApprovalLog log = new ApprovalLog();
                        log.NodeType               = todo.NodeType;
                        log.ApprovalNote           = string.Format("{0}将节点更新至{1}", userName, nodeInstance.UserName);
                        log.BizProcessID           = todo.BizProcessID;
                        log.CompletedTime          = WebHelper.DateTimeNow;
                        log.CreatedTime            = todo.CreatedTime;
                        log.InstanceName           = todo.InstanceName;
                        log.NodeInstanceID         = todo.NodeInstanceID;//TODO:huwz
                        log.NodeName               = todo.NodeName;
                        log.OperationType          = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeOperationType.ChangeNode;
                        log.ProcessID              = todo.ProcessID;
                        log.ProcessInstanceID      = todo.ProcessInstanceID;
                        log.PreviousNodeInstanceID = todo.PreviousNodeInstanceID;
                        log.Status = 0;//保留字段
                        //log.cUserID = todo.cUserID;
                        //log.UserCode = todo.UserCode;
                        log.CreateTime  = WebHelper.DateTimeNow;
                        log.CreatorName = userName;
                        log.UserID      = todo.UserID;
                        log.UserName    = todo.UserName;
                        log.ID          = 0;

                        log.ModifyTime   = WebHelper.DateTimeNow;
                        log.ModifierName = userName;

                        ApprovalLogAdapter.Instance.Insert(log);

                        //计算下个节点,生成待办
                        TodoWork todoNew = WorkflowEngine.BuildTodo(Wanda.Lib.LightWorkflow.CommonConsts.TodoType.TODO, instance.ProcessInstance, nodeInstance);
                        WorkflowEngine.WorkflowService.CreateWorkflowTodo(todoNew);

                        //更新流程节点
                        int curSqu = -1;
                        foreach (var temp in nodeInstanceList)
                        {
                            if (temp.NodeSeq > nodeInstance.NodeSeq)
                            {
                                temp.Status = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeStatus.NotExecute;
                                ProcessNodeInstanceAdapter.Instance.Update(temp);
                                continue;
                            }

                            if (temp.NodeSeq < nodeInstance.NodeSeq)
                            {
                                temp.Status = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeStatus.Executed;
                                if (temp.ID == todo.NodeInstanceID)
                                {
                                    curSqu = temp.NodeSeq;
                                }
                                if (curSqu != -1 && temp.NodeSeq >= curSqu)
                                {
                                    temp.OperationType = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeOperationType.ChangeNode;
                                    ProcessNodeInstanceAdapter.Instance.Update(temp);
                                }
                            }
                            else
                            {
                                temp.Status        = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeStatus.Executing;
                                temp.OperationType = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeOperationType.ChangeNode;
                                ProcessNodeInstanceAdapter.Instance.Update(temp);
                            }
                        }
                        if (nodeInstance.NodeType == (int)CommonConsts.NodeType.Archive)
                        {
                            ProcessInstance p = instance.ProcessInstance;
                            p.Status = (int)CommonConsts.ProcessInstanceStatus.Archiving;
                            ProcessInstanceAdapter.Instance.Update(p);
                        }
                        //添加StakeHolder人员
                        StakeHolder holder = WorkflowEngine.BuildStakeHolder(nodeInstance);

                        StakeHolderAdapter.Instance.Insert(holder);
                        result = nodeID;
                        trans.Complete();
                    }
                    break;
                }
            }
            return(result);
        }
 public void TodoWorkAdapterLoadTest()
 {
     TodoWorkAdapter ta = new TodoWorkAdapter();
     TodoWork        t  = ta.Load("DD03D6D7-817E-4AEA-9B28-E0A732E98ADC", 1);
 }