Exemplo n.º 1
0
        override public void Execute()
        {
            Placeholder     signer1Id         = new Placeholder(Guid.NewGuid().ToString());
            DocumentPackage superDuperPackage =
                PackageBuilder.NewPackageNamed("SignerManipulationExample: " + DateTime.Now)
                .DescribedAs("This is a package created using the e-SignLive SDK")
                .WithSigner(SignerBuilder.NewSignerWithEmail(email1)
                            .WithFirstName("firstName1")
                            .WithLastName("lastName1")
                            .WithTitle("Title1")
                            )
                .WithSigner(SignerBuilder.NewSignerWithEmail(email2)
                            .WithFirstName("firstName2")
                            .WithLastName("lastName2")
                            .WithTitle("Title2")
                            )
                .Build();

            packageId = eslClient.CreatePackage(superDuperPackage);

            DocumentPackage createdPackage = eslClient.GetPackage(packageId);

            string signerId  = createdPackage.Signers[email1].Id;
            string signer2Id = createdPackage.Signers[email2].Id;

//            eslClient.SignerService.UpdateSigner( packageId, signerId, SignerBuilder.NewSignerWithEmail(email1)
//                                                                    .WithFirstName("firstName1b")
//                                                                    .WithLastName("lastName1b")
//                                                                    .WithTitle("title1b") );

            string addedSignerId = eslClient.PackageService.AddSigner(packageId,
                                                                      SignerBuilder.NewSignerWithEmail(email3)
                                                                      .WithFirstName("firstName3")
                                                                      .WithLastName("lastName3")
                                                                      .WithTitle("Title3")
                                                                      .Lock()
                                                                      .Build()
                                                                      );

            string placeHolderId = eslClient.PackageService.AddSigner(packageId,
                                                                      SignerBuilder.NewSignerPlaceholder(new Placeholder("placeHolderRoleId"))
                                                                      .Build()
                                                                      );

            Group  avengers           = eslClient.GroupService.CreateGroup(GroupBuilder.NewGroup(Guid.NewGuid().ToString()).WithEmail("*****@*****.**").Build());
            string addedGroupSignerId = eslClient.PackageService.AddSigner(packageId,
                                                                           SignerBuilder.NewSignerFromGroup(avengers.Id)
                                                                           .Build());

            eslClient.PackageService.RemoveSigner(packageId, placeHolderId);
            eslClient.PackageService.RemoveSigner(packageId, signerId);

            eslClient.PackageService.UpdateSigner(packageId, SignerBuilder.NewSignerWithEmail("*****@*****.**")
                                                  .WithCustomId(signer2Id)
                                                  .WithFirstName("updateFirstName1")
                                                  .WithLastName("updateLastName1")
                                                  .WithTitle("UpdatedTitle1")
                                                  .Build());

            Signer retrievedSigner = eslClient.PackageService.GetSigner(packageId, addedSignerId);

            //eslClient.SendPackage(packageId);
            eslClient.PackageService.UnlockSigner(PackageId, addedSignerId);
        }
