コード例 #1
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.ApiConfig.StatusFildId)?.ToString();
                if (!string.IsNullOrEmpty(status) && !status.Equals(Models.Statuses.Signed, StringComparison.InvariantCultureIgnoreCase))
                {
                    var docId       = args.Context.CurrentDocument.GetFieldValue(Configuration.ApiConfig.OperationFildId)?.ToString();
                    var api         = new AdobeSignHelper(log);
                    var membersInfo = api.GetMembersIds(docId, Configuration.ApiConfig.TokenValue);
                    var users       = GetUsers(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId), membersInfo.ToList());
                    api.SendRemind(docId, Configuration.ApiConfig.TokenValue, users);
                }
                else
                {
                    args.HasErrors = true;
                    args.Message   = "The document has already been 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());
            }
        }
コード例 #2
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var att = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, log);
                if (att == null)
                {
                    throw new Exception("No attachment to signature");
                }

                var api         = new AdobeSignHelper(log);
                var docId       = api.SendDocument(att.Content, Configuration.ApiConfig.TokenValue, $"{att.FileName}.{att.FileExtension}");
                var operationId = api.SendToSig(docId, Configuration.ApiConfig.TokenValue, Configuration.MessageContent.MailSubject, Configuration.MessageContent.MailBody, GetMembersInfo(args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId)));

                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AgreementsIdFild, operationId);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);
            }
            catch (Exception e)
            {
                log.AppendLine(e.ToString());
                args.HasErrors = true;
                args.Message   = e.Message;
            }
            finally
            {
                args.LogMessage = log.ToString();
                args.Context.PluginLogger.AppendInfo(log.ToString());
            }
        }
コード例 #3
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.InputParams.StatusFieldId)?.ToString();
                if (!string.IsNullOrEmpty(status) && status.Equals(Models.Statuses.Signed, StringComparison.InvariantCultureIgnoreCase))
                {
                    var docId   = args.Context.CurrentDocument.GetFieldValue(Configuration.InputParams.OperationFieldId)?.ToString();
                    var api     = new AdobeSignHelper(log);
                    var content = api.GetDocument(docId, Configuration.ApiConfig.TokenValue);
                    SaveAtt(args.Context.CurrentDocument, content);
                }
                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());
            }
        }
コード例 #4
0
        private string CallAdobeApi(AttachmentData att, DocumentData currentDocument)
        {
            var api          = new AdobeSignHelper(_log);
            var documentId   = api.SendDocument(att.Content, Configuration.ApiConfig.TokenValue, $"{att.FileName}.{att.FileExtension}");
            var agreementsId = api.SendToSig(documentId, Configuration.ApiConfig.TokenValue, Configuration.MessageContent.MailSubject, Configuration.MessageContent.MailBody, GetMemberInfo(), true, Configuration.RedirectUrl);

            currentDocument.SetFieldValue(Configuration.AttConfig.AgreementsIdFild, agreementsId);
            currentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);

            return(api.GetSigningURL(Configuration.ApiConfig.TokenValue, agreementsId));
        }
コード例 #5
0
        public override void RunWithoutDocumentContext(RunCustomActionWithoutContextParams args)
        {
            var log = new StringBuilder();

            try
            {
                var api        = new AdobeSignHelper(log);
                var agreements = api.GetAllStatus(Configuration.TokenValue);
                CheckAndMoveElements(agreements.userAgreementList?.ToList());
            }
            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());
            }
        }
コード例 #6
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var operationId = args.Context.CurrentDocument.GetFieldValue(Configuration.OperationFildId)?.ToString();
                var api         = new AdobeSignHelper(log);
                api.DeleteAgreement(operationId, Configuration.TokenValue);
            }
            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());
            }
        }