/// <summary> /// Fill update command with domain update content /// </summary> /// <param name="command">Update command</param> public void FillCommand(ICommand command) { var domainNameElem = new XElement(MessageBase.DomainNs.GetName("name"), this.DomainName); var domainUpdateElement = new XElement(MessageBase.DomainNs.GetName("update"), domainNameElem); if (this.Add != null) { var add = new XElement(SchemaHelper.DomainNs.GetName("add")); this.Add.Fill(add); domainUpdateElement.Add(add); } if (this.Rem != null) { var rem = new XElement(SchemaHelper.DomainNs.GetName("rem")); this.Rem.Fill(rem); domainUpdateElement.Add(rem); } if (this.Chg != null) { var chg = new XElement(SchemaHelper.DomainNs.GetName("chg")); this.Chg.Fill(chg); domainUpdateElement.Add(chg); } domainUpdateElement.AddDomainSchemaLocation(); command.GetCommandElement().Add(domainUpdateElement); }
/// <summary> /// Fill delete command with domain delete content /// </summary> /// <param name="command">Delete command</param> public void FillCommand(ICommand command) { var domainNameElem = new XElement(MessageBase.DomainNs.GetName("name"), this.DomainName); var domainDeleteElement = new XElement(MessageBase.DomainNs.GetName("delete"), domainNameElem); domainDeleteElement.AddDomainSchemaLocation(); command.GetCommandElement().Add(domainDeleteElement); }
/// <summary> /// Fill check command with domain check content /// </summary> /// <param name="command">Check command</param> public void FillCommand(ICommand command) { XNamespace domainNs = SchemaHelper.DomainNs; var domainCheckElement = new XElement(SchemaHelper.DomainNs.GetName("check")); foreach (var domainName in DomainNames) { domainCheckElement.Add(new XElement(domainNs + "name", domainName)); } domainCheckElement.AddDomainSchemaLocation(); command.GetCommandElement().Add(domainCheckElement); }
/// <summary> /// Fills create command with domain create content /// </summary> /// <param name="command">Create command</param> public void FillCommand(ICommand command) { var createElement = command.GetCommandElement(); var nameElem = new XElement(SchemaHelper.DomainNs.GetName("name"), this.DomainName); var domainCreateElement = new XElement(SchemaHelper.DomainNs.GetName("create"), nameElem); if (this.RegistrationPeriod != null) { var periodElem = new XElement(SchemaHelper.DomainNs.GetName("period")); this.RegistrationPeriod.Fill(periodElem); domainCreateElement.Add(periodElem); } if (this.NameServers != null && this.NameServers.Any()) { var nameServersElem = new XElement(SchemaHelper.DomainNs.GetName("ns")); this.NameServers.Fill(nameServersElem); domainCreateElement.Add(nameServersElem); } if (!String.IsNullOrEmpty(this.Registrant)) { var registrantElem = new XElement(SchemaHelper.DomainNs.GetName("registrant"), this.Registrant); domainCreateElement.Add(registrantElem); } if (this.Contacts != null && this.Contacts.Any()) { var contactsElems = this.Contacts .Select(contact => { var contactElem = new XElement(SchemaHelper.DomainNs.GetName("contact")); contact.Fill(contactElem); return(contactElem); }); domainCreateElement.Add(contactsElems); } var authInfoElem = new XElement(SchemaHelper.DomainNs.GetName("authInfo")); this.AuthInfo.Fill(authInfoElem); domainCreateElement.Add(authInfoElem); domainCreateElement.AddDomainSchemaLocation(); createElement.Add(domainCreateElement); }
/// <summary> /// Fills renew command with domain renew content /// </summary> /// <param name="command">Renew command</param> public void FillCommand(ICommand command) { var nameElement = new XElement(SchemaHelper.DomainNs.GetName("name"), this.DomainName); var date = this.CurrExpirationDate.ToUniversalTime().Date; var dateStr = String.Format("{0:D4}-{1:D2}-{2:D2}", date.Year, date.Month, date.Day); var curExpDateElement = new XElement(SchemaHelper.DomainNs.GetName("curExpDate"), dateStr); var domainRenewElement = new XElement(SchemaHelper.DomainNs.GetName("renew"), nameElement, curExpDateElement); if (this.Period != null) { var periodElem = new XElement(SchemaHelper.DomainNs.GetName("period")); this.Period.Fill(periodElem); domainRenewElement.Add(periodElem); } domainRenewElement.AddDomainSchemaLocation(); command.GetCommandElement().Add(domainRenewElement); }
/// <summary> /// Fill info command with domain info content /// </summary> /// <param name="command">Info command</param> public void FillCommand(ICommand command) { var domainNameElement = new XElement(SchemaHelper.DomainNs.GetName("name"), this.DomainName); var domainInfoElement = new XElement(SchemaHelper.DomainNs.GetName("info"), domainNameElement); domainInfoElement.AddDomainSchemaLocation(); command.GetCommandElement().Add(domainInfoElement); var hostsAttrValue = "all"; switch (this.Hosts) { case ReturningHosts.Subordinate: hostsAttrValue = "sub"; break; case ReturningHosts.Delegated: hostsAttrValue = "del"; break; case ReturningHosts.None: hostsAttrValue = "none"; break; case ReturningHosts.All: hostsAttrValue = "all"; break; } domainNameElement.Add(new XAttribute("hosts", hostsAttrValue)); if (this.AuthInfo != null) { var authInfoElem = new XElement(SchemaHelper.DomainNs.GetName("authInfo")); this.AuthInfo.Fill(authInfoElem); domainInfoElement.Add(authInfoElem); } }
/// <summary> /// Fills transfer command with domain transfer content /// </summary> /// <param name="command">Transfer command</param> public void FillCommand(ICommand command) { var nameElement = new XElement(SchemaHelper.DomainNs.GetName("name"), this.DomainName); var domainTransferElement = new XElement(SchemaHelper.DomainNs.GetName("transfer"), nameElement); if (this.Period != null) { var periodElem = new XElement(SchemaHelper.DomainNs.GetName("period")); this.Period.Fill(periodElem); domainTransferElement.Add(periodElem); } if (this.AuthInfo != null) { var authInfoElem = new XElement(SchemaHelper.DomainNs.GetName("authInfo")); this.AuthInfo.Fill(authInfoElem); domainTransferElement.Add(authInfoElem); } domainTransferElement.AddDomainSchemaLocation(); command.GetCommandElement().Add(domainTransferElement); }