private Silanis.ESL.SDK.Field CreateTypicalSDKField() { double x = 1; double y = 1; int page = 3; double width = 4; double height = 5; Silanis.ESL.SDK.Field sdkField = FieldBuilder.NewField() .WithId("99") .AtPosition(x, y) .OnPage(page) .WithSize(width, height) .WithStyle(FieldStyle.BOUND_DATE) .WithName("Field name") .WithPositionAnchor(TextAnchorBuilder.NewTextAnchor("Anchor Text") .AtPosition(TextAnchorPosition.BOTTOMLEFT) .WithCharacter(65) .WithOccurrence(2) .WithOffset(101, 102) //xOffset, yOffset .WithSize(201, 202) // width, height .Build()) .WithValidation(FieldValidatorBuilder.Alphabetic() .MaxLength(15) .MinLength(5) .Required() .WithErrorMessage("Error message for validation.") .Build()) .WithValue("value") .Build(); return(sdkField); }
public void ConvertSDKToSDK() { sdkField1 = CreateTypicalSDKField(); converter = new FieldConverter(sdkField1); sdkField2 = converter.ToSDKField(); Assert.IsNotNull(sdkField2); Assert.AreEqual(sdkField2, sdkField1); }
public void ConvertSDKToAPI() { sdkField1 = CreateTypicalSDKField(); apiField1 = new FieldConverter(sdkField1).ToAPIField(); Assert.IsNotNull(apiField1); Assert.AreEqual(sdkField1.Value, apiField1.Value); Assert.AreEqual(sdkField1.X, apiField1.Left); Assert.AreEqual(sdkField1.Y, apiField1.Top); Assert.AreEqual(sdkField1.Width, apiField1.Width); Assert.AreEqual(sdkField1.Height, apiField1.Height); Assert.AreEqual(sdkField1.Id, apiField1.Id); Assert.AreEqual(sdkField1.Name, apiField1.Name); Assert.AreEqual(sdkField1.Page, apiField1.Page); }
public void ConvertAPIToSDK() { apiField1 = CreateTypicalAPIField(); sdkField1 = new FieldConverter(apiField1).ToSDKField(); Assert.IsNotNull(sdkField1); Assert.AreEqual(sdkField1.Validator, new FieldValidatorConverter(apiField1.Validation).ToSDKFieldValidator()); Assert.AreEqual(sdkField1.Id, apiField1.Id); Assert.AreEqual(sdkField1.Name, apiField1.Name); Assert.AreEqual(sdkField1.Page, apiField1.Page); Assert.AreEqual(sdkField1.Style, new FieldStyleAndSubTypeConverter(apiField1.Subtype, apiField1.Binding).ToSDKFieldStyle()); Assert.AreEqual(sdkField1.TextAnchor, new TextAnchorConverter(apiField1.ExtractAnchor).ToSDKTextAnchor()); Assert.AreEqual(sdkField1.Value, apiField1.Value); Assert.AreEqual(sdkField1.X, apiField1.Left); Assert.AreEqual(sdkField1.Y, apiField1.Top); Assert.AreEqual(sdkField1.Width, apiField1.Width); Assert.AreEqual(sdkField1.Height, apiField1.Height); }
override public void Execute() { DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("FieldManipulationExample: " + DateTime.Now) .DescribedAs("This is a package created using the e-SignLive SDK") .ExpiresOn(DateTime.Now.AddMonths(100)) .WithSigner(SignerBuilder.NewSignerWithEmail(email1) .WithCustomId("signatureId1") .WithFirstName("firstName1") .WithLastName("lastName1")) .WithDocument(DocumentBuilder.NewDocumentNamed("FieldManipulationExample") .WithId("documentId") .FromStream(fileStream, DocumentType.PDF) .WithSignature(SignatureBuilder.SignatureFor(email1) .OnPage(0) .WithId(signatureId) .AtPosition(100, 100)) ) .Build(); packageId = eslClient.CreatePackage(superDuperPackage); field1 = FieldBuilder.RadioButton("group1") .WithName("field1") .WithId("fieldId1") .AtPosition(400, 100) .OnPage(0) .Build(); field2 = FieldBuilder.RadioButton("group1") .WithName("field2") .WithId("fieldId2") .AtPosition(400, 200) .OnPage(0) .Build(); field3 = FieldBuilder.RadioButton("group1") .WithName("field3") .WithId("fieldId3") .AtPosition(400, 300) .OnPage(0) .Build(); updatedField = FieldBuilder.RadioButton("group1") .WithName("updatedField") .WithId("fieldId3") .AtPosition(400, 300) .OnPage(0) .Build(); // Adding the fields eslClient.ApprovalService.AddField(packageId, documentId, signatureId, field1); eslClient.ApprovalService.AddField(packageId, documentId, signatureId, field2); eslClient.ApprovalService.AddField(packageId, documentId, signatureId, field3); createdPackage = eslClient.GetPackage(packageId); addedFields = eslClient.ApprovalService.GetApproval(createdPackage, documentId, signatureId.Id).Fields; // Deleting field1 eslClient.ApprovalService.DeleteField(packageId, documentId, signatureId, field1.Id); createdPackage = eslClient.GetPackage(packageId); deletedFields = eslClient.ApprovalService.GetApproval(createdPackage, documentId, signatureId.Id).Fields; // Updating the information for the third field eslClient.ApprovalService.ModifyField(packageId, documentId, signatureId, updatedField); createdPackage = eslClient.GetPackage(packageId); updatedFields = eslClient.ApprovalService.GetApproval(createdPackage, documentId, signatureId.Id).Fields; }
public void ConvertNullSDKToSDK() { sdkField1 = null; converter = new FieldConverter(sdkField1); Assert.IsNull(converter.ToSDKField()); }
public FieldConverter(Silanis.ESL.SDK.Field sdkField) { this.sdkField = sdkField; }
override public void Execute() { DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("QRCodeExample: " + DateTime.Now) .DescribedAs("This is a package created using the e-SignLive SDK") .WithEmailMessage("This message should be delivered to all signers") .WithSigner(SignerBuilder.NewSignerWithEmail(email1) .WithCustomId("Client1") .WithFirstName("John") .WithLastName("Smith") .WithTitle("Managing Director") .WithCompany("Acme Inc.")) .WithDocument(DocumentBuilder.NewDocumentNamed("First Document") .WithId(DOCUMENT_ID) .FromStream(fileStream1, DocumentType.PDF) .WithSignature(SignatureBuilder.SignatureFor(email1) .OnPage(0) .AtPosition(100, 100)) .WithQRCode(FieldBuilder.QRCode() .WithId(qrCodeId1) .OnPage(0) .AtPosition(400, 100))) .Build(); packageId = eslClient.CreatePackage(superDuperPackage); Field qrCode2 = FieldBuilder.QRCode() .OnPage(0) .AtPosition(500, 100) .Build(); // Add a second QR code to document qrCodeId2 = eslClient.QrCodeService.AddQRCode(packageId, DOCUMENT_ID, qrCode2); // Get the added QR codes addedQRCode1 = eslClient.QrCodeService.GetQRCode(packageId, DOCUMENT_ID, qrCodeId1); addedQRCode2 = eslClient.QrCodeService.GetQRCode(packageId, DOCUMENT_ID, qrCodeId2); // Modify the first QR code Field modifiedQRCode = FieldBuilder.QRCode() .WithId(qrCodeId1) .OnPage(0) .AtPosition(400, 500) .Build(); eslClient.QrCodeService.ModifyQRCode(packageId, DOCUMENT_ID, modifiedQRCode); modifiedQRCodeList = eslClient.GetPackage(packageId).Documents[DOCUMENT_NAME].QRCodes; // Delete the second QR code eslClient.QrCodeService.DeleteQRCode(packageId, DOCUMENT_ID, qrCodeId2); deletedQRCodeList = eslClient.GetPackage(packageId).Documents[DOCUMENT_NAME].QRCodes; // Update all the QR codes in the document with the provided list of fields Field updatedQRCode1 = FieldBuilder.QRCode() .WithId(qrCodeId1) .OnPage(0) .AtPosition(200, 600) .Build(); Field updatedQRCode2 = FieldBuilder.QRCode() .WithId(qrCodeId2) .OnPage(0) .AtPosition(300, 600) .Build(); IList<Silanis.ESL.SDK.Field> qrCodeList = new List<Silanis.ESL.SDK.Field>(); qrCodeList.Add(updatedQRCode1); qrCodeList.Add(updatedQRCode2); eslClient.QrCodeService.UpdateQRCodes(packageId, DOCUMENT_ID, qrCodeList); updatedQRCodeList = eslClient.GetPackage(packageId).Documents[DOCUMENT_NAME].QRCodes; }