Beispiel #1
0
        private void RemoveTaskFromDataBase(NativeActivityContext context)
        {
            var taskId = UserTaskId.Get(context);
            var db     = context.GetExtension <Db>();
            var task   = db.UserTasks.Include(t => t.Buttons).First(t => t.Id == taskId);

            db.Buttons.RemoveRange(task.Buttons);
            db.UserTasks.Remove(task);
        }
Beispiel #2
0
        protected override void Execute(NativeActivityContext context)
        {
            var task = new UserTaskEntry()
            {
                Id             = Guid.NewGuid(),
                Caption        = Caption.Get(context),
                QueueName      = QueueName.Get(context),
                ViewName       = ViewName.Get(context),
                ViewInputModel = JsonConvert.SerializeObject(ViewInputModel.Get(context) ?? new object()
                                                             , Formatting.None
                                                             , new JsonSerializerSettings {
                    ContractResolver = new CamelCasePropertyNamesContractResolver(), DateFormatString = "dd.MM.yyyy"
                }),
                WWFId = context.WorkflowInstanceId
            };

            var db = context.GetExtension <Db>();

            db.UserTasks.Add(task);

            UserTaskId.Set(context, task.Id);

            context.ScheduleFunc(Wizard, task.Id, OnChildComplete);
        }