示例#1
0
        ActionResultBase BatchDomainTools.IWebPanelObjectActions.ISubDomainActions.ISubDomainGet.Get(WebPanelItemCollection saveCollection)
        {
            cPanel_ActionResult result     = new cPanel_ActionResult();
            DomainItem          mainDomain = GetMainDomain();

            //if(mainDomain==null)
            //  mainDomain = GetMainDomainAlternative();
            result.DataNodeProccessor = new cPanel_ActionResult.DataNodeHandler((nodeList) =>
            {
                if (nodeList != null)
                {
                    foreach (XmlNode node in nodeList)
                    {
                        cPanel_SubDomain subDomain = new cPanel_SubDomain(node);
                        if (mainDomain != null && !subDomain.RootDomain.Equals(mainDomain.Name, StringComparison.InvariantCultureIgnoreCase) ||
                            mainDomain == null)
                        {
                            saveCollection.Add(subDomain);
                        }
                    }
                    return(ActionResultCode.Success);
                }
                return(ActionResultCode.Error_InvalidServerAnswer);
            });
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("SubDomain", "listsubdomains"), this.Account.WebSession));
            return(result);
        }
示例#2
0
        ActionResultBase ISubDomainEdit.Edit(SubDomainItem SubDomain2Edit, BatchDomainTools.WebPanelOptionData.IOptionData properties)
        {
            cPanel_SubDomain cpDomain = SubDomain2Edit as cPanel_SubDomain;

            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.RootDomain),
                new CommandArgs("subdomain", cpDomain.SubDomainName),
                properties.ToCommandArgs(cpDomain.Name)[0]
            };
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("SubDomain", "changedocroot", commands), this.Account.WebSession));
            return(result);
        }