Пример #1
0
    private void BindData()
    {
        long NewsID = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("ID"), -1);

        if (NewsID < 0)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误", this.GetType().BaseType.FullName);

            return;
        }

        tbID.Value = NewsID.ToString();

        ddlImage.Items.Clear();
        ddlImage.Items.Add("--选择图片--");

        string UploadPath = this.Server.MapPath("../Private/" + _Site.ID.ToString() + "/NewsImages");

        if (!System.IO.Directory.Exists(UploadPath))
        {
            System.IO.Directory.CreateDirectory(UploadPath);
        }
        else
        {
            string[] FileList = Shove._IO.File.GetFileList(UploadPath);

            if (FileList != null)
            {
                for (int i = 0; i < FileList.Length; i++)
                {
                    ddlImage.Items.Add(FileList[i]);
                }
            }
        }

        DataTable dt = new DAL.Tables.T_FocusImageNews().Open("", "[ID] = " + NewsID.ToString(), "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count > 0)
        {
            tbTitle.Text    = dt.Rows[0]["Title"].ToString();
            tbContent.Text  = dt.Rows[0]["Url"].ToString();
            cbIsBig.Checked = Shove._Convert.StrToBool(dt.Rows[0]["IsBig"].ToString(), false);

            Shove.ControlExt.SetDownListBoxText(ddlImage, dt.Rows[0]["ImageUrl"].ToString());
            tbOldImage.Text = dt.Rows[0]["ImageUrl"].ToString().Trim();

            if (dt.Rows[0]["ImageUrl"].ToString().Trim() == "")
            {
                cbNoEditImage.Checked = false;
                cbNoEditImage.Visible = false;
            }
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string CacheKey = "Home_Room_UserControls_Index_banner_ImagePlay";

        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dt == null)
        {
            dt = new DAL.Tables.T_FocusImageNews().Open("", "", "ID Desc");

            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

                return;
            }

            Shove._Web.Cache.SetCache(CacheKey, dt, 1200);
        }

        DataRow[] drs = dt.Select("IsBig=1", "ID desc");

        for (int i = 0; i < drs.Length && i < 6; i++)
        {
            imagsBanner += "Private/" + _Site.ID.ToString() + "/NewsImages/" + drs[i]["ImageUrl"].ToString() + ",";

            textBanner += drs[i]["Title"].ToString() + ",";

            linksBanner += drs[i]["Url"].ToString() + ",";
        }
    }
Пример #3
0
    private void BindFocusImage()
    {
        string    CacheKey = "Default_BindFocusImage";
        DataTable dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dt == null)
        {
            dt = new DAL.Tables.T_FocusImageNews().Open("", "", "ID Desc");
            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);
                return;
            }

            Shove._Web.Cache.SetCache(CacheKey, dt, 1200);
        }

        StringBuilder sb = new StringBuilder();

        DataRow[] drs     = dt.Select("IsBig=1", "ID desc");
        string    slide_a = "";

        sb.Append("<ul>");

        for (int i = 0; i < drs.Length && i < 5; i++)
        {
            if (i == 0)
            {
                slide_a = "<p class=\"p1\"><a id=\"slide_a\" href=\"" + drs[i]["Url"].ToString() + "\" target=\"_blank\">" + drs[i]["Title"].ToString() + "</a></p>";
                sb.Append("<li style='display:'><a href=\"" + drs[i]["Url"].ToString() + "\" txt=\"" + drs[i]["Title"].ToString() + "\">");
            }
            else
            {
                sb.Append("<li style='display:none'><a href=\"" + drs[i]["Url"].ToString() + "\" txt=\"" + drs[i]["Title"].ToString() + "\">");
            }
            sb.Append("<img src='Images/imgloading.gif' alt=\"" + drs[i]["Title"].ToString() + "\"");
            sb.Append(" url=\"Private/1/NewsImages/" + drs[i]["ImageUrl"].ToString() + "\"></a></li>");
            imgCount = i + 1;

            if (i == 0)
            {
                imgbtn += "<li class=\"btn02 btn01\" target=\"0\"><a></a></li>";
            }
            else
            {
                imgbtn += "<li class=\"btn02\" target=\"" + (i).ToString() + "\"><a></a></li>";
            }
        }

        sb.Append("</ul>");
        sb.Append(slide_a);
        FocusImage = sb.ToString();
    }
