Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 21st, 2012  |  syntax: None  |  size: 1.64 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var hasCventId = (request.EnrollmentData.Cvent != null && request.EnrollmentData.Cvent.Code != null);
  2.             var hasCompanyId = (request.EnrollmentData.EnrollUser.SelectedCompany != null && request.EnrollmentData.EnrollUser.SelectedCompany.Id != null);
  3.             var hasAddressId = (request.EnrollmentData.EnrollUser.SelectedCompany != null && request.EnrollmentData.EnrollUser.SelectedCompany.SelectedLocation != null && request.EnrollmentData.EnrollUser.SelectedCompany.SelectedLocation.Id != null);
  4.             var hasContactId = (request.EnrollmentData.EnrollUser != null && request.EnrollmentData.EnrollUser.Id != null);
  5.  
  6.             // check to see if the users' company id is what he is supplying
  7.             if (hasCompanyId && hasContactId)
  8.             {
  9.                 var companyId = request.EnrollmentData.EnrollUser.SelectedCompany.Id;
  10.                 var user = GetContactById(request.EnrollmentData.EnrollUser.Id);
  11.                 if (user == null) throw new Exception("Coudl not find user");
  12.                 if (!user.SelectedCompany.Id.Equals(companyId,StringComparison.OrdinalIgnoreCase))
  13.                 {
  14.                     request.EnrollmentData.EnrollUser.Id = null;
  15.                     hasContactId = false;
  16.                 }
  17.             }
  18.  
  19.             SubmitRegistrationResponse sapResponse = null;
  20.             if (hasCventId && hasCompanyId && hasAddressId && !hasContactId)
  21.             {
  22.                 sapResponse = SubmitRegistration_SendToSAP(request);
  23.             }  else
  24.             {
  25.                sapResponse = new SubmitRegistrationResponse(request.EnrollmentData.EnrollUser);                
  26.             }