Esempio n. 1
0
 private Workflow(string workflowId, IUnitOfData workflowSource)
     : this(workflowSource)
 {
     //Source = workflowSource;
     WorkflowDbContext dbContext = workflowSource as WorkflowDbContext;
     WF_WORKFLOW_INST  row       = dbContext.WF_WORKFLOW_INST.FirstOrDefault(a => a.WI_ID == workflowId);
     AtawDebug.AssertNotNull(row, "该流程已处理或异常,请进历史页面查看", this);
     WorkflowId  = row.WI_ID;
     WorkflowRow = row;
     Config      = WorkflowConfig.GetByName(row.WI_WD_NAME, workflowSource);
     //WorkflowConfig.ConnString =
     StepConfig stepConfig = Config.Steps[row.WI_CURRENT_STEP];
     if (stepConfig != null)
     {
         CurrentStep  = stepConfig.CreateStep(this);
         CurrentState = CurrentStep.GetState(row.WI_STATUS.Value <StepState>());
     }
     else
     {
         throw new AtawException("不存在的步骤" + row.WI_CURRENT_STEP, this);
     }
 }
Esempio n. 2
0
        public Workflow(IUnitOfData source, string name, RegNameList <KeyValueItem> parameter, string createUser,
                        int?parentId)
            : this(source)
        {
            //  Source = source;
            WorkflowDbContext dbContext = source as WorkflowDbContext;
            Config      = WorkflowConfig.GetByName(name, source);
            WorkflowRow = new WF_WORKFLOW_INST();
            //WorkflowRow.BeginEdit();
            WorkflowRow.WI_ID = dbContext.GetUniId();
            //WorkflowRow["WI_ID"] = id;
            WorkflowId                 = WorkflowRow.WI_ID;
            WorkflowRow.WI_WD_NAME     = name;
            WorkflowRow.WI_CREATE_USER = createUser;
            // WorkflowRow["WI_RETRIEVABLE"] = Config.Retrievable;
            ////初始化参与人列表
            WorkflowRow.WI_REF_LIST    = QuoteIdList.GetQuoteId(createUser);
            WorkflowRow.WI_CREATE_DATE = dbContext.Now;

            BeginStep step = Config.Steps.BeginStep.CreateStep(this) as BeginStep;
            step.Parameter = parameter;
            CurrentStep    = step;
            CurrentState   = BeginNRState.Instance;
        }