public void Update(DocumentPackage template)
		{
			if (template.Id == null)
			{
				throw new ArgumentNullException("template.Id");
			}

			Silanis.ESL.API.Package apiTemplate = new DocumentPackageConverter(template).ToAPIPackage();
			apiTemplate.Type = BasePackageType.TEMPLATE;
            apiClient.Update(apiTemplate);
		}
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("SessionCreationExample: " + DateTime.Now)
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John")
                                                            .WithLastName("Smith")
                                                            .WithCustomId(signerId))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100)))
                                                .Build();

            PackageId packageId = eslClient.CreatePackage(superDuperPackage);

            eslClient.SendPackage(packageId);
            signerSessionToken = eslClient.CreateSignerSessionToken(packageId, email1);
            Console.WriteLine("{0}/access?sessionToken={1}", webpageUrl, signerSessionToken.Token);
        }
Exemple #3
0
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("ChangePackageStatusExample: " + DateTime.Now)
                                                .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings().WithInPerson())
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John1")
                                                            .WithLastName("Smith1"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed(DOCUMENT_NAME)
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100)))
                                                .Build();

            packageId = eslClient.CreatePackage(superDuperPackage);
            eslClient.SendPackage(packageId);
            sentPackage = eslClient.GetPackage(packageId);
            eslClient.ChangePackageStatusToDraft(packageId);
            retrievedPackage = eslClient.GetPackage(packageId);
        }
        public void VerifyResult()
        {
            CreateTemplateFromPackageExample example = new CreateTemplateFromPackageExample();

            example.Run();

            DocumentPackage templatePackage = example.OssClient.GetPackage(example.TemplateId);
            Document        document        = templatePackage.GetDocument(example.DOCUMENT_NAME);

            Assert.AreEqual(document.Name, example.DOCUMENT_NAME);
            Assert.AreEqual(document.Id, example.DOCUMENT_ID);

            Assert.AreEqual(templatePackage.Name, example.PACKAGE_NAME_NEW);
            // TODO: Make sure that this is correctly preserved.
            Assert.AreEqual(templatePackage.Signers.Count, 3);
            Assert.AreEqual(templatePackage.GetSigner(example.email1).FirstName, example.PACKAGE_SIGNER1_FIRST);
            Assert.AreEqual(templatePackage.GetSigner(example.email1).LastName, example.PACKAGE_SIGNER1_LAST);
            Assert.AreEqual(templatePackage.GetSigner(example.email2).FirstName, example.PACKAGE_SIGNER2_FIRST);
            Assert.AreEqual(templatePackage.GetSigner(example.email2).LastName, example.PACKAGE_SIGNER2_LAST);
        }
Exemple #5
0
        public void VerifyResult()
        {
            DocumentPackageAttributesExample example = new DocumentPackageAttributesExample();

            example.Run();

            DocumentPackage              documentPackage = example.RetrievedPackage;
            DocumentPackageAttributes    attributes      = documentPackage.Attributes;
            IDictionary <string, object> attributeMap    = attributes.Contents;

            Assert.IsTrue(attributeMap.ContainsKey(ORIGIN_KEY));
            Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_1));
            Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_2));
            Assert.IsTrue(attributeMap.ContainsKey(example.ATTRIBUTE_KEY_3));

            Assert.AreEqual(example.DYNAMICS_2015, attributeMap[ORIGIN_KEY]);
            Assert.AreEqual(example.ATTRIBUTE_1, attributeMap[example.ATTRIBUTE_KEY_1]);
            Assert.AreEqual(example.ATTRIBUTE_2, attributeMap[example.ATTRIBUTE_KEY_2]);
            Assert.AreEqual(example.ATTRIBUTE_3, attributeMap[example.ATTRIBUTE_KEY_3]);
        }
        public void VerifyResult()
        {
            AuthenticationMethodsExample example = new AuthenticationMethodsExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            Assert.AreEqual(documentPackage.GetSigner(example.email1).AuthenticationMethod, AuthenticationMethod.EMAIL);
            Assert.AreEqual(documentPackage.GetSigner(example.email1).ChallengeQuestion.Count, 0);
            Assert.IsNull(documentPackage.GetSigner(example.email2).PhoneNumber);

            Assert.AreEqual(documentPackage.GetSigner(example.email2).AuthenticationMethod, AuthenticationMethod.CHALLENGE);
            Assert.AreEqual(documentPackage.GetSigner(example.email2).ChallengeQuestion[0].Question, AuthenticationMethodsExample.QUESTION1);
            Assert.AreEqual(documentPackage.GetSigner(example.email2).ChallengeQuestion[1].Question, AuthenticationMethodsExample.QUESTION2);
            Assert.IsNull(documentPackage.GetSigner(example.email2).PhoneNumber);

            Assert.AreEqual(documentPackage.GetSigner(example.email3).AuthenticationMethod, AuthenticationMethod.EMAIL);
            Assert.AreEqual(documentPackage.GetSigner(example.email3).ChallengeQuestion.Count, 0);
        }
Exemple #7
0
        public void verify()
        {
            CustomFieldExample example = new CustomFieldExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            Assert.IsTrue(example.EslClient.GetCustomFieldService().DoesCustomFieldExist(example.customFieldId1));
            Assert.IsFalse(example.EslClient.GetCustomFieldService().DoesCustomFieldExist(example.customFieldId2));

            Assert.AreEqual(documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures.Count, 1);
            Assert.AreEqual(documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures[0].SignerEmail, example.email1);
            Assert.IsNotNull(documentPackage.GetDocument(example.DOCUMENT_NAME).Signatures[0].Fields[0]);

            // Get first custom field
            CustomField retrievedCustomField = example.retrievedCustomField;

            Assert.AreEqual(retrievedCustomField.Id, example.customFieldId1);
            Assert.AreEqual(retrievedCustomField.Value, example.DEFAULT_VALUE);
            Assert.AreEqual(retrievedCustomField.Translations[0].Name, example.ENGLISH_NAME);
            Assert.AreEqual(retrievedCustomField.Translations[0].Language, example.ENGLISH_LANGUAGE);
            Assert.AreEqual(retrievedCustomField.Translations[0].Description, example.ENGLISH_DESCRIPTION);
            Assert.AreEqual(retrievedCustomField.Translations[1].Name, example.FRENCH_NAME);
            Assert.AreEqual(retrievedCustomField.Translations[1].Language, example.FRENCH_LANGUAGE);
            Assert.AreEqual(retrievedCustomField.Translations[1].Description, example.FRENCH_DESCRIPTION);

            // Get entire list of custom fields
            Assert.Greater(example.retrievedCustomFieldList1.Count, 0);

            // Get first page of custom fields
            Assert.Greater(example.retrievedCustomFieldList2.Count, 0);

            // Get the custom field values for this user
            Assert.GreaterOrEqual(example.retrieveCustomFieldValueList1.Count, 1);
            Assert.AreEqual(example.customFieldId1, example.retrieveCustomFieldValue1.Id);
            Assert.AreEqual(example.customFieldId2, example.retrieveCustomFieldValue2.Id);

            // Get the custom field values for this user after deleting 1 user custom field for this user
            Assert.AreEqual(example.retrieveCustomFieldValueList2.Count, example.retrieveCustomFieldValueList1.Count - 1);
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            //If Print all selected imprime toda la lista, si no imprime el seleccionado.
            ProcessWindow pw = new ProcessWindow("Printing Labels ... ");

            try
            {
                if (ckPrintAll.IsChecked == true)
                {
                    Util.PrintShipmentPackLabels(curPosted);
                    //PrintParentLabel();
                    return;
                }

                //Definicion del Template a Imprimier
                DocumentPackage curPack = ((DocumentPackage)sourceTree.SelectedItem);

                if (curPack == null || curPack.PackLabel.LabelID == 0)
                {
                    Util.ShowError("No Pallet/Box selected.");
                    return;
                }

                if ((curPack.ParentPackage == null || curPack.ParentPackage.PackID == 0))
                {
                    //&& curPack.ChildPackages != null && curPack.ChildPackages.Count > 0) //Parent label
                    PrintParentLabel(curPack);
                }

                else
                {
                    //Imprime solo el Label que se selecciono.
                    service.PrintLabelsFromDevice(WmsSetupValues.DEFAULT, WmsSetupValues.DefaultPackLabelTemplate,
                                                  new List <WpfFront.WMSBusinessService.Label> {
                        curPack.PackLabel
                    });
                }
            }
            catch (Exception ex) { Util.ShowError(ex.Message); }
            finally { pw.Close(); }
        }
