Click or drag to resize

LoyaltyProductClientUpdateProduct Method

Syntax
C#
public Result UpdateProduct(
	ManagementGroupRequestOfProduct request
)

Parameters

request
Type: LoyaltyServiceManagementGroupRequestOfProduct

Return Value

Type: Result
Examples
C#
using (var svc = new LoyaltyService.LoyaltyProductClient())
{
  var request = new LoyaltyService.ManagementGroupRequestOfProduct();
  request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin
  request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin

  var product = new LoyaltyService.Product();
  product.RSN = new Guid("cb07cc5d-802d-4eab-aa89-4356bddf4910");;
  product.DisplayValue = "Reg bag"; //Required
  product.Active = true;//Optional
  product.ActiveFrom = DateTime.Now;//Optional
  product.ActiveTo = DateTime.Now.AddDays(7); //Optional
  product.NonFinancialMaxPoints_PerCalendarYear = 0;//Optional
  product.NonFinancialMaxPoints_PerDay = 0; //Optional
  product.NonFinancialMaxPoints_PerJoinedYear = 0; //Optional
  product.NonFinancialMaxPoints_PerMonth = 0; //Optional
  product.NonFinancialMaxPoints_PerWeek = 0; //Optional
  product.ProductBrand = "Bag Makers"; //Optional
  product.ProductCode = "RB_001"; //Optional
  product.ProductDescription = "Luxury red bag"; //Optional
  product.ProductName = "Red bag";//Optional
  product.ProductType = "NONFINANICAL";//Optional - Valid values are : 'LOYALTYCARD', 'EVENT', 'SUBSCRIPTIONMEMBERSHIP', 'AWARDENTRY', 'EDUCATION', 'SPONSORSHIP', 'EXHIBITION', 'PIECERATE', 'POLICY' or 'NONFINANICAL'

  var document = new LoyaltyService.Document();
  document.RSN = Guid.NewGuid(); //Required
  document.DisplayValue = "Size guide"; //Required
  document.Entity_RSN = new Guid("184df635-818c-49f0-a21e-0e97aa3de828");; //Required - RSN of product
  document.BinaryData_RSN = new Guid("f2b4d62d-9b19-43be-a8ae-148980a7dfdf");; //Required
  document.CreatedBy_RSN = new Guid("9720adaf-06e9-4cdc-b52c-7b28221155c2");; //Optional
  product.Documents = new LoyaltyService.Document[] { document }; //Optional

  var image = new LoyaltyService.GalleryImage();
  image.DisplayValue = "red_bag.jpg";//Required
  image.Entity_RSN = new Guid("939bdc04-422f-4fab-b92f-d2d2f4feaa0b");;//Required - RSN of product
  image.PrimaryImage_RSN = new Guid("c70999a8-b09d-49ff-ba0a-b37a0bd135a1");;//Required
  image.SourceImage_RSN = new Guid("3b88eabc-8fba-4a57-897a-cd2aaac156e0");;//Required
  image.ThumbnailImage_RSN = new Guid("d61419b0-66ab-460f-9533-7994dc95cdf3");;//Required
  image.FeaturedImage = false; //Optional
  image.DisplayOrder = 1;//Optional
  product.GalleryImages = new LoyaltyService.GalleryImage[] { image }; //Optional

  var category = new LoyaltyService.ProductCategory();
  category.RSN = new Guid("bbe9975c-cc28-481b-af50-82c47d199a47");; //Required
  product.ProductCategories = new LoyaltyService.ProductCategory[] { category }; //Optional - Must belong to supplied department. Only first category used

  var department = new LoyaltyService.ProductDepartment();
  department.RSN = new Guid("8e7c2ae1-93cd-4a21-b00a-65fb68ca18c5");; //Required
  product.ProductDepartments = new LoyaltyService.ProductDepartment[] { department }; //Optional - Required if product category supplied. Only first department used

  request.Value = product;//Required 

  LoyaltyService.Result result = svc.UpdateProduct(request);

  if (result.FaultCode == 0)
  {
    //Request succeeded
  }
  else
  {
    //Request failed
    throw new Exception(result.FaultDescription);
  }
}
See Also