Пример #4
0
    private void BindData()
    {
        DataTable dt = new DAL.Tables.T_FocusImageNews().Open("", "", "ID desc");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

            return;
        }

        PF.DataGridBindData(g, dt, gPager);
    }
Пример #5
0
    /// <summary>
    /// 绑定首页Banner图片数据
    /// </summary>
    private void BindDataForFlash()
    {
        string    Pics     = "";
        string    Titles   = "";
        string    Links    = "";
        string    CacheKey = "Home_Room_UserControls_Index_banner_ImagePlay";
        DataTable dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dt == null)
        {
            dt = new DAL.Tables.T_FocusImageNews().Open("", "", "ID Desc");
            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);
                return;
            }
            Shove._Web.Cache.SetCache(CacheKey, dt, 600);
        }
        DataRow[] drs = dt.Select("IsBig=1", "ID desc");
        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                Pics   += "Private/" + _Site.ID.ToString() + "/NewsImages/" + dr["ImageUrl"].ToString() + "|";
                Titles += Shove._String.HtmlTextCut(dr["Title"].ToString(), 15) + "|";
                Links  += dr["Url"].ToString() + "|";
            }
            Pics               = Pics.Substring(0, Pics.Length - 1);
            Titles             = Titles.Substring(0, Titles.Length - 1);
            Links              = Links.Substring(0, Links.Length - 1);
            ImagePlayer.Pics   = Pics;
            ImagePlayer.Titles = Titles;
            ImagePlayer.Links  = Links;
        }
        else
        {
            ImagePlayer.Pics   = "Images/DefaultNew.jpg";
            ImagePlayer.Titles = _Site.Name + "上线了";
            ImagePlayer.Links  = "http://" + _Site.Url;
        }
    }
Пример #6
0
    protected void btnAdd_Click(object sender, System.EventArgs e)
    {
        string Title = tbTitle.Text.Trim();

        if (Title == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入标题。");

            return;
        }

        string Image = "";

        if (tbImage.Value.Trim() != "")
        {
            string UploadPath = this.Server.MapPath("../Private/" + _Site.ID.ToString() + "/NewsImages");

            if (!System.IO.Directory.Exists(UploadPath))
            {
                System.IO.Directory.CreateDirectory(UploadPath);
            }

            if (Shove._IO.File.UploadFile(this.Page, tbImage, "../Private/" + _Site.ID.ToString() + "/NewsImages/", ref Image, true, "image") != 0)
            {
                Shove._Web.JavaScript.Alert(this.Page, "图片文件上传错误!");

                return;
            }
        }
        else
        {
            if (ddlImage.SelectedIndex > 0)
            {
                Image = ddlImage.SelectedItem.Text;
            }
        }

        string UC = tbContent.Text.Trim();

        Regex regex = new Regex(@"([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        Match m     = regex.Match(UC);

        if (!m.Success)
        {
            Shove._Web.JavaScript.Alert(this, "地址格式错误,请仔细检查。");

            return;
        }

        DAL.Tables.T_FocusImageNews f = new DAL.Tables.T_FocusImageNews();

        f.Title.Value    = Title;
        f.Url.Value      = UC;
        f.ImageUrl.Value = Image;
        f.IsBig.Value    = true;

        f.Insert();

        Shove._Web.Cache.ClearCache("Home_Room_UserControls_Index_banner_ImagePlay");

        Shove._Web.Cache.ClearCache("Default_BindFocusImage");

        Response.Redirect("ImageNews.aspx");
    }