Exemple #9
0
        override public void Execute()
        {
            DocumentPackage package = PackageBuilder.NewPackageNamed("C# DocumentExtractionExample " + DateTime.Now)
                                      .DescribedAs("This is a new package")
                                      .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                  .WithCustomId("Signer1")
                                                  .WithCustomId("Signer1")
                                                  .WithFirstName("John")
                                                  .WithLastName("Smith"))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed(DOCUMENT_NAME)
                                                    .FromStream(fileStream1, DocumentType.PDF)
                                                    .EnableExtraction())
                                      .Build();

            packageId = eslClient.CreatePackage(package);
            eslClient.SendPackage(packageId);

            DocumentPackage sentPackage = eslClient.GetPackage(packageId);

            Console.WriteLine("Document sent = " + sentPackage.Id);
        }
Exemple #10
0
        private PackageId CreatePackageWithCustomSender(string PackageSenderEmail)
        {
            SenderInfo customSenderInfo = SenderInfoBuilder.NewSenderInfo(PackageSenderEmail)
                                          .WithName("firstName", "lastName")
                                          .WithTitle("title")
                                          .WithCompany("company")
                                          .Build();

            DocumentPackage customSenderPackage = PackageBuilder.NewPackageNamed("DesignerRedirectForPackageSenderExample " + DateTime.Now)
                                                  .WithSenderInfo(customSenderInfo)
                                                  .DescribedAs("This is a package created using the e-SignLive SDK")
                                                  .ExpiresOn(DateTime.Now.AddMonths(1))
                                                  .WithEmailMessage("This message should be delivered to all signers")
                                                  .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                                .FromStream(fileStream, DocumentType.PDF)
                                                                .WithId("doc1"))
                                                  .Build();
            PackageId customSenderPackageId = eslClient.CreatePackage(customSenderPackage);

            return(customSenderPackageId);
        }
Exemple #11
0
        public void VerifyResult()
        {
            ContactsExample example = new ContactsExample(Props.GetInstance());

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;
            Signer          signer          = documentPackage.Signers[example.email1];

            // Assert signer information is correct
            Assert.AreEqual(signer.Email, example.signerForPackage.Email);
            Assert.AreEqual(signer.FirstName, example.signerForPackage.FirstName);
            Assert.AreEqual(signer.LastName, example.signerForPackage.LastName);
            Assert.AreEqual(signer.Title, example.signerForPackage.Title);
            Assert.AreEqual(signer.Company, example.signerForPackage.Company);

            // Assert new signer is added to the contacts
            Assert.IsNotNull(example.afterContacts[example.email2]);
            Assert.AreEqual(example.afterContacts[example.email2].FirstName, "John");
            Assert.AreEqual(example.afterContacts[example.email2].LastName, "Smith");
        }
Exemple #12
0
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("FieldInjectionExample " + DateTime.Now)
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John")
                                                            .WithLastName("Smith"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100))
                                                              .WithInjectedField(FieldBuilder.TextField()
                                                                                 .WithId("AGENT_SIG_1")
                                                                                 .WithName("AGENT_SIG_1")
                                                                                 .WithValue("Test Value")))
                                                .Build();

            PackageId packageId = eslClient.CreatePackage(superDuperPackage);

            eslClient.SendPackage(packageId);
        }
Exemple #13
0
        public void VerifyResult()
        {
            AuthenticationMethodsExample example = new AuthenticationMethodsExample(Props.GetInstance());

            example.Run();

            DocumentPackage documentPackage = example.EslClient.GetPackage(example.PackageId);

            Assert.AreEqual(documentPackage.Signers[example.Email1].AuthenticationMethod, AuthenticationMethod.EMAIL);
            Assert.AreEqual(documentPackage.Signers[example.Email1].ChallengeQuestion.Count, 0);
            Assert.IsNull(documentPackage.Signers[example.Email1].PhoneNumber);

            Assert.AreEqual(documentPackage.Signers[example.Email2].AuthenticationMethod, AuthenticationMethod.CHALLENGE);
            Assert.AreEqual(documentPackage.Signers[example.Email2].ChallengeQuestion[0].Question, AuthenticationMethodsExample.QUESTION1);
            Assert.AreEqual(documentPackage.Signers[example.Email2].ChallengeQuestion[1].Question, AuthenticationMethodsExample.QUESTION2);
            Assert.IsNull(documentPackage.Signers[example.Email2].PhoneNumber);

            Assert.AreEqual(documentPackage.Signers[example.Email3].AuthenticationMethod, AuthenticationMethod.SMS);
            Assert.AreEqual(documentPackage.Signers[example.Email3].ChallengeQuestion.Count, 0);
            Assert.AreEqual(documentPackage.Signers[example.Email3].PhoneNumber, example.Sms3);
        }
        public void VerifyResult()
        {
            DocumentPackageSettingsExample example = new DocumentPackageSettingsExample();

            example.Run();

            DocumentPackage result = example.EslClient.GetPackage(example.PackageId);

            Assert.IsTrue(result.Settings.EnableFirstAffidavit.HasValue);
            Assert.IsFalse(result.Settings.EnableFirstAffidavit.Value);

            Assert.IsTrue(result.Settings.EnableSecondAffidavit.HasValue);
            Assert.IsFalse(result.Settings.EnableSecondAffidavit.Value);

            Assert.IsTrue(result.Settings.ShowLanguageDropDown.HasValue);
            Assert.IsFalse(result.Settings.ShowLanguageDropDown.Value);

            Assert.IsTrue(result.Settings.ShowOwnerInPersonDropDown.HasValue);
            Assert.IsFalse(result.Settings.ShowOwnerInPersonDropDown.Value);

            Assert.IsTrue(result.Settings.EnforceCaptureSignature.HasValue);
            Assert.IsTrue(result.Settings.EnforceCaptureSignature.Value);

            Assert.AreEqual(example.FONT_SIZE, result.Settings.FontSize.Value);

            Assert.AreEqual(3, result.Settings.DeclineReasons.Count);
            Assert.AreEqual(example.DECLINE_REASON_1, result.Settings.DeclineReasons [0]);
            Assert.AreEqual(example.DECLINE_REASON_2, result.Settings.DeclineReasons [1]);
            Assert.AreEqual(example.DECLINE_REASON_3, result.Settings.DeclineReasons [2]);
            Assert.IsTrue(result.Settings.DisableDeclineOther.Value);

            Assert.AreEqual(3, result.Settings.DeclineReasons.Count);
            Assert.AreEqual(example.OPT_OUT_REASON_1, result.Settings.OptOutReasons [0]);
            Assert.AreEqual(example.OPT_OUT_REASON_2, result.Settings.OptOutReasons [1]);
            Assert.AreEqual(example.OPT_OUT_REASON_3, result.Settings.OptOutReasons [2]);
            Assert.IsTrue(result.Settings.DisableOptOutOther.Value);

            Assert.IsTrue(result.Settings.DefaultTimeBasedExpiry.Value);
            Assert.AreEqual(example.EXPIRE_IN_DAYS, result.Settings.RemainingDays.Value);
        }
        public static void Main(string[] args)
        {
            // Create new esl client with api token and base url
            EslClient client = new EslClient(apiToken, baseUrl);
            FileInfo  file   = new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf");

            DocumentPackage package = PackageBuilder.NewPackageNamed("Signing Order " + DateTime.Now)
                                      .DescribedAs("This is a signer workflow example")
                                      .WithSigner(SignerBuilder.NewSignerWithEmail("*****@*****.**")
                                                  .WithFirstName("John")
                                                  .WithLastName("Smith")
                                                  .SigningOrder(1))
                                      .WithSigner(SignerBuilder.NewSignerWithEmail("*****@*****.**")
                                                  .WithFirstName("Coco")
                                                  .WithLastName("Beware")
                                                  .SigningOrder(2))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("Second Document")
                                                    .FromFile(file.FullName)
                                                    .WithSignature(SignatureBuilder.SignatureFor("*****@*****.**")
                                                                   .OnPage(0)
                                                                   .AtPosition(500, 100))
                                                    .WithSignature(SignatureBuilder.InitialsFor("*****@*****.**")
                                                                   .OnPage(0)
                                                                   .AtPosition(500, 200))
                                                    .WithSignature(SignatureBuilder.CaptureFor("*****@*****.**")
                                                                   .OnPage(0)
                                                                   .AtPosition(500, 300)))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                    .FromFile(file.FullName)
                                                    .WithSignature(SignatureBuilder.SignatureFor("*****@*****.**")
                                                                   .OnPage(0)
                                                                   .AtPosition(500, 100)))
                                      .Build();

            PackageId id = client.CreatePackage(package);

            client.SendPackage(id);

            Console.WriteLine("Package {0} was sent", id.Id);
        }
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(PackageName)
                                                .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                                                              .WithInPerson()
                                                              .WithoutLanguageDropDown()
                                                              .DisableFirstAffidavit()
                                                              .DisableSecondAffidavit()
                                                              .HideOwnerInPersonDropDown()
                                                              .WithDecline()
                                                              .WithOptOut()
                                                              .WithEnforceCaptureSignature()
                                                              .WithDeclineReason(DECLINE_REASON_1)
                                                              .WithDeclineReason(DECLINE_REASON_2)
                                                              .WithDeclineReason(DECLINE_REASON_3)
                                                              .WithoutDeclineOther()
                                                              .WithOptOutReason(OPT_OUT_REASON_1)
                                                              .WithOptOutReason(OPT_OUT_REASON_2)
                                                              .WithOptOutReason(OPT_OUT_REASON_3)
                                                              .WithoutOptOutOther()
                                                              .WithHandOverLinkHref("http://www.google.ca")
                                                              .WithHandOverLinkText("click here")
                                                              .WithHandOverLinkTooltip("link tooltip")
                                                              .WithCeremonyLayoutSettings(CeremonyLayoutSettingsBuilder.NewCeremonyLayoutSettings()
                                                                                          .WithoutGlobalConfirmButton()
                                                                                          .WithoutGlobalDownloadButton()
                                                                                          .WithoutGlobalSaveAsLayoutButton()))
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John")
                                                            .WithLastName("Smith"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100)))
                                                .Build();

            packageId        = eslClient.CreateAndSendPackage(superDuperPackage);
            retrievedPackage = eslClient.GetPackage(packageId);
        }
