Пример #1
0
        ActionResultBase ISubDomainAdd.Add(SubDomainItem SubDomain2Add, BatchDomainTools.WebPanelOptionData.IOptionData properties)
        {
            cPanel_ActionResult result = new cPanel_ActionResult();

            result.DataNodeProccessor = new cPanel_ActionResult.DataNodeHandler((nodeList) =>
            {
                if (nodeList != null)
                {
                    string status = nodeList[0]["result"].InnerText;
                    if (status.Contains("already exists") || status.Contains("Deleted domain: "))
                    {
                        return(ActionResultCode.Error_ItemAlreadyExist);
                    }
                    if (status != "1")
                    {
                        return(ActionResultCode.Error_UknowError);
                    }
                }
                return(ActionResultCode.Success);
            });

            CommandArgs[] commands = new CommandArgs[]
            {
                properties.ToCommandArgs(SubDomain2Add.SubDomainName)[0],
                new CommandArgs("domain", SubDomain2Add.SubDomainName),
                new CommandArgs("rootdomain", SubDomain2Add.RootDomain)
            };
            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("SubDomain", "addsubdomain", commands), 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);
        }
        ActionResultBase IDomainEdit.Edit(DomainItem Domain2Edit, BatchDomainTools.WebPanelOptionData.IOptionData properties)
        {
            DirectAdmin_ActionResult result   = new DirectAdmin_ActionResult();
            List <CommandArgs>       commands = new List <CommandArgs>(properties.ToCommandArgs())
            {
                new CommandArgs("domain", Domain2Edit.Name),
                new CommandArgs("ubandwidth", "unlimited"),
                new CommandArgs("uquota", "unlimited"),
            };

            result.ExecuteQuery(WebNetCommunication.BuildGetRequest(BuildCommandQuery("CMD_API_DOMAIN", "modify", commands.ToArray()), this.Account.WebSession));
            return(result);
        }