public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.StatusFildId)?.ToString();
                if (!string.IsNullOrEmpty(status) && status.Equals(SuccessStatus, StringComparison.InvariantCultureIgnoreCase))
                {
                    var docId           = args.Context.CurrentDocument.GetFieldValue(Configuration.DokFildId)?.ToString();
                    var api             = new AutentiHelper(log);
                    var responseContent = api.GetDocument(Configuration.ApiConfig.TokenValue, docId);
                    SaveAtt(args.Context.CurrentDocument, responseContent);
                }
                else
                {
                    args.HasErrors = true;
                    args.Message   = "Document cannot be a saved if it is not signed";
                }
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
Exemplo n.º 2
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var docId  = args.Context.CurrentDocument.GetFieldValue(Configuration.DokFildId)?.ToString();
                var status = new AutentiHelper(log).GetDocumentStatus(Configuration.ApiConfig.TokenValue, docId);

                args.Context.CurrentDocument.SetFieldValue(Configuration.StatusFildId, status);
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att   = GetAttachment(args.Context);
                var users = PrepareUsersToSign(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId));
                var api   = new AutentiHelper(_log);
                var docId = api.SendEnvelope(Configuration, users, att);

                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.DokumentIdFild, docId);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);
            }
            catch (Exception e)
            {
                args.HasErrors = true;
                args.Message   = e.Message;
                _log.AppendLine(e.ToString());
            }
            finally
            {
                args.LogMessage = _log.ToString();
                args.Context.PluginLogger.AppendInfo(_log.ToString());
            }
        }