private ELQA_Marketing_Activity__c[] CreateTransferObjectsArray(DataForAPI[] dataForApiArray)
		{
			var result = new List<ELQA_Marketing_Activity__c>(dataForApiArray.Length);
			foreach (var dataForAPI in dataForApiArray)
			{
				var elqaMarketingActivity = new ELQA_Marketing_Activity__c();
				switch (dataForAPI.ProcessType)
				{
					case Enums.ProcessType.JPMarginCall:
						elqaMarketingActivity.Name = "JP Margin Call";
						break;
					case Enums.ProcessType.JPInactivityDeletion:
						elqaMarketingActivity.Name = "JP Inactivity / Deletion";
						break;
					case Enums.ProcessType.AUHKMarginUtilization:
						elqaMarketingActivity.Name = "AU / HK Margin Utilization";
						break;
				}

				elqaMarketingActivity.Activity_Date__c = DateTime.Now;
				elqaMarketingActivity.Contact__r = new Contact
				{
					//TODO: improve code
					Email = dataForAPI.DataBaseAccess.GetEmailAddresses(dataForAPI.AccountNumber).FirstOrDefault()
				};
				//TODO: improve code
				elqaMarketingActivity.Activity_Detail__c = dataForAPI.AdditionalDetails.AccountNumber + "," + dataForAPI.AdditionalDetails.FirstName + "," + dataForAPI.AdditionalDetails.AccountNumber;
				result.Add(elqaMarketingActivity);
			}
			return result.ToArray();
		}
Beispiel #2
0
		private ELQA_Marketing_Activity__c[] CreateTransferObjectsArray(DataForAPI[] dataForApiArray)
		{
			var result = new List<ELQA_Marketing_Activity__c>(dataForApiArray.Length);

			foreach (var dataForAPI in dataForApiArray)
			{
				var activity = new ELQA_Marketing_Activity__c();

				activity.Name = dataForAPI.AdditionalDetails.SalesForceMarketingActivityName;
				activity.Activity_Date__cSpecified = true;
				activity.Activity_Date__c = dataForAPI.AdditionalDetails.ETProcessDate;

				activity.Contact__r = new Contact
				{
					Email = dataForAPI.Email
				};

				dataForAPI.extensions.ToList().ForEach(pair => { activity.Activity_Detail__c += pair.Value + ","; });
				activity.Activity_Detail__c = activity.Activity_Detail__c.TrimEnd(','); // remove last ','

				result.Add(activity);
			}

			return result.ToArray();
		}