Ejemplo n.º 1
0
        public bool Update(DownServerInfo downServerInfo)
        {
            Parameters parms = new Parameters();

            GetDownServerParameters(downServerInfo, parms);
            return(DBHelper.ExecuteProc("PR_Accessories_DownServer_Update", parms));
        }
Ejemplo n.º 2
0
 protected void RepDownServers_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
     {
         DownServerInfo dataItem = (DownServerInfo)e.Item.DataItem;
         ExtendedLabel  label    = e.Item.FindControl("LblServerName") as ExtendedLabel;
         if (dataItem.ShowType == 0)
         {
             label.Text = "<a href=\"#\" onclick=\"add('$$$" + dataItem.ServerName + "|" + dataItem.ServerId.ToString() + "')\" >" + dataItem.ServerName + "</a>";
         }
         else
         {
             label.Text = string.Concat(new object[] { "<a href=\"#\" onclick=\"add('$$$", dataItem.ServerUrl, "|", dataItem.ServerId.ToString(), "')\" >", dataItem.ServerName, "</a>" });
         }
         this.allDownServer = this.allDownServer + "$$$";
         if (dataItem.ShowType == 0)
         {
             this.allDownServer = this.allDownServer + dataItem.ServerName;
         }
         else
         {
             this.allDownServer = this.allDownServer + dataItem.ServerUrl.ToString();
         }
         this.allDownServer = this.allDownServer + "|" + dataItem.ServerId;
     }
 }
Ejemplo n.º 3
0
        public bool Add(DownServerInfo downServerInfo)
        {
            Parameters parms = new Parameters();

            downServerInfo.ServerId = DBHelper.GetMaxId("PE_DownServer", "ServerID") + 1;
            downServerInfo.OrderId  = DBHelper.GetMaxId("PE_DownServer", "OrderId") + 1;
            GetDownServerParameters(downServerInfo, parms);
            return(DBHelper.ExecuteProc("PR_Accessories_DownServer_Add", parms));
        }
Ejemplo n.º 4
0
 private static void GetDownServerParameters(DownServerInfo downServerInfo, Parameters parms)
 {
     parms.AddInParameter("@ServerID", DbType.Int32, downServerInfo.ServerId);
     parms.AddInParameter("@ServerName", DbType.String, downServerInfo.ServerName);
     parms.AddInParameter("@ServerUrl", DbType.String, downServerInfo.ServerUrl.OriginalString);
     parms.AddInParameter("@ServerLogo", DbType.String, downServerInfo.ServerLogo);
     parms.AddInParameter("@OrderID", DbType.Int32, downServerInfo.OrderId);
     parms.AddInParameter("@ShowType", DbType.Int32, downServerInfo.ShowType);
 }
Ejemplo n.º 5
0
 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();
     }
 }
Ejemplo n.º 6
0
        private static DownServerInfo DownServerInfoFromrdr(NullableDataReader rdr)
        {
            DownServerInfo info = new DownServerInfo();

            info.ServerId   = rdr.GetInt32("ServerID");
            info.ServerName = rdr.GetString("ServerName");
            info.ServerUrl  = new Uri(rdr.GetString("ServerUrl"));
            info.ServerLogo = rdr.GetString("ServerLogo");
            info.OrderId    = rdr.GetInt32("OrderID");
            info.ShowType   = rdr.GetInt32("ShowType");
            return(info);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public static string GetDownloadurlById(string downloadUrls, int urlId, int serverId)
        {
            if ((downloadUrls.Length == 0) || (urlId <= 0))
            {
                return("");
            }
            string str2 = "";

            if (!string.IsNullOrEmpty(downloadUrls))
            {
                int num = 0;
                foreach (string str3 in downloadUrls.Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    string[] strArray2 = str3.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                    if (num == urlId)
                    {
                        str2 = strArray2[1];
                    }
                    num++;
                }
            }
            DownServerInfo downServerById = DownServer.GetDownServerById(serverId);

            if (downServerById.IsNull)
            {
                if (str2.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
                {
                    return(str2);
                }
                return(SiteConfig.SiteInfo.VirtualPath + SiteConfig.SiteOption.UploadDir + "/" + str2);
            }
            string str4 = downServerById.ServerUrl.ToString();

            if (!str4.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
            {
                str4 = "http://" + str4;
            }
            if (!str4.EndsWith("/", StringComparison.OrdinalIgnoreCase))
            {
                str4 = str4 + "/";
            }
            if (str2.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
            {
                return(str2);
            }
            return(str4 + str2);
        }
Ejemplo n.º 9
0
 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");
         }
     }
 }
Ejemplo n.º 10
0
        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");
        }
Ejemplo n.º 11
0
 public static bool Update(DownServerInfo downServerInfo)
 {
     return(dal.Update(downServerInfo));
 }
Ejemplo n.º 12
0
 public static bool Add(DownServerInfo downServerInfo)
 {
     return(dal.Add(downServerInfo));
 }