Exemple #1
0
        private void SubmitToNextActivity(SystemMessages sysMsg, WFActivity nextActivity, params int[] toChildActivityId)
        {
            string strSql = String.Format("DELETE FROM SGP_CurrentUserTask WHERE TemplateID={0} AND EntityId={1}", this.ID, EntityID);
            DbHelperSQL.ExecuteSql(strSql);
            string extSql = "";

            if (nextActivity.ID == LastActivity.ID)
            {
                extSql = ",StatusID = 9";
            }
            else
            {
                if (nextActivity.ChildActivities.Count > 0)
                {
                    if (toChildActivityId != null && toChildActivityId.Length > 0)
                    {
                        for (int i = 0; i < toChildActivityId.Length; i++)
                        {
                            WFActivity ncta = nextActivity.MatchChildActivities.Get(toChildActivityId[i]);
                            if (ncta != null)
                            {
                                AddCurrentUserTask(ncta);
                            }
                        }
                    }
                    else
                    {
                        foreach (WFActivity nca in nextActivity.MatchChildActivities)
                        {
                            AddCurrentUserTask(nca);
                        }
                    }
                }
                else
                {
                    AddCurrentUserTask(nextActivity);
                }
            }

            if (nextActivity.ChildActivities.Count > 0)
            {
                if (toChildActivityId != null && toChildActivityId.Length > 0)
                {
                    for (int i = 0; i < toChildActivityId.Length; i++)
                    {

                        WFActivity ncta = nextActivity.MatchChildActivities.Get(toChildActivityId[i]);
                        if (ncta != null)
                        {
                            AddProcessLog(nextActivity.ID, ncta.ID, 4);
                        }
                    }
                }
                else
                {
                    foreach (WFActivity nca in nextActivity.MatchChildActivities)
                    {
                        AddProcessLog(nextActivity.ID, nca.ID, 4);
                    }
                }

                AddProcessLog(CurrentActivity == null ? 0 : CurrentActivity.ID, nextActivity.ID, 3);
            }
            else
            {
                AddProcessLog(CurrentActivity == null ? 0 : CurrentActivity.ID, nextActivity.ID, (CurrentActivity != null && CurrentActivity.ChildActivities.Count > 0) ? 1 : 0);
            }

            strSql = String.Format("UPDATE {0} SET ActivityID = @ActivityID, TemplateID = @TemplateID {2} WHERE {1} = @{1}", this.TableName, this.TableKey, extSql);
            DbHelperSQL.ExecuteSql(strSql, new SqlParameter[]{
                    new SqlParameter("@ActivityID", nextActivity.ID),
                    new SqlParameter("@TemplateID", this.ID),
                    new SqlParameter("@" + this.TableKey, this.EntityID)
                });

            this.FromActivity = CurrentActivity;
            this.ToActivity = nextActivity;
            _masterData = null;

            nextActivity.DoAction();
            foreach (WFActivity nca in nextActivity.MatchChildActivities)
            {
                nca.DoAction();
            }
        }
Exemple #2
0
        private void SubmitChildActivity(SystemMessages sysMsg, WFActivity fromActivity, WFActivity nextActivity)
        {
            string strUserSql = String.Format("DELETE FROM SGP_CurrentUserTask WHERE TemplateID={0} AND EntityId={1} AND ActivityID = {2}", this.ID, EntityID, fromActivity.ID);
            DbHelperSQL.ExecuteSql(strUserSql);

            AddProcessLog(fromActivity.ID, nextActivity.ID, 2);

            this.FromActivity = CurrentActivity;
            this.ToActivity = nextActivity;
            _masterData = null;

            fromActivity.DoAction();

            if (this.CurrentActivity.CurrentUserChildActivities.Contains(fromActivity))
            {
                this.CurrentActivity.CurrentUserChildActivities.Remove(fromActivity);
            }
        }