コード例 #1
0
 public int AddWorkFlow(Common.Models.WorkFlow workFlow)
 {
     Entities.Workflow WF = new Entities.Workflow
     {
         Id               = workFlow.Id,
         Version          = workFlow.Version,
         Name             = workFlow.Name,
         CreatedDate      = DateTime.Now,
         CreatedBy        = workFlow.CreatedBy.Id,
         IsActive         = workFlow.IsActive,
         WorkflowActivity = workFlow.Activities.Select(s =>
                                                       new Entities.WorkflowActivity
         {
             Id                    = s.Id,
             Type                  = s.Type.Id,
             Workflow              = s.Workflow,
             WorkflowVersion       = s.WorkflowVersion,
             Name                  = s.Name,
             ActivityOrderNumber   = s.ActivityOrderNumber,
             WorkflowActivityField = s.Fields.Select(f =>
                                                     new Entities.WorkflowActivityField
             {
                 Id       = f.Id,
                 Activity = f.Activity,
                 Type     = f.Type.Id,
                 Value    = f.Value
             }).ToList()
         }).ToList()
     };
     db.Workflow.Add(WF);
     db.SaveChanges();
     return(WF.Id);
 }
コード例 #2
0
        public int UpdateWorkFlow(Common.Models.WorkFlow workFlow)
        {
            Entities.Workflow WF = db.Workflow.FirstOrDefault(w => w.Id == workFlow.Id);

            WF.IsActive = workFlow.IsActive;

            db.Workflow.Update(WF);
            db.SaveChanges();
            return(WF.Id);
        }