/// <summary> /// Conver a simple string,string dictionary to PartyCustomAttribute, string /// </summary> /// <param name="partyCustomAttributes"></param> /// <returns></returns> private Dictionary <PartyCustomAttribute, string> ConvertDictionaryToPartyCustomeAttrValuesDictionary(Dictionary <string, string> partyCustomAttributes, PartyType partyType) { var result = new Dictionary <PartyCustomAttribute, string>(); var partyTypeManager = new PartyTypeManager(); foreach (var partyCustomAttribute in partyCustomAttributes) { var customAttribiute = partyTypeManager.PartyCustomAttributeRepository.Get(cc => cc.Name == partyCustomAttribute.Key && cc.PartyType == partyType).FirstOrDefault(); if (customAttribiute == null) { BexisException.Throw(customAttribiute, "There is no custom attribute with name of " + partyCustomAttribute.Key + " for this party type!"); } result.Add(customAttribiute, partyCustomAttribute.Value); } return(result); }
/// <summary> /// Conver a simple string,string dictionary to PartyCustomAttribute, string /// </summary> /// <param name="partyCustomAttributes"></param> /// <returns></returns> private Dictionary <PartyCustomAttribute, string> ConvertDictionaryToPartyCustomeAttrValuesDictionary(Dictionary <long, string> partyCustomAttributes) { var result = new Dictionary <PartyCustomAttribute, string>(); var partyTypeManager = new PartyTypeManager(); foreach (var partyCustomAttribute in partyCustomAttributes) { var customAttribute = partyTypeManager.PartyCustomAttributeRepository.Get(partyCustomAttribute.Key); if (customAttribute != null && customAttribute.Id != 0) { result.Add(customAttribute, partyCustomAttribute.Value); } else { throw new Exception("Error in custom attribute values."); } } return(result); }