Exemplo n.º 1
0
        public static string GetSerialisedString(string agreementID)
        {
            AgreementInfo agreementInfo = AdobeOperations.GetAgreementStatus(agreementID);
            string        ss            = SerializeXml <List <DocumentHistoryEvent> >(agreementInfo.events);

            return(ss);
        }
Exemplo n.º 2
0
        public static void UploadListItem()
        {
            using (SPSite spSite = new SPSite("http://leumtstspapp1/sites/staff/HR/"))
            {
                SPWeb      spWeb    = spSite.OpenWeb();
                SPList     spList   = spWeb.Lists["testWf"];
                SPListItem spItm    = spList.Items[0];
                string[]   arrApp   = new string[] { "*****@*****.**" };
                SPView     listView = spList.Views["MAT_ADOBE_SIGN_VIEW"];
                if (listView == null)
                {
                    throw new ApplicationException("The list does not contain the view by name  MAT_ADOBE_SIGN_VIEW");
                }

                SPViewFieldCollection viewfieldCollection = listView.ViewFields;
                StringBuilder         buff = new StringBuilder(16);
                buff.Append("Column Name : Column Value");
                foreach (string viewFieldName in viewfieldCollection)
                {
                    var val = spItm[viewFieldName];
                    buff.Append(string.Format("{0}:{1}", viewFieldName, val));
                    buff.Append(Environment.NewLine);
                    buff.Append(Environment.NewLine);
                }
                string miscInfo = "WEbUrl=" + spWeb.Url + "&listTitle=" + spList.Title + "&ItemId=" + spItm.ID;
                // now send it to signature
                AdobeOperations.SendDocumentByBytesForSigninig(Encoding.ASCII.GetBytes(buff.ToString()), null, spItm["ID"].ToString(), arrApp, null, miscInfo);
            }
        }
Exemplo n.º 3
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            ActivityActivationReference.IsAllowed(this, __Context.Web);
            // Get the workflow context for the workflow activity.
            NWWorkflowContext ctx = NWWorkflowContext.GetContext(__Context, new Guid(__ListId), __ListItem.Id, WorkflowInstanceId, this);

            base.LogProgressStart(ctx);

            string approverNames = ctx.AddContextDataToString(this.Approvers);
            string qryUrl        = ctx.AddContextDataToString(this.UrlMiscInfo);

            string[] approvers = Akki.AdobeSign.Common.Utilities.GetUserEmails(approverNames, ctx.Web.Url).ToArray();

            try
            {
                SPList     spList         = this.__Context.Web.Lists[new Guid(this.__ListId)];
                SPListItem spItm          = spList.GetItemById(this.__ListItem.Id);
                var        agreeementName = string.Format(Constants.MsgListItemAgreementName, spItm.ID, spList.Title);
                SPView     listView       = spList.Views[Constants.AkkiItemViewTypeAdobe];
                if (listView == null)
                {
                    throw new ApplicationException(Constants.ErrNoViewFound);
                }

                SPViewFieldCollection viewfieldCollection = listView.ViewFields;
                StringBuilder         buff = new StringBuilder(16);
                buff.Append(Constants.HeaderTextInfo);
                foreach (string viewFieldName in viewfieldCollection)
                {
                    buff.Append(Environment.NewLine);
                    buff.Append(Environment.NewLine);
                    var val = spItm[viewFieldName];
                    buff.Append(string.Format("{0}:{1}", viewFieldName, val));
                    buff.Append(Environment.NewLine);
                    buff.Append(Environment.NewLine);
                }

                var agreementId = AdobeOperations.SendDocumentByBytesForSigninig(Encoding.ASCII.GetBytes(buff.ToString()), null, agreeementName, approvers, null, qryUrl).agreementId;
                this.OutAdobeAgreementID = agreementId;

                // if no problem
                try
                {
                    Utilities.SetDefaultColValues(spItm, agreementId, AgreementStatus.OUT_FOR_SIGNATURE);
                }
                catch { }
            }
            catch (Exception ex)
            {
                //log.Error("[Execute]", ex);
                throw;
            }

            base.LogProgressEnd(ctx, executionContext);
            return(ActivityExecutionStatus.Closed);
        }
