Exemple #1
0
        /// <summary>
        /// 归还任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbnRestore_Click(object sender, EventArgs e)
        {
            try
            {
                String       l_strWorkItemID   = (sender as LinkButton).CommandName;
                String       l_strTemplateName = (sender as LinkButton).CommandArgument;
                AgilePointWF ag = new AgilePointWF();

                WorkflowService l_objWorkFlowService = ag.GetAPI();

                FSWFManualWorkItem l_objManaulWorkItem = ag.GetWorkItem(l_strWorkItemID);
                if (l_objManaulWorkItem.Status == ProcessConstString.StepStatus.STATUS_ASSIGNED && String.Compare(CurrentUserInfo.UserName, l_objManaulWorkItem.UserID, true) == 0)
                {
                    l_objWorkFlowService.UndoAssignWorkItem(l_strWorkItemID);
                    System.Threading.Thread.Sleep(500);

                    String l_strTableName = TableName.GetWorkItemsTableName(l_strTemplateName);
                    String sql            = String.Format(";UPDATE {0} SET D_StepStatus='{1}' WHERE CommonID ='{2}'", l_strTableName, ProcessConstString.StepStatus.STATUS_NEW, l_objManaulWorkItem.PoolID);
                    int    ret            = FounderSoftware.Framework.Business.Entity.RunNoQuery(sql);
                    if (ret > 0)
                    {
                        LoadTaskList();
                    }
                }
                else
                {
                    IMessage im = new WebFormMessage(Page, String.Format("这个任务已经被'{0}'接收了。", l_objManaulWorkItem.UserID));
                    im.Show();
                    LoadTaskList();
                }
            }
            catch (Exception ex)
            {
                IMessage im = new WebFormMessage(Page, ex.ToString());
                im.Show();
            }
        }
        /// <summary>
        /// 获取任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbnRetrieve_Click(object sender, EventArgs e)
        {
            try
            {
                String l_strWorkItemID = (sender as LinkButton).CommandName;
                String l_strTemplateName = (sender as LinkButton).CommandArgument;

                AgilePointWF ag = new AgilePointWF();

                WorkflowService l_objWorkFlowService = ag.GetAPI();

                FSWFManualWorkItem l_objManaulWorkItem = ag.GetWorkItem(l_strWorkItemID);

                if (l_objManaulWorkItem.Status == ProcessConstString.StepStatus.STATUS_NEW)
                {
                    l_objWorkFlowService.AssignWorkItem(l_strWorkItemID);
                    System.Threading.Thread.Sleep(500);

                    String sqlAP = String.Format("SELECT WORK_ITEM_ID FROM WF_MANUAL_WORKITEMS WHERE POOL_ID='{0}'", l_objManaulWorkItem.PoolID);
                    DataTable l_dtbDataTable = SQLHelper.GetDataTable2(sqlAP);
                    String l_strOthersWorkItemID = String.Empty;
                    String l_strOwnWorkItemID = String.Empty;
                    for (int i = 0; i < l_dtbDataTable.Rows.Count; i++)
                    {
                        if (i != 0)
                        {
                            l_strOthersWorkItemID += ",";
                        }
                        l_strOthersWorkItemID += "'" + l_dtbDataTable.Rows[i]["WORK_ITEM_ID"].ToString() + "'";

                        if (l_objManaulWorkItem.WorkItemID != l_dtbDataTable.Rows[i]["WORK_ITEM_ID"].ToString())
                        {
                            if (l_strOwnWorkItemID != "")
                            {
                                l_strOwnWorkItemID += ",";
                            }
                            l_strOwnWorkItemID += "'" + l_dtbDataTable.Rows[i]["WORK_ITEM_ID"].ToString() + "'";
                        }
                    }

                    //获得表名
                    String l_strTableName = TableName.GetWorkItemsTableName(l_strTemplateName);

                    String l_strExpression = String.Format("UPDATE {0} SET Is_Common=1 WHERE WorkItemID IN ({2})", l_strTableName, l_objManaulWorkItem.PoolID, l_strOthersWorkItemID);

                    if (l_strOwnWorkItemID != "")
                    {
                        l_strExpression += String.Format(";UPDATE {0} SET D_StepStatus='{1}' WHERE WorkItemID in ({2})", l_strTableName, ProcessConstString.StepStatus.STATUS_REMOVED, l_strOwnWorkItemID);
                    }
                    l_strExpression += String.Format(";UPDATE {0} SET D_StepStatus='{1}' WHERE WorkItemID ='{2}'", l_strTableName, ProcessConstString.StepStatus.STATUS_ASSIGNED, l_objManaulWorkItem.WorkItemID);

                    int ret = FounderSoftware.Framework.Business.Entity.RunNoQuery(l_strExpression);
                    if (ret > 0)
                    {
                        LoadTaskList();
                    }
                }
                else
                {
                    IMessage im = new WebFormMessage(Page, String.Format("这个任务已经被'{0}'接收了。", l_objManaulWorkItem.UserID));
                    im.Show();

                    LoadTaskList();
                }
            }
            catch (Exception ex)
            {
                IMessage im = new WebFormMessage(Page, ex.ToString());
                im.Show();
            }
        }
