public static void CapturePropertiesForAdd(EventV2 source, Event target) { if (!string.IsNullOrEmpty(source.CostCenter) && source.CostCenter.Length > 15) throw new BusinessException("Error processing the event '" + source.Title + "' - Cost center cannot be longer than 15 characaters"); target.ContactName = source.ContactName; target.ContactEmail = source.ContactEmail; target.ContactPhone = source.ContactPhone; target.MaximumAttendees = GetNullableInt(source.MaximumAttendees); target.Cost = Convert.ToDecimal(source.Cost, CultureInfo.InvariantCulture); target.UpdatedDate = DateTime.UtcNow; target.InternalOnly = GetBooleanValue(source.InternalOnly); target.IsEnabled = GetBooleanValue(source.IsEnabled); target.PublicOnly = GetBooleanValue(source.PublicOnly); target.ExternalUrl = source.ExternalUrl; target.ImagePath = source.ImagePath; target.PictureId = GetNullableInt(source.PictureId); target.SetTitle(source.Title); target.SetSummaryDescription(source.SummaryDescription); target.CostCenter = source.CostCenter; target.Keywords = source.Keywords; target.CustomKeywords = source.CustomKeywords; target.EventContent = source.EventContent; target.IsRegistrationEnabled = GetBooleanValue(source.IsRegistrationEnabled); target.IsNotificationListEnabled = GetBooleanValue(source.IsNotificationListEnabled); target.IsNotifyContactEnabled = GetBooleanValue(source.IsNotifyContactEnabled); target.NotificationFrequency = string.IsNullOrEmpty(source.NotificationFrequency) ? "Immediately" : source.NotificationFrequency; target.SpecialInstructions = source.SpecialInstructions; target.Custom1 = source.Custom1; target.Custom2 = source.Custom2; target.Custom3 = source.Custom3; DateTime? pubDate = string.IsNullOrEmpty(source.PublishDate) ? new DateTime?() : DateTime.Parse(source.PublishDate, CultureInfo.InvariantCulture); DateTime? unPubDate = string.IsNullOrEmpty(source.UnpublishDate) ? new DateTime?() : DateTime.Parse(source.UnpublishDate, CultureInfo.InvariantCulture); target.SetPublishDates(pubDate, unPubDate); target.AllowPayOnSite = GetBooleanValue(source.AllowPayOnSite); target.AllowDonation = source.AllowDonationAsBool; target.DonationDescription = source.DonationDescription; target.DonationButtonText = source.DonationButtonText; target.DonationExternalUrl = source.DonationExternalUrl; }
public void TestSetTitle_tooLong() { var anEvent = new Event(); anEvent.SetTitle(new string('X', 501)); }