Exemple #17
0
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(PackageName)
                                                .DescribedAs("This is a package created using the eSignLive SDK")
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John1")
                                                            .WithLastName("Smith1"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100)))
                                                .Build();

            packageId        = ossClient.CreatePackage(superDuperPackage);
            retrievedPackage = ossClient.GetPackage(packageId);
            Signer signer = retrievedPackage.GetSigner(email1);

            // Create
            signerVerificationToBeCreated = SignerVerificationBuilder
                                            .NewSignerVerification(CREATE_VERIFICATION_TYPE_ID)
                                            .WithPayload(CREATE_VERIFICATION_PAYLOAD)
                                            .Build();
            ossClient.CreateSignerVerification(packageId, signer.Id, signerVerificationToBeCreated);
            retrievedSignerVerificationAfterCreate = ossClient.GetSignerVerification(packageId, signer.Id);

            // Update
            signerVerificationToBeUpdated = SignerVerificationBuilder
                                            .NewSignerVerification(UPDATE_VERIFICATION_TYPE_ID)
                                            .WithPayload(UPDATE_VERIFICATION_PAYLOAD)
                                            .Build();

            ossClient.UpdateSignerVerification(packageId, signer.Id, signerVerificationToBeUpdated);
            retrievedSignerVerificationAfterUpdate = ossClient.GetSignerVerification(packageId, signer.Id);

            // Delete
            ossClient.DeleteSignerVerification(packageId, signer.Id);
            retrievedSignerVerificationAfterDelete = ossClient.GetSignerVerification(packageId, signer.Id);
        }
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("ReminderExample: " + DateTime.Now)
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("Patty")
                                                            .WithLastName("Galant"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100)))
                                                .Build();

            packageId = eslClient.CreatePackage(superDuperPackage);

            reminderScheduleToCreate = ReminderScheduleBuilder.ForPackageWithId(packageId)
                                       .WithDaysUntilFirstReminder(2)
                                       .WithDaysBetweenReminders(1)
                                       .WithNumberOfRepetitions(5)
                                       .Build();

            eslClient.ReminderService.CreateReminderScheduleForPackage(reminderScheduleToCreate);

            eslClient.SendPackage(packageId);

            createdReminderSchedule = eslClient.ReminderService.GetReminderScheduleForPackage(packageId);

            reminderScheduleToUpdate = ReminderScheduleBuilder.ForPackageWithId(packageId)
                                       .WithDaysUntilFirstReminder(3)
                                       .WithDaysBetweenReminders(2)
                                       .WithNumberOfRepetitions(10)
                                       .Build();

            eslClient.ReminderService.UpdateReminderScheduleForPackage(reminderScheduleToUpdate);
            updatedReminderSchedule = eslClient.ReminderService.GetReminderScheduleForPackage(packageId);

            eslClient.ReminderService.ClearReminderScheduleForPackage(packageId);
            removedReminderSchedule = eslClient.ReminderService.GetReminderScheduleForPackage(packageId);
        }
        override public void Execute()
        {
			DocumentPackage superDuperPackage =
                PackageBuilder.NewPackageNamed(PackageName)
					.DescribedAs("This is a package created using the eSignLive SDK")
					.WithSigner(SignerBuilder.NewSignerWithEmail("*****@*****.**")
						.WithCustomId("Client1")
						.WithFirstName("John")
						.WithLastName("Smith")
					)
					.WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
						.FromStream(fileStream1, DocumentType.PDF)
						.WithSignature(SignatureBuilder.SignatureFor("*****@*****.**")
							.OnPage(0)
							.AtPosition(100, 100)
						)
					)
					.Build();

			PackageId packageId = eslClient.CreateAndSendPackage(superDuperPackage);
			eslClient.PackageService.Edit(packageId);
        }
