1414
1515using System . Collections . Generic ;
1616using System . Xml ;
17- using EppLib . Entities ;
1817
1918namespace EppLib . Extensions . Fury
2019{
@@ -23,21 +22,22 @@ namespace EppLib.Extensions.Fury
2322 /// </summary>
2423 public class FuryContactCreateExtension : FuryExtension
2524 {
26- private Dictionary < string , string > properties ;
27-
28- public FuryContactCreateExtension ( string language , string cprCode , string agreement_version )
25+ private Dictionary < string , string > properties = new Dictionary < string , string > ( ) ;
26+
27+ public FuryContactCreateExtension ( string language , string cprCode , string agreement_version )
2928 {
30- properties . Add ( "LANGUAGE" , language ) ;
31- properties . Add ( "CPR" , cprCode ) ;
29+ if ( ! string . IsNullOrEmpty ( language ) ) { properties . Add ( "LANGUAGE" , language ) ; }
30+ if ( ! string . IsNullOrEmpty ( cprCode ) ) { properties . Add ( "CPR" , cprCode ) ; }
3231 properties . Add ( "agreement_version" , agreement_version ) ;
32+
3333 }
34-
34+
3535 public override XmlNode ToXml ( XmlDocument doc )
3636 {
37- var root = CreateElement ( doc , "fury:create" ) ;
37+ var root = CreateElement ( doc , "fury:create" ) ;
3838
3939 var propertiesNode = CreateElement ( doc , "fury:properties" ) ;
40-
40+
4141 foreach ( var a in properties )
4242 {
4343 var propertyNode = CreateElement ( doc , "fury:property" ) ;
@@ -46,18 +46,19 @@ public override XmlNode ToXml(XmlDocument doc)
4646
4747 if ( a . Value == null )
4848 {
49- AddXmlElement ( doc , propertyNode , "fury:value default" , "" ) ;
49+ var e = AddXmlElement ( doc , propertyNode , "fury:value" , "" ) ;
50+ e . SetAttribute ( "default" , "true" ) ;
5051 }
5152 else
5253 {
5354 AddXmlElement ( doc , propertyNode , "fury:value" , a . Value ) ;
5455 }
5556
56- propertiesNode . AppendChild ( propertiesNode ) ;
57+ propertiesNode . AppendChild ( propertyNode ) ;
5758 }
5859
5960 root . AppendChild ( propertiesNode ) ;
60-
61+
6162 return root ;
6263 }
6364
0 commit comments