using (var svc = new LoyaltyService.LoyaltyProductClient())
{
var request = new LoyaltyService.ManagementGroupRequestOfProduct();
request.Token = "Token";
request.ManagementGroup = "Management group";
var productRSN = Guid.NewGuid();
var product = new LoyaltyService.Product();
product.RSN = productRSN;
product.DisplayValue = "Reg bag";
product.Active = true;
product.ActiveFrom = DateTime.Now;
product.ActiveTo = DateTime.Now.AddDays(7);
product.NonFinancialMaxPoints_PerCalendarYear = 0;
product.NonFinancialMaxPoints_PerDay = 0;
product.NonFinancialMaxPoints_PerJoinedYear = 0;
product.NonFinancialMaxPoints_PerMonth = 0;
product.NonFinancialMaxPoints_PerWeek = 0;
product.ProductBrand = "Bag Makers";
product.ProductCode = "RB_001";
product.ProductDescription = "Luxury red bag";
product.ProductName = "Red bag";
product.ProductType = "NONFINANICAL";
var document = new LoyaltyService.Document();
document.RSN = Guid.NewGuid();
document.DisplayValue = "Size guide";
document.Entity_RSN = productRSN;
document.BinaryData_RSN = new Guid("713992b1-d107-4bb0-af1d-536002869510");;
document.CreatedBy_RSN = new Guid("bfcf5cd9-ca61-4111-8dcc-fbfc79e2ca0a");;
product.Documents = new LoyaltyService.Document[] { document };
var image = new LoyaltyService.GalleryImage();
image.DisplayValue = "red_bag.jpg";
image.Entity_RSN = productRSN;
image.PrimaryImage_RSN = new Guid("d01600dd-d843-49fc-9e45-5759bd660df5");;
image.SourceImage_RSN = new Guid("5323f2ee-ce69-4e5b-8805-3ea938bdfaa0");;
image.ThumbnailImage_RSN = new Guid("b9e78ef5-9600-45e7-8cf6-18e5b0192b95");;
image.FeaturedImage = false;
image.DisplayOrder = 1;
product.GalleryImages = new LoyaltyService.GalleryImage[] { image };
var category = new LoyaltyService.ProductCategory();
category.RSN = new Guid("585b8030-39e3-4fc8-a89f-035182210744");;
product.ProductCategories = new LoyaltyService.ProductCategory[] { category };
var department = new LoyaltyService.ProductDepartment();
department.RSN = new Guid("3af3c2c8-eb31-4da1-8d32-7d026358da75");;
product.ProductDepartments = new LoyaltyService.ProductDepartment[] { department };
request.Value = product;
LoyaltyService.Result result = svc.InsertProduct(request);
if (result.FaultCode == 0)
{
}
else
{
throw new Exception(result.FaultDescription);
}
}