Exemplo n.º 2
0
        override public void Execute()
        {
            inviteUsersToMyAccount();
            displayAccountGroupsAndMembers();
            Group emptyGroup = GroupBuilder.NewGroup(Guid.NewGuid().ToString())
                               .WithId(new GroupId(Guid.NewGuid().ToString()))
                               .WithEmail("*****@*****.**")
                               .WithoutIndividualMemberEmailing()
                               .Build();

            createdEmptyGroup = ossClient.GroupService.CreateGroup(emptyGroup);
            List <GroupMember> retrievedEmptyGroup = ossClient.GroupService.GetGroupMembers(createdEmptyGroup.Id);

            GroupMember addMember = ossClient.GroupService.AddMember(createdEmptyGroup.Id,
                                                                     GroupMemberBuilder.NewGroupMember(email1)
                                                                     .AsMemberType(GroupMemberType.MANAGER)
                                                                     .Build());
            Group inviteMember = ossClient.GroupService.InviteMember(createdEmptyGroup.Id,
                                                                     GroupMemberBuilder.NewGroupMember(email3)
                                                                     .AsMemberType(GroupMemberType.MANAGER)
                                                                     .Build());

            Console.Out.WriteLine("GroupId: " + createdEmptyGroup.Id.Id);
            retrievedEmptyGroup = ossClient.GroupService.GetGroupMembers(createdEmptyGroup.Id);

            String groupName = Guid.NewGuid().ToString();
            Group  group1    = GroupBuilder.NewGroup(GROUP_NAME_PREFIX + groupName)
                               .WithId(new GroupId(Guid.NewGuid().ToString()))
                               .WithMember(GroupMemberBuilder.NewGroupMember(email1)
                                           .AsMemberType(GroupMemberType.MANAGER))
                               .WithMember(GroupMemberBuilder.NewGroupMember(email3)
                                           .AsMemberType(GroupMemberType.MANAGER))
                               .WithEmail(EMAIL)
                               .WithIndividualMemberEmailing()
                               .Build();

            createdGroup1 = ossClient.GroupService.CreateGroup(group1);
            Console.Out.WriteLine("GroupId #1: " + createdGroup1.Id.Id);

            ossClient.GroupService.AddMember(createdGroup1.Id,
                                             GroupMemberBuilder.NewGroupMember(email3)
                                             .AsMemberType(GroupMemberType.MANAGER)
                                             .Build());

            ossClient.GroupService.AddMember(createdGroup1.Id,
                                             GroupMemberBuilder.NewGroupMember(email4)
                                             .AsMemberType(GroupMemberType.REGULAR)
                                             .Build());

            retrievedGroup1 = ossClient.GroupService.GetGroup(createdGroup1.Id);
            // Retrieve by group name
            retrievedGroupByName1 = ossClient.GroupService.GetMyGroups(createdGroup1.Name);

            String groupName2 = Guid.NewGuid().ToString();
            Group  group2     = GroupBuilder.NewGroup(GROUP_NAME_PREFIX + groupName2)
                                .WithMember(GroupMemberBuilder.NewGroupMember(email2)
                                            .AsMemberType(GroupMemberType.MANAGER))
                                .WithEmail(EMAIL)
                                .WithIndividualMemberEmailing()
                                .Build();

            createdGroup2   = ossClient.GroupService.CreateGroup(group2);
            retrievedGroup2 = ossClient.GroupService.GetGroup(createdGroup2.Id);
            Console.Out.WriteLine("GroupId #2: " + createdGroup2.Id.Id);

            String groupName3 = Guid.NewGuid().ToString();
            Group  group3     = GroupBuilder.NewGroup(GROUP_NAME_PREFIX + groupName3)
                                .WithMember(GroupMemberBuilder.NewGroupMember(email3)
                                            .AsMemberType(GroupMemberType.MANAGER))
                                .WithEmail(EMAIL)
                                .WithIndividualMemberEmailing()
                                .Build();

            createdGroup3 = ossClient.GroupService.CreateGroup(group3);
            Console.Out.WriteLine("GroupId #3: " + createdGroup3.Id.Id);
            retrievedGroup3 = ossClient.GroupService.GetGroup(createdGroup3.Id);
            // Retrieve by group name
            retrievedByNamePrefix = ossClient.GroupService.GetMyGroups(GROUP_NAME_PREFIX);

            allGroupsBeforeDelete = ossClient.GroupService.GetMyGroups();

            allGroupsAfterDelete = ossClient.GroupService.GetMyGroups();

            Group updatedGroup = GroupBuilder.NewGroup(Guid.NewGuid().ToString())
                                 .WithMember(GroupMemberBuilder.NewGroupMember(email2)
                                             .AsMemberType(GroupMemberType.MANAGER))
                                 .WithMember(GroupMemberBuilder.NewGroupMember(email3)
                                             .AsMemberType(GroupMemberType.REGULAR))
                                 .WithMember(GroupMemberBuilder.NewGroupMember(email4)
                                             .AsMemberType(GroupMemberType.REGULAR))
                                 .WithEmail(EMAIL)
                                 .WithIndividualMemberEmailing()
                                 .Build();

            createdGroup3Updated = ossClient.GroupService.UpdateGroup(updatedGroup, createdGroup3.Id);

            groupMemberEmailsAfterUpdate = ossClient.GroupService.GetGroupMemberEmails(createdGroup3Updated.Id);

            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(PackageName)
                                                .WithSigner(SignerBuilder.NewSignerFromGroup(createdGroup1.Id)
                                                            .CanChangeSigner()
                                                            .DeliverSignedDocumentsByEmail())
                                                .WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
                                                              .FromStream(fileStream1, DocumentType.PDF)
                                                              .WithSignature(SignatureBuilder.SignatureFor(createdGroup1.Id)
                                                                             .OnPage(0)
                                                                             .AtPosition(100, 100)))
                                                .Build();

            PackageId packageId = ossClient.CreatePackage(superDuperPackage);

            ossClient.SendPackage(packageId);

            ossClient.PackageService.NotifySigner(packageId, createdGroup1.Id);

            DocumentPackage result = ossClient.GetPackage(packageId);

            ossClient.GroupService.DeleteGroup(createdGroup1.Id);
            ossClient.GroupService.DeleteGroup(createdGroup2.Id);
            ossClient.GroupService.DeleteGroup(createdGroup3.Id);
        }