public void SetMainRowStatus(IUnitOfData context, StepConfig stepConfig)
        {
            WorkflowDbContext wfContent = context as WorkflowDbContext;
            string            sql       = "UPDATE {0} SET  " +
                                          " {1}_WF_STATUS = @WF_STATUS ,  " +
                                          " {1}_STEP_NAME = @STEP_NAME ,  " +
                                          " {1}_WF_TIME = @WF_TIME " +
                                          " WHERE FID = @FID";

            sql = string.Format(sql, MainTableName, Prefix);

            wfContent.RegisterSqlCommand(sql,
                                         new SqlParameter[] {
                new SqlParameter("@WF_STATUS", stepConfig.DisplayName)
                {
                    DbType = DbType.String
                },
                new SqlParameter("@STEP_NAME", stepConfig.Name)
                {
                    DbType = DbType.String
                },
                new SqlParameter("@WF_TIME", wfContent.Now)
                {
                    DbType = DbType.DateTime
                },
                new SqlParameter("@FID", FID)
                {
                    DbType = DbType.String
                },
            }
                                         );
        }
        public void EndMainRowStatus(WorkflowDbContext context, FinishType finishType)
        {
            string sql = "UPDATE {0} SET  " +
                         " {2}  " +
                         " {1}_WF_STATUS = @WF_STATUS , " +
                         " {1}_WF_IS_END = @WF_IS_END , " +
                         " {1}_WF_TIME = @WF_TIME " +
                         " WHERE FID = @FID";
            string statusSql              = Prefix + "_STEP_NAME = @STEP_NAME ,";
            List <SqlParameter> list      = new List <SqlParameter>();
            SqlParameter        statusPar = new SqlParameter("@WF_IS_END", (int)finishType);
            SqlParameter        fidParm   = new SqlParameter("@FID", FID)
            {
                DbType = DbType.String
            };
            SqlParameter wftimeParm = new SqlParameter("@WF_TIME", context.Now)
            {
                DbType = DbType.DateTime
            };

            list.Add(statusPar);
            list.Add(fidParm);
            list.Add(wftimeParm);
            string sql0 = string.Format(sql, MainTableName, Prefix, "");

            switch (finishType)
            {
            case FinishType.ReturnBegin:
                break;

            case FinishType.Abort:
                //fMainRow[prefix + "WF_STATUS"] = "终止";
                list.Add(new SqlParameter("@WF_STATUS", "终止"));
                //fMainRow[prefix + "STEP_NAME"] = "__abort";
                list.Add(new SqlParameter("@STEP_NAME", "__abort"));
                sql0 = string.Format(sql, MainTableName, Prefix, statusSql);
                break;

            case FinishType.OverTryTimes:
                //fMainRow[prefix + "WF_STATUS"] = "重试错误终止";
                list.Add(new SqlParameter("@WF_STATUS", "重试错误终止"));
                break;

            case FinishType.Error:
                // fMainRow[prefix + "WF_STATUS"] = "错误终止";
                list.Add(new SqlParameter("@WF_STATUS", "错误终止"));
                break;

            default:
                list.Add(new SqlParameter("@WF_STATUS", "结束"));
                break;
            }
            context.RegisterSqlCommand(sql0, list.ToArray());
        }
示例#3
0
        public override void Execute(WF_WORKFLOW_INST workflowRow)
        {
            // throw new NotImplementedException();
            if (UIData != null && UIData.Tables["WF_APPROVE_HISTORY"] != null)
            {
                var approveRow = UIData.Tables["WF_APPROVE_HISTORY"].Rows[0];

                var yes = approveRow["AH_APPROVE"].ToString();

                var note = approveRow["AH_NOTE"].ToString();

                WorkflowDbContext db = Source as WorkflowDbContext;
                SetApproveYes(yes.Value <bool>(), db);
                string sql = "INSERT INTO [WF_APPROVE_HISTORY] " +
                             "([AH_ID] " +
                             ",[AH_WORKFLOW_ID] " +
                             ",[AH_STEP_NAME] " +
                             ",[AH_STEP_DISPLAY_NAME] " +
                             ",[AH_OPERATOR] " +
                             " ,[AH_APPROVE] " +
                             " ,[AH_NOTE] " +
                             " ,[AH_CREATE_ID] " +
                             " ,[AH_CREATE_DATE]) " +
                             "VALUES(@AH_ID,@AH_WORKFLOW_ID,@AH_STEP_NAME,@AH_STEP_DISPLAY_NAME,@AH_OPERATOR,@AH_APPROVE,@AH_NOTE,@AH_CREATE_ID,@AH_CREATE_DATE) ";
                // "('" + db.GetUniId() + "' " +
                // ",'" + workflowRow.WI_ID + "' " +
                //" ,'" + workflowRow.WI_CURRENT_STEP + "' " +
                // ",'" + workflowRow.WI_CURRENT_STEP_NAME + "' " +
                //" ,'" + GlobalVariable.UserId.ToString() + "' " +
                //" ," + yes +
                //" ,'" + note + "' " +
                // " ,'" + GlobalVariable.UserId.ToString() + "' " +
                //" ,'" + db.Now.ToString() + "') ";

                List <SqlParameter> dblist = new List <SqlParameter>();

                dblist.Add(new SqlParameter("@AH_ID", db.GetUniId()));
                dblist.Add(new SqlParameter("@AH_WORKFLOW_ID", workflowRow.WI_ID));
                dblist.Add(new SqlParameter("@AH_STEP_NAME", workflowRow.WI_CURRENT_STEP));
                dblist.Add(new SqlParameter("@AH_STEP_DISPLAY_NAME", workflowRow.WI_CURRENT_STEP_NAME));
                dblist.Add(new SqlParameter("@AH_OPERATOR", GlobalVariable.UserId.ToString()));
                dblist.Add(new SqlParameter("@AH_APPROVE", yes));
                dblist.Add(new SqlParameter("@AH_NOTE", note));
                dblist.Add(new SqlParameter("@AH_CREATE_ID", GlobalVariable.UserId.ToString()));
                dblist.Add(new SqlParameter("@AH_CREATE_DATE", db.Now.ToString()));
                db.RegisterSqlCommand(sql, dblist.ToArray());

                workflowRow.WI_CUSTOM_DATA = yes;
            }
        }
        public void SetMainRowCreateID(IUnitOfData context, string userID)
        {
            WorkflowDbContext wfContent = context as WorkflowDbContext;
            string            sql       = "UPDATE {0} SET  " +
                                          " CREATE_ID = @USERID" +
                                          " WHERE FID = @FID";

            sql = string.Format(sql, MainTableName);

            wfContent.RegisterSqlCommand(sql,
                                         new SqlParameter[] {
                new SqlParameter("@USERID", userID)
                {
                    DbType = DbType.String
                },
                new SqlParameter("@FID", FID)
                {
                    DbType = DbType.String
                }
            }
                                         );
        }