AdministrationClientCreateProgram Method |
Create a new Program, from the submitted values.
public Result CreateProgram( ManagementGroupRequestOfProgram request )
using (var svc = new AdministrationService.AdministrationClient()) { var request = new AdministrationService.ManagementGroupRequestOfProgram(); request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin var program = new AdministrationService.Program(); program.RSN = Guid.NewGuid();//Required program.DisplayValue = "My new program"; //Required program.ProgramCode = "Program code"; //Required - must be unique program.Active = true; //Optional //field names/labels for associated ProgramMembership custom data fields program.CustomBoolean1 = "Enjoy shopping"; //Optional CustomBoolean2 - CustomBoolean20 available program.CustomDate1 = "Last shopping date"; //Optional CustomDate2 - CustomDate15 available program.CustomDecimal1 = "Last shopping total cost"; //Optional CustomDecimal2 - CustomDecimal5 available program.CustomInteger1 = "Number of items purchased"; //Optional CustomInteger2 - CustomInteger10 available program.CustomText1 = "Favourite shop"; //Optional CustomText2 - CustomText15 available program.PointsConversionRoundingMethod = "GAILMETHOD"; //Required Valid values are : 'GAILMETHOD', 'SWEDISHROUNDING' or 'TRUNCATE', program.ProgramLimitedTo = "Person"; //Required Valid values are : 'Person', 'Organisation' or 'PersonOrganisation', program.Quantity = 100; //Optional program.ActivateCardEmailCampaignRSN = Guid.Empty; //Optional program.ActivateCardEmailCampaignSegmentRSN = Guid.Empty; //Optional program.ActivateCardEmailTemplateID = string.Empty; //Optional program.AlwaysShipProductToHomePartner = false; //Optional program.DefaultPartnerOrganisation_RSN = Guid.Empty; //Optional program.VoucherEmailTemplateID = string.Empty; //Optional program.TierPointsThreshold = 0; //Optional program.TierName = string.Empty; //Optional program.TierLevelNumber = 0; //Optional program.StartDate = DateTime.Now; //Optional program.ReplaceVirtualCardEmailTemplateID = string.Empty; //Optional program.ReplacePhysicalCardEmailTemplateID = string.Empty; //Optional program.RenewalProductRSN = Guid.Empty; //Optional program.PromotionalPointsConversionFactor = 0.0M; //Optional program.ProgramMembershipDefaultNumberofDays = 0; //Optional program.Points_ProcessNegativeSaleTransactionItemsFromDate = DateTime.MinValue; //Optional program.PointsVoucherThresholdVoucherAmount = 0.0M; //Optional program.PointsVoucherThreshold = 0; //Optional program.PointsConversionFactor = 0.0M; //Optional program.ParentProgram_RSN = Guid.Empty; //Optional program.Owner_RSN = Guid.Empty; //Optional program.OnTerminatedOfMembership_AutoSetBalanceToZero = false; //Optional program.NextNumberSequenceName = string.Empty; //Optional program.HonorVoucherAfterMembershipTerminated = false; //Optional program.HomePartnerRequiredOnSignup = false; //Optional program.EndDate = DateTime.MinValue; //Optional program.VoucherEmailCampaignRSN = Guid.Empty; //Optional program.WelcomeEmailTemplateID = string.Empty; //Optional program.WelcomeEmailCampaignRSN = Guid.Empty; //Optional program.WelcomeEmailCampaignSegmentRSN = Guid.Empty; //Optional program.VoucherEmailCampaignSegmentRSN = Guid.Empty; //Optional var pointExpiry = new AdministrationService.Expiry(); pointExpiry.Period = "DAYS"; // Valid values are : 'DAYS' or 'MONTHS'; pointExpiry.Quantity = 14; program.PointsExpiry = pointExpiry; // Required var pointsVoucherExpiry = new AdministrationService.Expiry(); pointsVoucherExpiry.Period = "MONTHS"; // Valid values are : 'DAYS' or 'MONTHS'; pointsVoucherExpiry.Quantity = 12; program.PointsVoucherExpiry = pointsVoucherExpiry; // Required // add program to request request.Value = program;// Required AdministrationService.Result result = svc.CreateProgram(request); if (result.FaultCode == 0) { //Request succeeded } else { //Request failed throw new Exception(result.FaultDescription); } }