protected override void Execute(NativeActivityContext context)
        {
            const string isnullerrorformat = "Свойство '{0}' должно быть задано.";

            _context = context;

            var workerId = WorkerId.Get(context);

            if (!workerId.HasValue)
            {
                throw new DeveloperException(isnullerrorformat, WorkingIdPropertyName);
            }

            string filter             = null;
            var    excludedOperations = ExcludedOperations.Get(context);

            if (!string.IsNullOrEmpty(excludedOperations))
            {
                var ops = excludedOperations.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (ops.Length > 0)
                {
                    filter = string.Format(" and w.operationcode_r not in ({0})",
                                           string.Join(",", ops.Select(p => string.Format("'{0}'", p))));
                }
            }

            var workhelper = new WorkHelper();
            var result     = workhelper.ClosingWorking(workerId: workerId.Value, filter: filter, dialogTitle: "Подтверждение",
                                                       workername: WorkerFullName.Get(context),
                                                       dialogMessageHandler: ActivityHelpers.ClosingWorkingDialogMessage,
                                                       dialogWorkerDateTillHandler: ShowDialogWorkerDateTill, fontSize: FontSize.Get(context));

            Result.Set(context, result);
        }
        private DateTime?ShowDialogWorkerDateTill()
        {
            const string dateTillPropertyName = "Value";

            var wfDialogWorkerDateTill = WfDialogWorkerDateTill.Get(_context);

            if (string.IsNullOrEmpty(wfDialogWorkerDateTill))
            {
                return(null);
            }

            var             workflowXaml = GetWorkflowXaml(wfDialogWorkerDateTill);
            DynamicActivity activity;

            using (var reader = new StringReader(workflowXaml))
                activity = (DynamicActivity)ActivityXamlServices.Load(reader);

            var bpContext = new BpContext();

            bpContext.Set("WorkerFullName", WorkerFullName.Get(_context));
            var inputs = new Dictionary <string, object> {
                { BpContext.BpContextArgumentName, bpContext }
            };

            WorkflowInvoker.Invoke(activity, inputs);

            if (inputs.ContainsKey(BpContext.BpContextArgumentName))
            {
                var bpCntx = inputs[BpContext.BpContextArgumentName] as BpContext;
                if (bpCntx != null && bpCntx.Properties.ContainsKey(dateTillPropertyName))
                {
                    return(bpCntx.Get <DateTime?>(dateTillPropertyName));
                }
            }

            return(null);
        }