Esempio n. 1
0
        protected void DeleteUrl(object sender, EventArgs e)
        {
            string     id = ((LinkButton)sender).CommandArgument;
            DomainName dm = FacadeManage.aidePlatformFacade.GetDomainById(Convert.ToInt32(id));



            if (dm.Type == 1 && dm.State == 1)
            {
                ShowError("使用当中的下载域名不能禁用");
                return;
            }
            else if (dm.Type != 1)
            {
                string uri = ApplicationSettings.Get("AddUri") + "/del_domain/" + dm.Url.Replace("https://", "").Replace("http://", "");
                string rs  = FacadeManage.RequestUri(uri, "", "DELETE");
                if (rs == "")
                {
                    ShowError("配置请求失败");
                    return;
                }
                object obj = new JavaScriptSerializer().DeserializeObject(rs);
                Dictionary <string, object> json = (Dictionary <string, object>)obj;
                if (json["success"].ToString() != "True")
                {
                    ShowError("配置请求失败");
                    return;
                }
            }
            int r = FacadeManage.aidePlatformFacade.DeleteUrl(Convert.ToInt32(id));

            if (r > 0)
            {
                ShowInfo("删除成功", "DomainNameList.aspx", 1200);
            }
        }
Esempio n. 2
0
        protected void OffUrl(object sender, EventArgs e)
        {
            int        parma = Convert.ToInt32(((LinkButton)sender).CommandArgument);
            int        id    = parma / 10;
            int        state = parma % 10;
            DomainName dm    = FacadeManage.aidePlatformFacade.GetDomainById(id);

            string uri    = "";
            string sparma = "";


            if (dm.Type == 1)
            {
                if (state == 1)
                {
                    ShowError("下载域名不能禁用");
                    return;
                }

                FacadeManage.aidePlatformFacade.OffDownloadURL();
                uri    = ApplicationSettings.Get("AddUri") + "dl_domain/" + ApplicationSettings.Get("SitTag");
                sparma = "{\"dl_domain\":\"" + dm.Url + "\"}";
            }
            else
            {
                if (state != 1)
                {
                    uri = ApplicationSettings.Get("AddUri") + "pm_domain/" + ApplicationSettings.Get("SitTag");
                    string mm = dm.Url.Replace("https://", "").Replace("http://", "");
                    sparma = "{\"pm_domain\":\"" + mm + "\"}";
                }
                else
                {
                    uri = ApplicationSettings.Get("AddUri") + "del_domain/" + dm.Url.Replace("https://", "").Replace("http://", "");
                }
            }
            string mode = "POST";

            if (state == 1)
            {
                mode = "DELETE";
            }
            string rs = FacadeManage.RequestUri(uri, sparma, mode);

            if (rs == "")
            {
                ShowError("配置请求失败");
                return;
            }
            object obj = new JavaScriptSerializer().DeserializeObject(rs);
            Dictionary <string, object> json = (Dictionary <string, object>)obj;

            if (json["success"].ToString() != "True")
            {
                ShowError("配置请求失败");
                return;
            }

            FacadeManage.aidePlatformFacade.SetDomaState(id, state == 0?1:0);
            ShowInfo("修改成功", "DomainNameList.aspx", 1200);
        }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!AuthUserOperationPermission(Permission.Edit))
            {
                return;
            }
            DomainName domainName = new DomainName();

            if (IntParam > 0)
            {
                domainName = FacadeManage.aidePlatformFacade.GetDomainById(IntParam);
                if (domainName.Url != TextBoxUrl.Text)
                {
                    string uriDelete = ApplicationSettings.Get("AddUri") + "del_domain/" + domainName.Url.Replace("https://", "").Replace("http://", "");
                    string rsDelete  = FacadeManage.RequestUri(uriDelete, "", "DELETE");
                    if (rsDelete == "")
                    {
                        ShowError("配置请求失败");
                        return;
                    }
                    object obj = new JavaScriptSerializer().DeserializeObject(rsDelete);
                    Dictionary <string, object> json = (Dictionary <string, object>)obj;
                    if (json["success"].ToString() != "True")
                    {
                        ShowError("配置请求失败");
                        return;
                    }
                }
            }
            domainName.Type    = Convert.ToByte(ddlProductType.SelectedValue);
            domainName.Url     = TextBoxUrl.Text;
            domainName.AgentId = 0;
            if (ddlProductType.SelectedValue == "3")
            {
                int          GameId = Convert.ToInt32(TextSign.Text);
                AccountsInfo acc    = FacadeManage.aideAccountsFacade.GetAccountInfoByGameId(GameId);
                if (acc == null)
                {
                    ShowError("游戏id不存在");
                    return;
                }
                domainName.AgentId = acc.UserID;
            }
            domainName.State = Convert.ToByte(DropDownListState.SelectedValue);
            domainName.Mode  = 0;
            domainName.id    = IntParam;

            string uri   = "";
            string parma = "";

            if (ddlProductType.SelectedValue == "1")
            {
                uri   = ApplicationSettings.Get("AddUri") + "dl_domain/" + ApplicationSettings.Get("SitTag");
                parma = "{\"dl_domain\":\"" + domainName.Url + "\"}";
            }
            else
            {
                if (domainName.State == 1)
                {
                    uri = ApplicationSettings.Get("AddUri") + "pm_domain/" + ApplicationSettings.Get("SitTag");
                    string mm = domainName.Url.Replace("https://", "").Replace("http://", "");
                    parma = "{\"pm_domain\":\"" + mm + "\"}";
                }
                else
                {
                    uri = ApplicationSettings.Get("AddUri") + "del_domain/" + domainName.Url.Replace("https://", "").Replace("http://", "");
                }
            }
            if (IntParam > 0 || domainName.State == 1)
            {
                string rs = FacadeManage.RequestUri(uri, parma);
                if (rs == "")
                {
                    ShowError("配置请求失败");
                    return;
                }
                object obj = new JavaScriptSerializer().DeserializeObject(rs);
                Dictionary <string, object> json = (Dictionary <string, object>)obj;
                if (json["success"].ToString() != "True")
                {
                    ShowError("配置请求失败");
                    return;
                }
            }
            if (domainName.Type == 1 && domainName.State == 1)
            {
                FacadeManage.aidePlatformFacade.OffDownloadURL();
            }
            int pp = FacadeManage.aidePlatformFacade.SaveDomain(domainName);

            if (pp > 0)
            {
                ShowInfo("配置信息操作成功", "DomainNameList.aspx", 1000);
            }
            else
            {
                ShowError("配置失败");
            }
        }