private void InitData(int serverId) { if (serverId > 0) { DownServerInfo downServerById = DownServer.GetDownServerById(serverId); this.TxtServerName.Text = downServerById.ServerName; this.TxtServerLogo.Text = downServerById.ServerLogo; this.TxtServerUrl.Text = downServerById.ServerUrl.ToString(); this.DropShowType.SelectedValue = downServerById.ShowType.ToString(); } }
private void DeleteDownServer() { if (DownServer.Delete(BasePage.RequestInt32("ServerID"))) { AdminPage.WriteSuccessMsg("删除下载服务器成功!", "DownServerManage.aspx"); } else { AdminPage.WriteErrMsg("删除下载服务器失败!"); } }
private string ParseDownLoadPath(int urlid, int id, int serverid) { DataTable contentDataById = ContentManage.GetContentDataById(id); if (contentDataById.Rows.Count <= 0) { DynamicPage.WriteErrMsg("此资源不存在!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx"); } string str = ""; DownServerInfo downServerById = DownServer.GetDownServerById(serverid); string weburl = ""; if (contentDataById.Rows.Count > 0) { str = contentDataById.Rows[0]["DownloadUrl"].ToString(); int num = 0; foreach (string str3 in str.Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries)) { string[] strArray2 = str3.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); if (num == urlid) { weburl = strArray2[1]; } num++; } } if (downServerById.IsNull) { this.downloadurl = Utility.ConvertAbsolutePath(SiteConfig.SiteInfo.VirtualPath + SiteConfig.SiteOption.UploadDir + "/", weburl, true); return(weburl); } string str4 = downServerById.ServerUrl.ToString(); if (!str4.StartsWith("http://", StringComparison.OrdinalIgnoreCase)) { str4 = "http://" + str4; } if (!str4.EndsWith("/", StringComparison.Ordinal)) { str4 = str4 + "/"; } if (weburl.StartsWith("/", StringComparison.Ordinal) || weburl.Contains("://")) { this.downloadurl = weburl; return(weburl); } this.downloadurl = str4 + weburl; return(weburl); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { DownServerInfo downServerInfo = new DownServerInfo(); downServerInfo.ServerId = BasePage.RequestInt32("ServerID"); downServerInfo.ServerName = this.TxtServerName.Text; downServerInfo.ServerLogo = this.TxtServerLogo.Text; if (DataValidator.IsUrl(this.TxtServerUrl.Text)) { downServerInfo.ServerUrl = new Uri(this.TxtServerUrl.Text); } else { AdminPage.WriteErrMsg("<li>对不起,请输入正确格式的下载服务器地址!</li>", "DownServer.aspx"); } downServerInfo.ShowType = DataConverter.CLng(this.DropShowType.SelectedValue); bool flag = false; string str2 = BasePage.RequestString("Action", "Add"); if (str2 != null) { if (!(str2 == "Add")) { if (str2 == "Modify") { flag = DownServer.Update(downServerInfo); } } else { flag = DownServer.Add(downServerInfo); } } if (flag) { AdminPage.WriteSuccessMsg("<li>已经成功保存下载服务器信息!</li>", "DownServerManage.aspx"); } else { AdminPage.WriteErrMsg("<li>下载服务器信息保存失败!</li>", "DownServerManage.aspx"); } } }
protected void EBtnShowType_Click(object sender, EventArgs e) { StringBuilder selectList = new StringBuilder(""); selectList = this.EgvDownServer.SelectList; int showType = DataConverter.CLng(this.DropShowType.SelectedItem.Value); if (selectList.Length == 0) { AdminPage.WriteErrMsg("<li>对不起,您还没选择要设置显示方式行!</li>"); } else if (DownServer.SetShowType(selectList.ToString(), showType)) { AdminPage.WriteSuccessMsg("设置显示方式成功!", "DownServerManage.aspx"); } else { AdminPage.WriteErrMsg("设置显示方式失败!"); } }
protected void EBtnSetOrderId_Click(object sender, EventArgs e) { List <DownServerInfo> list = new List <DownServerInfo>(); foreach (GridViewRow row in this.GdvDownServerOrder.Rows) { DropDownList list2 = (DropDownList)row.FindControl("DropOrderId"); int serverId = (int)this.GdvDownServerOrder.DataKeys[row.RowIndex].Value; int num2 = DataConverter.CLng(list2.SelectedValue); DownServerInfo downServerById = DownServer.GetDownServerById(serverId); downServerById.OrderId = num2; if (!downServerById.IsNull) { list.Add(downServerById); } } DownServer.OrderDownServer(list); this.GdvDownServerOrder.DataBind(); base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>"); AdminPage.WriteSuccessMsg("下载服务器排序成功!", "DownServerOrder.aspx"); }
private void BindData() { this.RepDownServers.DataSource = DownServer.GetDownServerList(); this.RepDownServers.DataBind(); }