Exemple #20
0
        override public void Execute()
        {
            string          documentId = "myDocumentId";
            DocumentPackage package    = PackageBuilder.NewPackageNamed("DocumentRetrievalExample " + DateTime.Now)
                                         .DescribedAs("This is a new package")
                                         .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                     .WithFirstName("John")
                                                     .WithLastName("Smith"))
                                         .WithDocument(DocumentBuilder.NewDocumentNamed("My Document")
                                                       .FromStream(fileStream1, DocumentType.PDF)
                                                       .WithId(documentId)
                                                       .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                      .OnPage(0)
                                                                      .AtPosition(100, 100)))
                                         .Build();

            PackageId packageId = eslClient.CreatePackage(package);

            eslClient.SendPackage(packageId);

            downloadDocumentById(packageId, documentId);
        }
        override public void Execute()
        {
            this.fileStream1 = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/SampleDocuments/document-with-fields.pdf").FullName);

            DocumentPackage package = PackageBuilder.NewPackageNamed(PackageName)
                                      .DescribedAs("This is a new package")
                                      .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                  .WithFirstName("John")
                                                  .WithLastName("Smith"))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("My Document")
                                                    .FromStream(fileStream1, DocumentType.PDF)
                                                    .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                   .WithName("AGENT_SIG_1"))
                                                    .WithInjectedField(FieldBuilder.Label()
                                                                       .WithName("AGENT_SIG_2")
                                                                       .WithValue("Céline Lelièvre")))
                                      .Build();

            PackageId id = eslClient.CreatePackage(package);

            eslClient.SendPackage(id);
        }
        override public void Execute()
        {
            eslClient.AccountService.InviteUser(
                AccountMemberBuilder.NewAccountMember(senderEmail)
                .WithFirstName("firstName")
                .WithLastName("lastName")
                .WithCompany("company")
                .WithTitle("title")
                .WithLanguage("language")
                .WithPhoneNumber("phoneNumber")
                .Build()
                );

            SenderInfo customSenderInfo = SenderInfoBuilder.NewSenderInfo(senderEmail)
                                          .WithName("firstName", "lastName")
                                          .WithTitle("title")
                                          .WithCompany("company")
                                          .Build();

            DocumentPackage customSenderPackage = PackageBuilder.NewPackageNamed(PackageName)
                                                  .WithSenderInfo(customSenderInfo)
                                                  .DescribedAs("This is a package created using the eSignLive SDK")
                                                  .ExpiresOn(DateTime.Now.AddMonths(1))
                                                  .WithEmailMessage("This message should be delivered to all signers")
                                                  .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                                .FromStream(fileStream1, DocumentType.PDF)
                                                                .WithSignature(SignatureBuilder.SignatureFor(senderEmail)
                                                                               .OnPage(0)
                                                                               .AtPosition(100, 100)))
                                                  .Build();

            PackageId packageId = eslClient.CreatePackage(customSenderPackage);

            string userAuthenticationToken = eslClient.AuthenticationTokenService.CreateUserAuthenticationToken();

            generatedLinkToPackageViewForSender = authenticationClient.BuildRedirectToPackageViewForSender(userAuthenticationToken, packageId);

            System.Console.WriteLine("PackageView redirect url: " + generatedLinkToPackageViewForSender);
        }
Exemple #23
0
        public void VerifyResult()
        {
            SignerInformationForEquifaxCanadaExample example = new SignerInformationForEquifaxCanadaExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            SignerInformationForEquifaxCanada signerInformationForEquifaxCanada = documentPackage.GetSigner(example.email1).KnowledgeBasedAuthentication.SignerInformationForEquifaxCanada;

            Assert.AreEqual(signerInformationForEquifaxCanada.FirstName, example.FIRST_NAME);
            Assert.AreEqual(signerInformationForEquifaxCanada.LastName, example.LAST_NAME);
            Assert.AreEqual(signerInformationForEquifaxCanada.StreetAddress, example.STREET_ADDRESS);
            Assert.AreEqual(signerInformationForEquifaxCanada.City, example.CITY);
            Assert.AreEqual(signerInformationForEquifaxCanada.Province, example.PROVINCE);
            Assert.AreEqual(signerInformationForEquifaxCanada.PostalCode, example.POSTAL_CODE);
            Assert.AreEqual(signerInformationForEquifaxCanada.TimeAtAddress, example.TIME_AT_ADDRESS);
            Assert.AreEqual(signerInformationForEquifaxCanada.DriversLicenseNumber, example.DRIVERS_LICENSE_NUMBER);
            Assert.AreEqual(signerInformationForEquifaxCanada.SocialInsuranceNumber, example.SOCIAL_INSURANCE_NUMBER);
            Assert.AreEqual(signerInformationForEquifaxCanada.HomePhoneNumber, example.HOME_PHONE_NUMBER);
            Assert.AreEqual(signerInformationForEquifaxCanada.DateOfBirth, example.DATE_OF_BIRTH);
        }
Exemple #24
0
        override public void Execute()
        {
            DocumentPackage package = PackageBuilder.NewPackageNamed("C# GetSigningStatusExample " + DateTime.Now)
                                      .DescribedAs("This is a new package")
                                      .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                  .WithFirstName("John")
                                                  .WithLastName("Smith"))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("My Document")
                                                    .FromStream(fileStream1, DocumentType.PDF)
                                                    .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                   .OnPage(0)
                                                                   .AtPosition(500, 100)))
                                      .Build();

            PackageId id = eslClient.CreatePackage(package);

            SigningStatus status = eslClient.GetSigningStatus(id, null, null);

            eslClient.SendPackage(id);

            status = eslClient.GetSigningStatus(id, null, null);
        }
Exemple #25
0
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(PackageName)
                                                .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings().WithInPerson())
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John1")
                                                            .WithLastName("Smith1"))
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email2)
                                                            .WithFirstName("John2")
                                                            .WithLastName("Smith2"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed(DOCUMENT_NAME)
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100))
                                                              .WithSignature(SignatureBuilder.AcceptanceFor(email2)))
                                                .Build();

            packageId = ossClient.CreatePackage(superDuperPackage);
            ossClient.SendPackage(packageId);
            retrievedPackage = ossClient.GetPackage(packageId);
        }
        override public void Execute()
        {
            DocumentPackage template = PackageBuilder.NewPackageNamed("Template")
                                       .DescribedAs("first message")
                                       .WithEmailMessage(PACKAGE_EMAIL_MESSAGE)
                                       .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                   .WithFirstName(PACKAGE_SIGNER1_FIRST)
                                                   .WithLastName(PACKAGE_SIGNER1_LAST)
                                                   .WithTitle(PACKAGE_SIGNER1_TITLE)
                                                   .WithCompany(PACKAGE_SIGNER1_COMPANY)
                                                   .WithCustomId(PACKAGE_SIGNER1_CUSTOM_ID))
                                       .WithDocument(DocumentBuilder.NewDocumentNamed(DOCUMENT_NAME)
                                                     .FromStream(fileStream1, DocumentType.PDF)
                                                     .WithId(DOCUMENT_ID)
                                                     .Build())
                                       .Build();

            template.Id = eslClient.CreateTemplate(template);

            DocumentPackage newPackage = PackageBuilder.NewPackageNamed(PACKAGE_NAME)
                                         .DescribedAs(PACKAGE_DESCRIPTION)
                                         .WithEmailMessage(PACKAGE_EMAIL_MESSAGE2)
                                         .WithSigner(SignerBuilder.NewSignerWithEmail(email2)
                                                     .WithFirstName(PACKAGE_SIGNER2_FIRST)
                                                     .WithLastName(PACKAGE_SIGNER2_LAST)
                                                     .WithTitle(PACKAGE_SIGNER2_TITLE)
                                                     .WithCompany(PACKAGE_SIGNER2_COMPANY)
                                                     .WithCustomId(PACKAGE_SIGNER2_CUSTOM_ID))
                                         .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                                                       .WithoutInPerson()
                                                       .WithoutDecline()
                                                       .WithoutOptOut()
                                                       .WithWatermark()
                                                       .Build())
                                         .Build();

            packageId        = eslClient.CreatePackageFromTemplate(template.Id, newPackage);
            retrievedPackage = eslClient.GetPackage(packageId);
        }