Exemple #3
0
        /// <summary>
        /// 获取任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbnRetrieve_Click(object sender, EventArgs e)
        {
            try
            {
                String l_strWorkItemID   = (sender as LinkButton).CommandName;
                String l_strTemplateName = (sender as LinkButton).CommandArgument;

                AgilePointWF ag = new AgilePointWF();

                WorkflowService l_objWorkFlowService = ag.GetAPI();

                FSWFManualWorkItem l_objManaulWorkItem = ag.GetWorkItem(l_strWorkItemID);

                if (l_objManaulWorkItem.Status == ProcessConstString.StepStatus.STATUS_NEW)
                {
                    l_objWorkFlowService.AssignWorkItem(l_strWorkItemID);
                    System.Threading.Thread.Sleep(500);

                    String    sqlAP                 = String.Format("SELECT WORK_ITEM_ID FROM WF_MANUAL_WORKITEMS WHERE POOL_ID='{0}'", l_objManaulWorkItem.PoolID);
                    DataTable l_dtbDataTable        = SQLHelper.GetDataTable2(sqlAP);
                    String    l_strOthersWorkItemID = String.Empty;
                    String    l_strOwnWorkItemID    = String.Empty;
                    for (int i = 0; i < l_dtbDataTable.Rows.Count; i++)
                    {
                        if (i != 0)
                        {
                            l_strOthersWorkItemID += ",";
                        }
                        l_strOthersWorkItemID += "'" + l_dtbDataTable.Rows[i]["WORK_ITEM_ID"].ToString() + "'";

                        if (l_objManaulWorkItem.WorkItemID != l_dtbDataTable.Rows[i]["WORK_ITEM_ID"].ToString())
                        {
                            if (l_strOwnWorkItemID != "")
                            {
                                l_strOwnWorkItemID += ",";
                            }
                            l_strOwnWorkItemID += "'" + l_dtbDataTable.Rows[i]["WORK_ITEM_ID"].ToString() + "'";
                        }
                    }

                    //获得表名
                    String l_strTableName = TableName.GetWorkItemsTableName(l_strTemplateName);

                    String l_strExpression = String.Format("UPDATE {0} SET Is_Common=1 WHERE WorkItemID IN ({2})", l_strTableName, l_objManaulWorkItem.PoolID, l_strOthersWorkItemID);

                    if (l_strOwnWorkItemID != "")
                    {
                        l_strExpression += String.Format(";UPDATE {0} SET D_StepStatus='{1}' WHERE WorkItemID in ({2})", l_strTableName, ProcessConstString.StepStatus.STATUS_REMOVED, l_strOwnWorkItemID);
                    }
                    l_strExpression += String.Format(";UPDATE {0} SET D_StepStatus='{1}' WHERE WorkItemID ='{2}'", l_strTableName, ProcessConstString.StepStatus.STATUS_ASSIGNED, l_objManaulWorkItem.WorkItemID);

                    int ret = FounderSoftware.Framework.Business.Entity.RunNoQuery(l_strExpression);
                    if (ret > 0)
                    {
                        LoadTaskList();
                    }
                }
                else
                {
                    IMessage im = new WebFormMessage(Page, String.Format("这个任务已经被'{0}'接收了。", l_objManaulWorkItem.UserID));
                    im.Show();

                    LoadTaskList();
                }
            }
            catch (Exception ex)
            {
                IMessage im = new WebFormMessage(Page, ex.ToString());
                im.Show();
            }
        }
        /// <summary>
        /// 归还任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbnRestore_Click(object sender, EventArgs e)
        {
            try
            {
                String l_strWorkItemID = (sender as LinkButton).CommandName;
                String l_strTemplateName = (sender as LinkButton).CommandArgument;
                AgilePointWF ag = new AgilePointWF();

                WorkflowService l_objWorkFlowService = ag.GetAPI();

                FSWFManualWorkItem l_objManaulWorkItem = ag.GetWorkItem(l_strWorkItemID);
                if (l_objManaulWorkItem.Status == ProcessConstString.StepStatus.STATUS_ASSIGNED && String.Compare(CurrentUserInfo.UserName, l_objManaulWorkItem.UserID, true) == 0)
                {
                    l_objWorkFlowService.UndoAssignWorkItem(l_strWorkItemID);
                    System.Threading.Thread.Sleep(500);

                    String l_strTableName = TableName.GetWorkItemsTableName(l_strTemplateName);
                    String sql = String.Format(";UPDATE {0} SET D_StepStatus='{1}' WHERE CommonID ='{2}'", l_strTableName, ProcessConstString.StepStatus.STATUS_NEW, l_objManaulWorkItem.PoolID);
                    int ret = FounderSoftware.Framework.Business.Entity.RunNoQuery(sql);
                    if (ret > 0)
                    {
                        LoadTaskList();
                    }
                }
                else
                {
                    IMessage im = new WebFormMessage(Page, String.Format("这个任务已经被'{0}'接收了。", l_objManaulWorkItem.UserID));
                    im.Show();
                    LoadTaskList();
                }
            }
            catch (Exception ex)
            {
                IMessage im = new WebFormMessage(Page, ex.ToString());
                im.Show();
            }
        }