Exemplo n.º 4
0
        public static string RunV()
        {
            string intKey = "3AlqZhCJbhJb-AMG0scMN6gmef-dWM6gnGd3DQZcscF_YHPGIBOW9GaeJhaSHtoLqxASbGV1_Om8KXLC2acIZ1PwatLJ";
            var    client = "https://api.eu1.echosign.com/api/rest/v5";

            string[] arr = new string[] { "*****@*****.**", "*****@*****.**" };
            var      v   = AdobeOperations.SendDocumentForAgreemntByFilePath(@"E:\backup\TestingAkkiDoc.docx", null, "agg", arr, null, null).Result;
            var      ss  = v.agreementId;

            return(ss);
        }
Exemplo n.º 5
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            ActivityActivationReference.IsAllowed(this, __Context.Web);
            // Get the workflow context for the workflow activity.
            NWWorkflowContext ctx = NWWorkflowContext.GetContext(__Context, new Guid(__ListId), __ListItem.Id, WorkflowInstanceId, this);

            base.LogProgressStart(ctx);


            //BLOG. this function
            // get all the properties you need here
            string aggreementName = ctx.AddContextDataToString(this.AgreementName);
            string approversProp  = ctx.AddContextDataToString(this.Approvers);
            string qryUrl         = ctx.AddContextDataToString(this.UrlMiscInfo);
            string compDocsIds    = ctx.AddContextDataToString(this.CompendiumDocsID);

            try
            {
                SPList     spList = this.__Context.Web.Lists[new Guid(this.__ListId)];
                SPListItem spItm  = spList.GetItemById(this.__ListItem.Id);
                aggreementName = string.IsNullOrEmpty(aggreementName) ? spList.Title + "-" + spItm.ID + "-" + spItm.File.Name : aggreementName;

                List <string> lstApprovers = Akki.AdobeSign.Common.Utilities.GetUserEmails(approversProp, ctx.Web.Url);
                this.HistoryListMessage = "Initiator Email " + ctx.WorkflowInitiator.Email;
                // get the bytes for all the compendium documents
                List <byte[]> comDocBytes = null;
                if (!string.IsNullOrEmpty(compDocsIds))
                {
                    comDocBytes = new List <byte[]>();
                    var docsID = compDocsIds.Split(Constants.Delimiter);
                    foreach (var doc in docsID)
                    {
                        int docId        = int.Parse(doc);
                        var spItmCompDoc = spList.GetItemById(docId);
                        comDocBytes.Add(spItmCompDoc.File.OpenBinary());
                    }
                }
                var response = AdobeOperations.SendDocumentByBytesForAuthoring(spItm.File.OpenBinary(), comDocBytes, aggreementName, lstApprovers.ToArray(), ctx.WorkflowInitiator.Email, qryUrl);

                this.HistoryListMessage  = string.Format(Constants.MsgAgreemntID, response.agreementId);
                this.OutAdobeAgreementID = response.agreementId;
                this.OutAuthoringUrl     = response.url;
            }
            catch (Exception e)
            {
                //log.Error("[Execute]:", e);
                throw;
            }
            base.LogProgressEnd(ctx, executionContext);
            return(ActivityExecutionStatus.Closed);
        }