Exemple #27
0
        override public void Execute()
        {
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("SignerQnAChallengeExample: " + DateTime.Now)
                                                .DescribedAs("This is a Q&A authentication example")
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John")
                                                            .WithLastName("Smith")
                                                            .ChallengedWithQuestions(ChallengeBuilder.FirstQuestion(FIRST_QUESTION)
                                                                                     .Answer(FIRST_ANSWER)
                                                                                     .SecondQuestion(SECOND_QUESTION)
                                                                                     .Answer(SECOND_ANSWER)))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                             .OnPage(0)
                                                                             .AtPosition(199, 100)))
                                                .Build();

            packageId = eslClient.CreatePackage(superDuperPackage);

            eslClient.SendPackage(packageId);
        }
        public void VerifyResult()
        {
            SignerInformationForEquifaxUSAExample example = new SignerInformationForEquifaxUSAExample();

            example.Run();

            DocumentPackage documentPackage = example.RetrievedPackage;

            SignerInformationForEquifaxUSA signerInformationForEquifaxUSA = documentPackage.GetSigner(example.email1).KnowledgeBasedAuthentication.SignerInformationForEquifaxUSA;

            Assert.AreEqual(signerInformationForEquifaxUSA.FirstName, example.FIRST_NAME);
            Assert.AreEqual(signerInformationForEquifaxUSA.LastName, example.LAST_NAME);
            Assert.AreEqual(signerInformationForEquifaxUSA.StreetAddress, example.STREET_ADDRESS);
            Assert.AreEqual(signerInformationForEquifaxUSA.City, example.CITY);
            Assert.AreEqual(signerInformationForEquifaxUSA.State, example.STATE);
            Assert.AreEqual(signerInformationForEquifaxUSA.Zip, example.ZIP);
            Assert.AreEqual(signerInformationForEquifaxUSA.TimeAtAddress, example.TIME_AT_ADDRESS);
            Assert.AreEqual(signerInformationForEquifaxUSA.SocialSecurityNumber, example.SOCIAL_SECURITY_NUMBER);
            Assert.AreEqual(signerInformationForEquifaxUSA.HomePhoneNumber, example.HOME_PHONE_NUMBER);
            Assert.AreEqual(signerInformationForEquifaxUSA.DateOfBirth, example.DATE_OF_BIRTH);
            Assert.AreEqual(signerInformationForEquifaxUSA.DriversLicenseNumber, example.DRIVERS_LICENSE_NUMBER);
        }
Exemple #29
0
        public void verifyResult()
        {
            ProxyConfigurationExample example = new ProxyConfigurationExample(Props.GetInstance());

            example.Run();

            DocumentPackage documentPackage1 = example.eslClientWithHttpProxy.GetPackage(example.packageId1);
            DocumentPackage documentPackage2 = example.EslClient.GetPackage(example.packageId1);

            Assert.AreEqual(example.packageId1.Id, documentPackage1.Id.Id);
            Assert.AreEqual(example.packageId1.Id, documentPackage2.Id.Id);
            Assert.AreEqual(DocumentPackageStatus.COMPLETED, documentPackage1.Status);
            Assert.AreEqual(DocumentPackageStatus.COMPLETED, documentPackage2.Status);

            DocumentPackage documentPackage3 = example.eslClientWithHttpProxyHasCredentials.GetPackage(example.packageId2);
            DocumentPackage documentPackage4 = example.EslClient.GetPackage(example.packageId2);

            Assert.AreEqual(example.packageId2.Id, documentPackage3.Id.Id);
            Assert.AreEqual(example.packageId2.Id, documentPackage4.Id.Id);
            Assert.AreEqual(DocumentPackageStatus.COMPLETED, documentPackage3.Status);
            Assert.AreEqual(DocumentPackageStatus.COMPLETED, documentPackage4.Status);
        }
        override public void Execute()
        {
            // Note that the field ID for injected field is not a significant for the field injection.
            // InjectedField list is not returned by the esl-backend.
            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("FieldInjectionExample " + DateTime.Now)
                                                .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings().WithInPerson())
                                                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                            .WithFirstName("John")
                                                            .WithLastName("Smith"))
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithInjectedField(FieldBuilder.TextField().WithName("Text1").WithValue("First Injected Value"))
                                                              .WithInjectedField(FieldBuilder.TextField().WithName("Text2").WithValue("Second Injected Value"))
                                                              .WithInjectedField(FieldBuilder.TextField().WithName("Text3").WithValue("Third Injected Value"))
                                                              .WithInjectedField(FieldBuilder.TextField().WithName("Text4").WithValue("Fourth Injected Value"))
                                                              .WithInjectedField(FieldBuilder.TextField().WithName("Text5").WithValue("Fifth Injected Value"))
                                                              .WithInjectedField(FieldBuilder.TextField().WithName("Text6").WithValue("À à Â â Æ æ Ç ç È è É é Ê ë")))
                                                .Build();

            packageId        = eslClient.CreatePackage(superDuperPackage);
            retrievedPackage = eslClient.GetPackage(PackageId);
        }
