コード例 #1
0
		public ReminderSchedule ToSDKReminderSchedule()
		{
			if (sdk != null)
			{
				return sdk;
			}
			else
			{
				ReminderSchedule result = new ReminderSchedule();
				if (api.PackageId != null && !api.PackageId.Equals(""))
				{
					result.PackageId = new PackageId(api.PackageId);
				}
                if (api.StartInDaysDelay.HasValue)
				    result.DaysUntilFirstReminder = api.StartInDaysDelay.Value;
                if (api.IntervalInDays.HasValue)
				    result.DaysBetweenReminders = api.IntervalInDays.Value;
                if (api.RepetitionsCount.HasValue)
				    result.NumberOfRepetitions = api.RepetitionsCount.Value;

				foreach (PackageReminder apiReminder in api.Reminders)
				{
					result.Reminders.Add(new ReminderConverter(apiReminder).ToSDKReminder());
				}
				return result;
			}
		}
コード例 #2
0
		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 );

			eslClient.ReminderService.SetReminderScheduleForPackage(
				ReminderScheduleBuilder.ForPackageWithId(packageId)
					.WithDaysUntilFirstReminder(2)
					.WithDaysBetweenReminders(1)
					.WithNumberOfRepetitions(5)
					.Build()
			);

			reminderSchedule = eslClient.ReminderService.GetReminderScheduleForPackage(packageId);

			eslClient.SendPackage( packageId );

			eslClient.ReminderService.ClearReminderScheduleForPackage(packageId);
		}
コード例 #3
0
		public ReminderSchedule Build()
		{
			ReminderSchedule result = new ReminderSchedule();
			result.PackageId = packageId;
			result.DaysBetweenReminders = daysBetweenReminders;
			result.DaysUntilFirstReminder = daysUntilFirstReminder;
			result.NumberOfRepetitions = numberOfRepetitions;

			return result;
		}
コード例 #4
0
		public ReminderSchedule Build()
		{
			Support.LogMethodEntry();
			ReminderSchedule result = new ReminderSchedule();
			result.PackageId = packageId;
			result.DaysBetweenReminders = daysBetweenReminders;
			result.DaysUntilFirstReminder = daysUntilFirstReminder;
			result.NumberOfRepetitions = numberOfRepetitions;
			Support.LogMethodExit(result);
			return result;
		}
コード例 #5
0
		public void ToAPIWithNoIDAndNoReminders()
		{
			ReminderSchedule sdk = new ReminderSchedule();
			sdk.NumberOfRepetitions = 5;
			sdk.DaysUntilFirstReminder = 10;
			sdk.DaysBetweenReminders = 15;
			PackageReminderSchedule api = new ReminderScheduleConverter(sdk).ToAPIPackageReminderSchedule();

			Assert.IsNotNull(api);
			Assert.AreEqual("", api.PackageId);
			Assert.AreEqual(5, api.RepetitionsCount);
			Assert.AreEqual(10, api.StartInDaysDelay);
			Assert.AreEqual(15, api.IntervalInDays);
			Assert.IsNotNull(api.Reminders);
			Assert.AreEqual(0, api.Reminders.Count);
		}
コード例 #6
0
		public void ToAPI()
		{
			ReminderSchedule sdk = new ReminderSchedule();
			sdk.PackageId = new PackageId("bob");
			sdk.NumberOfRepetitions = 5;
			sdk.DaysUntilFirstReminder = 10;
			sdk.DaysBetweenReminders = 15;
			sdk.Reminders.Add(new Reminder(DateTime.Now, DateTime.Now));
			sdk.Reminders.Add(new Reminder(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1)));
			sdk.Reminders.Add(new Reminder(DateTime.Now.AddDays(2), DateTime.Now.AddDays(2)));

			PackageReminderSchedule api = new ReminderScheduleConverter(sdk).ToAPIPackageReminderSchedule();

			Assert.IsNotNull(api);
			Assert.IsNotNull(api.PackageId);
			Assert.AreEqual("bob", api.PackageId);
			Assert.AreEqual(5, api.RepetitionsCount);
			Assert.AreEqual(10, api.StartInDaysDelay);
			Assert.AreEqual(15, api.IntervalInDays);

			Assert.IsNotNull(api.Reminders);
			Assert.AreEqual(3, api.Reminders.Count);

			foreach( Reminder reminder in sdk.Reminders )
			{
				PackageReminder apiReminder = null;

				foreach (PackageReminder packageReminder in api.Reminders)
				{
					if (reminder.Date.Equals(packageReminder.Date) && reminder.SentDate.Equals(packageReminder.SentDate))
					{
						apiReminder = packageReminder;
						break;
					}
				}

				Assert.IsNotNull(apiReminder);
			}
		}
コード例 #7
0
		public ReminderScheduleConverter( ReminderSchedule sdk )
		{
			this.api = null;
			this.sdk = sdk;
		}
コード例 #8
0
		public ReminderScheduleConverter( PackageReminderSchedule api )
        {
			this.api = api;
			this.sdk = null;
        }