Exemplo n.º 6
0
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            try
            {
                ActivityActivationReference.IsAllowed(this, __Context.Web);
                // Get the workflow context for the workflow activity.
                NWWorkflowContext ctx = NWWorkflowContext.GetContext(__Context, new Guid(__ListId), __ListItem.Id, WorkflowInstanceId, this);
                base.LogProgressStart(ctx);

                //BLOG. this function ttps://community.nintex.com/docs/DOC-1673-list-of-nintex-workflowonpremise-custom-actions
                // get all the properties you need here
                string agreementID = ctx.AddContextDataToString(this.AgreementID);

                var destsiteUrl = ctx.AddContextDataToString(this.DestSiteUrl);
                var destDocLib  = ctx.AddContextDataToString(this.DestDocLib);
                var destDocName = ctx.AddContextDataToString(this.DestDocName);

                var spWeb  = string.IsNullOrEmpty(destsiteUrl) ? this.__Context.Web : new SPSite(destsiteUrl).OpenWeb();
                var docLib = string.IsNullOrEmpty(destDocLib) ? spWeb.Lists[new Guid(this.__ListId)] : spWeb.Lists[destDocLib];
                destDocName = (string.IsNullOrEmpty(destDocName) ? this.__Context.ItemName : Path.GetFileNameWithoutExtension(destDocName)) + Constants.PdfExtension;
                string destFileUrl = (docLib.RootFolder.ServerRelativeUrl.EndsWith("/") ? docLib.RootFolder.ServerRelativeUrl : docLib.RootFolder.ServerRelativeUrl + "/") + destDocName;


                if (string.IsNullOrEmpty(agreementID))
                {
                    this.HistoryListMessage = Constants.ErrNoAgreememtID;
                }
                else
                {
                    var fileBytes = AdobeOperations.GetSignedDocument(agreementID);
                    //TODO...use the input parameter for overriding
                    SPFile spFile = spWeb.Files.Add(destFileUrl, fileBytes, true);
                    spFile.Update();
                    //  Utilities.SetDefaultColValues(spFile.Item, agreementID, AgreementStatus.SIGNED);
                    this.OutDocumentID = spFile.Item.ID;

                    this.HistoryListMessage = Constants.MsgDocmuentUploadedSuccessfully;
                }

                base.LogProgressEnd(ctx, executionContext);
                return(ActivityExecutionStatus.Closed);
            }
            catch (Exception e)
            {
                ///log.Error("[Execute]", e);
                throw;
            }
        }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            ActivityActivationReference.IsAllowed(this, __Context.Web);
            // Get the workflow context for the workflow activity.
            NWWorkflowContext ctx = NWWorkflowContext.GetContext(__Context, new Guid(__ListId), __ListItem.Id, WorkflowInstanceId, this);

            base.LogProgressStart(ctx);
            string agreementId = ctx.AddContextDataToString(this.AgreementID);

            if (string.IsNullOrEmpty(agreementId))
            {
                //log.Error("[Execute]:" + Constants.ErrNoAgreementID);
                throw new ApplicationException(Constants.ErrNoAgreementID);
            }

            try
            {
                AgreementInfo agreementInfo = AdobeOperations.GetAgreementStatus(agreementId);

                if (agreementInfo == null)
                {
                    // TODO: log4Net, debug
                    // log in history
                    this.LogHistoryListMessage = true;
                    this.HistoryListMessage    = string.Format(Constants.ErrNoAgreementFound, agreementId);
                }
                else
                {
                    // LOG events and status
                    this.Status = agreementInfo.status.ToString();
                    this.Events = Utilities.SerializeXml <List <DocumentHistoryEvent> >(agreementInfo.events);

                    if (agreementInfo.nextParticipantSetInfos != null)
                    {
                        this.PendingApprovers = string.Join(";", agreementInfo.nextParticipantSetInfos.SelectMany(npSInfo => npSInfo.nextParticipantSetMemberInfos).ToList().Select(e => e.email).ToArray());
                    }
                }
            }
            catch (Exception e)
            {
                //log.Error("[Execute]", e);
                throw;
            }
            base.LogProgressEnd(ctx, executionContext);
            return(ActivityExecutionStatus.Closed);
        }
Exemplo n.º 8
0
        public static string UploadMultipleDocs()
        {
            string filename = @"E:\Backup\C-MED-17-55 Complaint Form.docx";
            string file1    = @"E:\Backup\Log.log";
            string file2    = @"E:\Backup\new.txt";

            byte[]        Mainfile = System.IO.File.ReadAllBytes(filename);
            List <byte[]> arrByte  = new List <byte[]>();

            arrByte.Add(System.IO.File.ReadAllBytes(file1));
            arrByte.Add(System.IO.File.ReadAllBytes(file2));

            string[] arr1 = new string[] { "*****@*****.**" };

            var agreementId = AdobeOperations.SendDocumentByBytesForSigninig(Mainfile, arrByte, "Test Multiple Docs", arr1, null, null).agreementId;

            return(agreementId);
        }
Exemplo n.º 9
0
 public static void DownLoadSignedCopy()
 {
     var agreementId = "3AAABLblqZhDMmc8hXR-PM8jUhTkq0C_muHzbsDdoylsPG8iCmPIHMZOhHMSTHEpB8mexkQWI2QUW1XmTVkODnnhCHMVSx20J";
     var bytes       = AdobeOperations.GetSignedDocument(agreementId);
     //File.WriteAllBytes(string path, byte[] bytes)
 }