Exemple #31
0
        override public void Execute()
        {
            DocumentPackage package = PackageBuilder.NewPackageNamed(PackageName)
                                      .DescribedAs("This is a new package")
                                      .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                                                  .WithFirstName("John")
                                                  .WithLastName("Smith"))
                                      .WithDocument(DocumentBuilder.NewDocumentNamed("My Document")
                                                    .FromStream(fileStream1, DocumentType.PDF)
                                                    .EnableExtraction()
                                                    .WithSignature(SignatureBuilder.SignatureFor(email1)
                                                                   .WithName("AGENT_SIG_1")
                                                                   .WithPositionExtracted()
                                                                   .WithField(FieldBuilder.SignatureDate()
                                                                              .WithName("AGENT_SIG_2")
                                                                              .WithPositionExtracted())))
                                      .Build();

            PackageId id = eslClient.CreatePackage(package);

            eslClient.SendPackage(id);
        }
		public DocumentPackage Build()
        {
            DocumentPackage package = new DocumentPackage(id, packageName, autocomplete, signers, placeholders, documents);
            package.Description = description;
            package.ExpiryDate = expiryDate;
            package.EmailMessage = emailMessage;
            package.Status = status;
            package.Language = language;
            package.Settings = settings;
            package.SenderInfo = senderInfo;
            package.Attributes = attributes;
            package.Messages = messages;

			return package;
		}
		public void OrderDocuments(DocumentPackage package)
		{
			string path = template.UrlFor (UrlTemplate.DOCUMENT_PATH)
				.Replace ("{packageId}", package.Id.Id)
				.Build ();

			List<Silanis.ESL.API.Document> documents = new List<Silanis.ESL.API.Document>();
			foreach (Document doc in package.Documents.Values)
			{
				documents.Add(new DocumentConverter(doc).ToAPIDocument());
			}

			try 
			{
				string json = JsonConvert.SerializeObject (documents, settings);
				restClient.Put(path, json);
			} 
            catch (EslServerException e) 
            {
                throw new EslServerException ("Could not order documents." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) 
			{
				throw new EslException ("Could not order documents." + " Exception: " + e.Message,e);
			}
		}
 public void DeleteDocumentPackage(DocumentPackage data)
 {
     try
     {
         SetService(); SerClient.DeleteDocumentPackage(data);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
        private void btnMove_Click(object sender, RoutedEventArgs e)
        {
            ProductStock record;
            curPack = sourceTree.SelectedItem as DocumentPackage;
            newPack = destTree.SelectedItem as DocumentPackage;

            IEnumerable<WpfFront.WMSBusinessService.Label> affectedLabels;
            IList<WpfFront.WMSBusinessService.Label> movedLabels = new List<WpfFront.WMSBusinessService.Label>();


            if (pkgDetails1.SelectedItems == null)
            {
                Util.ShowError("Please select package details to process.");
                return;
            }

            if (newPack == null || newPack.PackID == 0)
            {
                Util.ShowError("Please select a destination package.");
                return;
            }

            if (newPack.PackID == curPack.PackID)
            {
                Util.ShowError("Source and destination package are the same.");
                return;
            }

            if (newPack.Document.DocID != curPack.Document.DocID)
            {
                Util.ShowError("Source and destination document are different");
                LoadTrees();
                return;
            }


            if (newPack.IsClosed == true)
            {
                Util.ShowError("Destination package is closed.");
                return;
            }



            try
            {

                foreach (Object obj in pkgDetails1.SelectedItems)
                {
                    record = obj as ProductStock;

                    //Trae los labels de ese package
                    if (curPack.PackID > 0)

                        affectedLabels = service.GetLabel(
                            new WpfFront.WMSBusinessService.Label
                            {
                                FatherLabel = curPack.PackLabel,
                                Product = record.Product
                            });

                    else
                        affectedLabels = service.GetLabel(
                            new WpfFront.WMSBusinessService.Label
                            {
                                FatherLabel = rootPackage.PackLabel,
                                Product = record.Product
                            });


                    if (affectedLabels.Count() == 0)
                        continue;

                    //Actualizado los Labels Afectados
                    foreach (WpfFront.WMSBusinessService.Label lbl in affectedLabels)
                    {
                        lbl.FatherLabel = newPack.PackLabel;
                        lbl.ModifiedBy = App.curUser.UserName;
                        lbl.ModDate = DateTime.Now;

                        movedLabels.Add(lbl);
                        //service.UpdateLabel(lbl);
                    }

                }

                //Nuevo servicio del 22 de oct de 2009
                service.UpdatePackageMovedLabels(movedLabels);


            }
            catch (Exception ex)
            {
                Util.ShowError("Problem updating packages.\n" + ex.Message);
            }

            //Refreshing the details
            PackDetails1 = service.GetLabelStock(curPack.PackLabel);


        }
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            if (sourceTree.SelectedItem == null)
            {
                Util.ShowError("No source package selected to create the new package inside.");
                return;
            }

            curPack = sourceTree.SelectedItem as DocumentPackage;

            newPack = new DocumentPackage
            {
                ParentPackage = curPack,
                CreatedBy = App.curUser.UserName,
                CreationDate = DateTime.Now,
                Document = curPack.Document

            };

            string pkgType = "B";
            if (((Button)sender).Name == "btnNew")
                pkgType = "P";


            //Adicionar el Package a la vista original
            newPack = service.CreateNewPackage(curPack.Document, App.curUser, true, curPack, pkgType);

            newPack.PostingDocument = curPack.PostingDocument;
            newPack.PostingDate = curPack.PostingDate;
            newPack.PostingUserName = curPack.PostingUserName;
            
            //Adicionar info para el arbol en el device
            //Level -1, 0, 1, 2 //restrict level 3
            //PackagePath PLT1 # 102047
            //SubSequence
            //CurrentDesc PLT1/BOX1
            if (newPack.ParentPackage == null)
            {
                newPack.Level = 0;
                newPack.SubSequence = Packages[0].ChildPackages.Count+1;
               
                try
                {
                    if (newPack.PackageType == "P") {
                        newPack.CurrentDesc = "PLT" + newPack.SubSequence.ToString();
                        newPack.PackDescExt = "PLT" + newPack.SubSequence.ToString() + " # " + newPack.PackLabel.LabelCode;
                        
                    }
                    else if (newPack.PackageType == "B") {
                        newPack.CurrentDesc = "BOX" + newPack.SubSequence.ToString();
                        newPack.PackDescExt = "BOX" + newPack.SubSequence.ToString() + " # " + newPack.PackLabel.LabelCode;
                    }
                }
                catch { }
            }
            else
            {
                newPack.Level = newPack.ParentPackage.Level + 1;

                try { newPack.SubSequence = newPack.ParentPackage.ChildPackages.Count + 1; }
                catch { newPack.SubSequence = 1; }

                try { newPack.PackagePath = newPack.ParentPackage.CurrentDesc + " # " + newPack.PackLabel.LabelCode; }
                catch {}

                try
                {
                    if (newPack.PackageType == "B")
                    {
                        newPack.CurrentDesc = newPack.ParentPackage.CurrentDesc + "/BOX" + newPack.SubSequence;
                        newPack.PackDescExt = "BOX" + newPack.SubSequence.ToString() + " # " + newPack.PackLabel.LabelCode;
                    }
                }
                catch { }

            }
                                 

            service.UpdateDocumentPackage(newPack);

            if (curPack.ChildPackages == null)
                curPack.ChildPackages = new List<DocumentPackage>();

            curPack.ChildPackages.Add(newPack);
            sourceTree.Items.Refresh();

            destTree.ItemsSource = sourceTree.ItemsSource;
            destTree.Items.Refresh();

            //Si es una caja, Nivel 2 Inprime el label.
            if (newPack.ParentPackage != null && newPack.ParentPackage.PackID != 0)
            {
                ProcessWindow pw = new ProcessWindow("Printing Package Label ...");
                try
                {
                    service.PrintLabelsFromDevice(WmsSetupValues.DEFAULT, WmsSetupValues.DefaultPackLabelTemplate,
                            new List<WpfFront.WMSBusinessService.Label> { newPack.PackLabel });
                }
                catch { }
                finally { pw.Close(); }
            }


        }
 internal void MoveQtyBetweenPackages(DocumentPackage curPack, DocumentPackage newPack, Product product, 
     double qty)
 {
     try
     {
         SetService();
         SerClient.MoveQtyBetweenPackages(curPack, newPack, product, qty);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
        /// <summary>
        /// Get the document's metadata from the package.
        /// </summary>
        /// <returns>The document's metadata.</returns>
        /// <param name="package">The DocumentPackage we want to get document from.</param>
        /// <param name="documentId">Id of document to get.</param>
        public Silanis.ESL.SDK.Document GetDocumentMetadata(DocumentPackage package, string documentId)
        {
            string path = template.UrlFor(UrlTemplate.DOCUMENT_ID_PATH)
                .Replace("{packageId}", package.Id.Id)
                .Replace("{documentId}", documentId)
                .Build();

            try
            {
                string response = restClient.Get(path);
                Silanis.ESL.API.Document apiDocument = JsonConvert.DeserializeObject<Silanis.ESL.API.Document> (response, settings);

                // Wipe out the members not related to the metadata

                return new DocumentConverter(apiDocument, new DocumentPackageConverter(package).ToAPIPackage()).ToSDKDocument();
            }
            catch (EslServerException e)
            {
                throw new EslServerException("Could not get the document's metadata." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e)
            {
                throw new EslException("Could not get the document's metadata." + " Exception: " + e.Message,e);
            }
        }
		public DocumentPackage Build ()
		{
			Support.LogMethodEntry();
			DocumentPackage package = new DocumentPackage (id, packageName, autocomplete, signers, documents);

			package.Description = description;
			package.ExpiryDate = expiryDate;
			package.EmailMessage = emailMessage;
			package.Status = status;
			package.Language = language;
            package.Settings = settings;
            package.SenderInfo = senderInfo;
            package.Attributes = attributes;

			Support.LogMethodExit(package);
			return package;
		}
 internal void CloseDocumentPackage(DocumentPackage newPack)
 {
     try
     {
         SetService();
         SerClient.CloseDocumentPackage(newPack);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
        private void AddSerial()
        {

            if (string.IsNullOrEmpty(txtUnique.Text))
            {
                Util.ShowError("No valid data.");
                return;
            }


            try
            {
                //Mueve uno de los labels existentes al package indicado.

                //1. Validar package is selected
                //Mueve un serial de una caja a otra.
                newPack = sourceTree.SelectedItem as DocumentPackage;

                if (newPack == null || newPack.PackID == 0)
                {
                    Util.ShowError("Please select a package.");
                    txtUnique.Text = "";
                    return;
                }

                if (newPack.IsClosed == true)
                {
                    Util.ShowError("Package is closed.");
                    return;
                }

                //2. Buscar el S/N - labelcode dentro de el listado de labels del shipment
                WpfFront.WMSBusinessService.Label labelToPack;
                try
                {
                    labelToPack = service.GetNodeTrace(new NodeTrace
                    {
                        Label = new WpfFront.WMSBusinessService.Label { LabelCode = txtUnique.Text },
                        Document = curDoc,
                        PostingDocument = curPosted
                    }).Select(f => f.Label).First();
                }
                catch
                {
                    Util.ShowError("S/N or Barcode not found in the shipment.");
                    txtUnique.Text = "";
                    return;
                }

                //3. Cambiar el Label de posicion al nuevo Package.
                labelToPack.FatherLabel = newPack.PackLabel;
                labelToPack.ModDate = DateTime.Now;
                labelToPack.ModifiedBy = App.curUser.UserName;
                service.UpdateLabel(labelToPack);

                //4. Refresh 
                if (!PackDetailsSN.Any(f => f.LabelID == labelToPack.LabelID))
                {
                    PackDetailsSN.Add(labelToPack);
                    lvSerials.Items.Refresh();
                }

            }
            finally
            {
                txtUnique.Text = "";
                txtUnique.Focus();
            }

        }
        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            newPack = sourceTree.SelectedItem as DocumentPackage;

            if (newPack == null || newPack.PackID == 0)
            {
                return;
            }

            newPack.IsClosed = false;
            service.UpdateDocumentPackage(newPack);

            stkOparations.Visibility = stkSN.Visibility = Visibility.Visible;

        }
		public void UpdateDocumentMetadata(DocumentPackage template, Document document)
		{
			packageService.UpdateDocumentMetadata(template, document);
		}
 internal DocumentPackage CreateNewPackage(Document document, SysUser sysUser, bool isOpen, 
     DocumentPackage parent, string packType)
 {
     try
     {
         SetService();
         return SerClient.CreateNewPackage(document, sysUser, isOpen, parent, packType);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            newPack = sourceTree.SelectedItem as DocumentPackage;

            if (newPack == null || newPack.PackID == 0)
            {
                return;
            }

            //Manda a cerrar el package y sus hijos
            service.CloseDocumentPackage(newPack);

            stkOparations.Visibility = stkSN.Visibility = Visibility.Hidden;

        }
        private void PrintParentLabel(DocumentPackage parentPack)
        {

            ProcessWindow pw = new ProcessWindow("Printing Label ... ");

            try
            {
                service.PrintLabelsFromDevice(WmsSetupValues.DEFAULT, WmsSetupValues.DefaultPalletLabelTemplate,
                    new List<WpfFront.WMSBusinessService.Label> { parentPack.PackLabel });
            }
            catch { }
            finally { pw.Close(); }

            /*
            DocumentPackage basePack = service.GetDocumentPackage(new DocumentPackage
            {
                PostingDocument = curPosted,
                ParentPackage = new DocumentPackage { PackID = -1 }
            }).First();

            //Acomoda el label del pallet para que salga en el Template de los packages.
            WpfFront.WMSBusinessService.Label parentLabel = basePack.PackLabel;

            parentLabel.LabelCode = parentLabel.Barcode = "SHPMNT " + curPosted.DocNumber;
            parentLabel.Package.Sequence = 0;
            parentLabel.Package.Weight = 0;
            parentLabel.Package.Dimension = "";
            parentLabel.Package.Pieces = 0;
            parentLabel.CurrQty = 0;
            parentLabel.StartQty = 0;
            parentLabel.LabelID = 0;
            parentLabel.Package.PackID = 0;
            */
        }
        private void LoadTrees()
        {
            DocumentPackage target = new DocumentPackage
            {
                //PostingDocument = curPosted != null ? curPosted : new Document { DocID = -1 },
                Document = curDoc,
                ParentPackage = new DocumentPackage { PackID = -1 }
            };

            if (Util.GetConfigOption("ONESHIPMENT").Equals("T") && curPosted == null)
                target.PostingDocument = null;
            else
                target.PostingDocument = curPosted != null ? curPosted : new Document { DocID = -1 };


            IList<DocumentPackage> oriPacks = service.GetDocumentPackage(target);

            if (oriPacks == null || oriPacks.Count == 0)
                return;

            //Solo me trae los que no sean el ROOT y en el document carga el ROOT.
            Packages[0].ChildPackages = oriPacks.Where(f=>f.PackageType != "R").ToList();

            rootPackage = oriPacks.Where(f => f.PackageType == "R").First();

            sourceTree.Items.Refresh();
            destTree.Items.Refresh();
        }
		/// <summary>
		/// Uploads the Document and file in byte[] to the package.
		/// </summary>
		/// <param name="packageId">The package id.</param>
		/// <param name="fileName">The name of the document.</param>
		/// <param name="fileBytes">The file to upload in bytes.</param>
		/// <param name="document">The document object that has field settings.</param>
		internal Document UploadDocument (DocumentPackage package, string fileName, byte[] fileBytes, Document document)
		{
			string path = template.UrlFor (UrlTemplate.DOCUMENT_PATH)
				.Replace ("{packageId}", package.Id.Id)
					.Build ();

			Silanis.ESL.API.Package internalPackage = new DocumentPackageConverter(package).ToAPIPackage();
			Silanis.ESL.API.Document internalDoc = new DocumentConverter(document).ToAPIDocument(internalPackage);

			try 
			{
				string json = JsonConvert.SerializeObject (internalDoc, settings);
				byte[] payloadBytes = Converter.ToBytes (json);

				string boundary = GenerateBoundary ();
				byte[] content = CreateMultipartContent (fileName, fileBytes, payloadBytes, boundary);

				string response = restClient.PostMultipartFile(path, content, boundary, json);

				Silanis.ESL.API.Document uploadedDoc = JsonConvert.DeserializeObject<Silanis.ESL.API.Document>(response);
				return new DocumentConverter(uploadedDoc, internalPackage).ToSDKDocument();
			} 
            catch (EslServerException e) 
            {
                throw new EslServerException ("Could not upload document to package." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) 
			{
				throw new EslException ("Could not upload document to package." + " Exception: " + e.Message, e);
			}
		}
        private int GetCurrentPieces(DocumentPackage pack)
        {

            if (pack.ChildPackages != null && pack.ChildPackages.Count > 0)

                foreach (DocumentPackage dp in pack.ChildPackages)
                    curPieces += GetCurrentPieces(dp);

            curPieces += (int)pack.CalculatedPieces;

            return curPieces;
        }
        private void btnMovePack_Click(object sender, RoutedEventArgs e)
        {
            //Move a Package to another.
            curPack = sourceTree.SelectedItem as DocumentPackage;
            newPack = destTree.SelectedItem as DocumentPackage;

            if (curPack.PackID == 0)
            {
                Util.ShowError("Please select a valid package.");
                return;
            }


            if (newPack == null)
            {
                Util.ShowError("Please select a destination package.");
                return;
            }

            if (newPack.PackID == curPack.PackID)
            {
                Util.ShowError("Source and destination package are the same.");
                return;
            }

            if (newPack.Document.DocID != curPack.Document.DocID)
            {
                Util.ShowError("Source and destination document are different");
                LoadTrees();
                return;
            }


            if (newPack.IsClosed == true)
            {
                Util.ShowError("Destination package is closed.");
                return;
            }


            isChild = false;

            LookForChild(curPack, newPack);

            if (isChild)
            {
                Util.ShowError("Invalid change. Destination package is child of the source package.");
                return;
            }



            if (newPack.PackID == 0)
            {
                curPack.ParentPackage = null;
                curPack.PackLabel.FatherLabel = null;
            }
            else
            {
                curPack.ParentPackage = newPack;
                curPack.PackLabel.FatherLabel = newPack.PackLabel;
            }

            //Updating the package    
            bool save = true;
            while (save)
            {
                try
                {
                    service.UpdateDocumentPackage(curPack);
                    save = false;
                }
                catch { }
            }

           
            LoadTrees();
        }
        private void btnMoveRetail_Click(object sender, RoutedEventArgs e)
        {
            ProductStock record = pkgDetails1.SelectedItem as ProductStock;
            curPack = sourceTree.SelectedItem as DocumentPackage;
            newPack = destTree.SelectedItem as DocumentPackage;

            if (record == null)
            {
                Util.ShowError("Please select a line to process.");
                return;
            }

            if (newPack == null || newPack.PackID == 0 )
            {
                Util.ShowError("Please select a destination package.");
                return;
            }

            if (newPack.PackID == curPack.PackID)
            {
                Util.ShowError("Source and destination package are the same.");
                return;
            }

            if (newPack.Document.DocID != curPack.Document.DocID)
            {
                Util.ShowError("Source and destination document are different");
                LoadTrees();
                return;
            }

            if (newPack.IsClosed == true)
            {
                Util.ShowError("Destination package is closed.");
                return;
            }

            try
            {


                //DEfine si Curpack debe ser el root
                //if (curPack.PackID == 0)
                    //curPack = rootPackage;


                double qty;
                if (!double.TryParse(txtQty.Text, out qty))
                {
                    Util.ShowError("Please enter a valid quantity.");
                    return;
                }

                if (qty > record.Stock)
                {
                    Util.ShowError("Qty to move is greather than available.");
                    txtQty.Text = record.Stock.ToString();
                    return;
                }

                //Mover la cantidad seleccionada de un Paquete a Otro.
                if (newPack.CreatedBy == null)
                    newPack.CreatedBy = App.curUser.UserName;


                if (curPack.PackID == 0)
                    service.MoveQtyBetweenPackages(rootPackage, newPack, record.Product, qty);
                else
                    service.MoveQtyBetweenPackages(curPack, newPack, record.Product, qty);

            }
            catch (Exception ex)
            {
                Util.ShowError("Problem updating packages.\n" + ex.Message);
            }

            //Refreshing the details
            PackDetails1 = service.GetLabelStock(curPack.PackLabel);
            txtQty.Text = "";
        }
 public DocumentPackage SaveDocumentPackage(DocumentPackage data)
 {
     try
     {
         SetService(); return SerClient.SaveDocumentPackage(data);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
        private void LookForChild(DocumentPackage pack, DocumentPackage newPack)
        {
            if (isChild)
                return;

            if (pack.ChildPackages != null && pack.ChildPackages.Count > 0)
            {
                foreach (DocumentPackage dp in pack.ChildPackages)
                {
                    if (dp.PackID == newPack.PackID)
                    {
                        isChild = true;
                        return;
                    }
                    else
                        LookForChild(dp, newPack);
                }
            }
        }
        /// <summary>
        /// Updates the document's data, but not the actually document binary..
        /// </summary>
        /// <param name="package">The DocumentPackage to update.</param>
        /// <param name="document">The Document to update.</param>
		public void UpdateDocumentMetadata(DocumentPackage package, Document document)
        {
            string path = template.UrlFor(UrlTemplate.DOCUMENT_ID_PATH)
				.Replace("{packageId}", package.Id.Id)
				.Replace("{documentId}", document.Id)
				.Build();

            Silanis.ESL.API.Package apiPackage = new DocumentPackageConverter(package).ToAPIPackage();
            Silanis.ESL.API.Document apiDocument = new DocumentConverter(document).ToAPIDocument(apiPackage);

            foreach (Silanis.ESL.API.Document apiDoc in apiPackage.Documents)
            {
                if (apiDoc.Id.Equals(document.Id))
                {
                    apiDocument = apiDoc;
                    break;
                }
            }
            if (apiDocument == null)
            {
                throw new EslException("Document is not part of the package.", null);
            }
            
			try 
			{
				string json = JsonConvert.SerializeObject (apiDocument, settings);
				restClient.Post(path, json);
			} 
            catch (EslServerException e) 
            {
                throw new EslServerException ("Could not update the document's metadata." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) 
			{
                throw new EslException ("Could not update the document's metadata." + " Exception: " + e.Message, e);
			}

            IContractResolver prevContractResolver = settings.ContractResolver;
            settings.ContractResolver = DocumentMetadataContractResolver.Instance;            
            
            try
            {
                string json = JsonConvert.SerializeObject(apiDocument, settings);
                restClient.Post(path, json);
            }
            catch (EslServerException e) 
            {
                throw new EslServerException ("Could not upload document to package." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e)
            {
                throw new EslException("Could not upload document to package." + " Exception: " + e.Message, e);
            }
            finally
            {
                settings.ContractResolver = prevContractResolver;
            }
		}
        private void btnMoveSN_Click(object sender, RoutedEventArgs e)
        {
            //Mueve un serial de una caja a otra.
            curPack = sourceTree.SelectedItem as DocumentPackage;
            newPack = destTree.SelectedItem as DocumentPackage;

            //if (curPack.PackID == 0)
            //{
            //    Util.ShowError("Please select a valid package.");
            //    return;
            //}


            if (newPack == null || newPack.PackID == 0)
            {
                Util.ShowError("Please select a destination package.");
                return;
            }

            if (newPack.PackID == curPack.PackID)
            {
                Util.ShowError("Source and destination package are the same.");
                return;
            }


            if (newPack.Document.DocID != curPack.Document.DocID)
            {
                Util.ShowError("Source and destination document are different");
                LoadTrees();
                return;
            }

            if (newPack.PackID == 0)
            {
                Util.ShowError("Please select a valid destination package.");
                return;
            }

            if (lvSerials.SelectedItem == null)
            {
                Util.ShowError("No serial barcode selected.");
                return;
            }

            if (newPack.IsClosed == true)
            {
                Util.ShowError("Destination package is closed.");
                return;
            }


            //Define si Curpack debe ser el root
            //if (curPack.PackID == 0)
                //curPack = rootPackage;


            IList<WpfFront.WMSBusinessService.Label> movedLabels = new List<WpfFront.WMSBusinessService.Label>();
            
            foreach (WpfFront.WMSBusinessService.Label affectedLabel in lvSerials.SelectedItems)
            {
                affectedLabel.FatherLabel = newPack.PackLabel;
                affectedLabel.ModDate = DateTime.Now;
                affectedLabel.ModifiedBy = App.curUser.UserName;

                movedLabels.Add(affectedLabel);
                PackDetailsSN.Remove(affectedLabel);
            }

            service.UpdatePackageMovedLabels(movedLabels);
            lvSerials.Items.Refresh();

        }
		public void OrderSigners(DocumentPackage package)
		{
			string path = template.UrlFor (UrlTemplate.ROLE_PATH)
				.Replace ("{packageId}", package.Id.Id)
				.Build ();

			List<Silanis.ESL.API.Role> roles = new List<Silanis.ESL.API.Role>();
			foreach (Signer signer in package.Signers.Values)
			{
				roles.Add(new SignerConverter(signer).ToAPIRole(signer.Id));
			}

			try 
			{
				string json = JsonConvert.SerializeObject (roles, settings);
				restClient.Put(path, json);
			} 
            catch (EslServerException e) 
            {
                throw new EslServerException ("Could not order signers." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) 
			{
				throw new EslException ("Could not order signers." + " Exception: " + e.Message, e);
			}
		}