ActionResultBase IDomainAdd.Add(DomainItem Domain, IOptionData properties) { cPanel_ActionResult result = new cPanel_ActionResult(); result.DataNodeProccessor = new cPanel_ActionResult.DataNodeHandler((nodeList) => { if (nodeList != null) { string status = nodeList[0]["reason"].InnerText; if (status.Contains("already exists") || status.Contains("Deleted domain: ")) { return(ActionResultCode.Error_ItemAlreadyExist); } //you are not allowed to add any more than if (!status.Contains("was successfully parked")) { return(ActionResultCode.Error_UknowError); } } return(ActionResultCode.Success); }); CommandArgs[] commands = new CommandArgs[] { properties.ToCommandArgs(Domain.Name)[0], new CommandArgs("newdomain", Domain.Name), new CommandArgs("subdomain", Domain.Name.Replace(".", "")) }; result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("AddonDomain", "addaddondomain", commands), this.Account.WebSession)); return(result); }
ActionResultBase IDomainEdit.Edit(DomainItem DomainToEdit, IOptionData properties) { cPanel_Domain cpDomain = DomainToEdit as cPanel_Domain; if (cpDomain == null) { throw new ArgumentException("Wrong type of argument, the expected cPanel_Domain type.", "Domain"); } cPanel_ActionResult result = new cPanel_ActionResult(); result.DataNodeProccessor = new cPanel_ActionResult.DataNodeHandler((nodeList) => { if (nodeList != null) { return(ActionResultCode.Success); } return(ActionResultCode.Error_UknowError); }); CommandArgs[] commands = new CommandArgs[] { new CommandArgs("rootdomain", cpDomain.ExtViewData["rootdomain"]), new CommandArgs("subdomain", cpDomain.ExtViewData["subdomain"]), properties.ToCommandArgs(cpDomain.Name)[0] }; result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("SubDomain", "changedocroot", commands), this.Account.WebSession)); return(result); }
ActionResultBase IDomainEdit.Edit(DomainItem Domain2Edit, IOptionData properties) { ISPmanager_ActionResult result = new ISPmanager_ActionResult(); List <CommandArgs> commands = new List <CommandArgs>(properties.ToCommandArgs(Domain2Edit.Name)); commands.Add(new CommandArgs("elid", Domain2Edit.Name)); commands.Add(new CommandArgs("admin", "admin@" + Domain2Edit.Name)); result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("wwwdomain.edit", commands.ToArray()), this.Account.WebSession)); return(result); }