Beispiel #1
0
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att        = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log);
                var attContent = Convert.ToBase64String(att.Content);
                var userList   = args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId);

                var skribble = new SkribbleHelper(_log, Configuration.ApiConfig);
                var response = skribble.SendEnvelope(attContent, GenerateRequestModel(), PrepareUsers(userList));

                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFildId, response.document_id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.EnvelopeFildId, response.id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);

                SaveUrlForUsers(userList, response);
            }
            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());
            }
        }
Beispiel #2
0
 public override void Run(RunCustomActionParams args)
 {
     try
     {
         var status = args.Context.CurrentDocument.GetFieldValue(Configuration.StatusFielId)?.ToString();
         if (!string.IsNullOrEmpty(status) && status.Equals(Statuses.Open))
         {
             var userList = args.Context.CurrentDocument.ItemsLists.GetByID(Configuration.Users.SignersList.ItemListId);
             var guid     = args.Context.CurrentDocument.GetFieldValue(Configuration.EnvelopeFielId)?.ToString();
             var skribble = new SkribbleHelper(_log, Configuration.ApiConfig);
             var newDocId = skribble.SendReminder(guid, Configuration.Message, PrepareUsers(userList));
             args.Context.CurrentDocument.SetFieldValue(Configuration.GuidFielId, newDocId);
         }
     }
     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());
     }
 }
        public override void Run(RunCustomActionParams args)
        {
            try
            {
                var att        = AttachmentHelper.GetAttachment(args.Context, Configuration.AttConfig, _log);
                var attContent = Convert.ToBase64String(att.Content);
                var response   = new SkribbleHelper(_log, Configuration.ApiConfig).SendEnvelope(attContent, GenerateRequestModel(), PrepareUser());

                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFildId, response.document_id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.EnvelopeFildId, response.id);
                args.Context.CurrentDocument.SetFieldValue(Configuration.AttConfig.AttTechnicalFieldID, att.ID);

                args.TransitionInfo.RedirectUrl($"{response.signing_url}?exitURL={Configuration.RedirectUrl}");
            }
            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());
            }
        }
Beispiel #4
0
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var status = args.Context.CurrentDocument.GetFieldValue(Configuration.StatusFielId)?.ToString();
                if (!string.IsNullOrEmpty(status) && status.Equals(Models.Statuses.Signed))
                {
                    var docGuid  = args.Context.CurrentDocument.GetFieldValue(Configuration.GuidIdFielId).ToString();
                    var response = new SkribbleHelper(log, Configuration.ApiConfig).GetDocumentContent(docGuid);
                    SaveAtt(args.Context.CurrentDocument, response);
                }
                else
                {
                    args.HasErrors = true;
                    args.Message   = "Document cannot be a saved if it is not signed";
                }
            }
            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());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var envelopeId = args.Context.CurrentDocument.GetFieldValue(Configuration.EnvelopeFielId).ToString();
                var skribble   = new SkribbleHelper(log, Configuration.ApiConfig);
                if (Configuration.DeleteOperationType)
                {
                    skribble.DeleteRequest(envelopeId);
                }
                else
                {
                    skribble.DeclineSigRequest(envelopeId, Configuration.Message);
                }
            }
            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());
            }
        }
        public override void Run(RunCustomActionParams args)
        {
            var log = new StringBuilder();

            try
            {
                var envelopeId = args.Context.CurrentDocument.GetFieldValue(Configuration.RequestParams.EnvelopeIdFielId)?.ToString();
                var response   = new SkribbleHelper(log, Configuration.ApiConfig).CheckDocumentStatus(envelopeId);

                if (response.status_overall.Equals(Models.Statuses.Signed))
                {
                    args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.GuidFielId, response.document_id);
                }

                args.Context.CurrentDocument.SetFieldValue(Configuration.ResponseParams.StatusFieldId, response.status_overall);
            }
            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());
            }
        }
        public override void RunWithoutDocumentContext(RunCustomActionWithoutContextParams args)
        {
            var log = new StringBuilder();

            try
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                var response = new SkribbleHelper(log, Configuration.ApiConfig).ChecAllkDocumentStatus();

                log.AppendLine($"API returned {response.Count()} envelopes");

                var sqlQuery = $"SELECT WFD_ID, {Configuration.Workflow.OperationFieldName} " +
                               $"from WFElements where WFD_STPID = {Configuration.Workflow.StepId}";

                var dt = SqlExecutionHelper.GetDataTableForSqlCommandOutsideTransaction(sqlQuery);
                CheckSignStatus(dt, response, sw);
            }
            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());
            }
        }