示例#1
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() + ",";
        }
    }
 private void BindData()
 {
     DataTable dt = new Tables.T_FocusImageNews().Open("", "", "ID desc");
     if (dt == null)
     {
         PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
     }
     else
     {
         PF.DataGridBindData(this.g, dt, this.gPager);
     }
 }
示例#3
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);
    }
示例#4
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();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     string key = "Home_Room_UserControls_Index_banner_ImagePlay";
     DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);
     if (cacheAsDataTable == null)
     {
         cacheAsDataTable = new Tables.T_FocusImageNews().Open("", "", "ID Desc");
         if (cacheAsDataTable == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
             return;
         }
         Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0xe10);
     }
     DataRow[] rowArray = cacheAsDataTable.Select("IsBig=1", "ID desc");
     for (int i = 0; (i < rowArray.Length) && (i < 6); i++)
     {
         string imagsBanner = this.imagsBanner;
         this.imagsBanner = imagsBanner + "Private/" + base._Site.ID.ToString() + "/NewsImages/" + rowArray[i]["ImageUrl"].ToString() + ",";
         this.textBanner = this.textBanner + rowArray[i]["Title"].ToString() + ",";
         this.linksBanner = this.linksBanner + rowArray[i]["Url"].ToString() + ",";
     }
 }
 private void BindImageNews()
 {
     string key = "Home_Room_UserControls_Index_banner_ImagePlay";
     DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);
     if (cacheAsDataTable == null)
     {
         cacheAsDataTable = new Tables.T_FocusImageNews().Open("", "", "ID Desc");
         if (cacheAsDataTable == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
             return;
         }
         Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0xe10);
     }
     DataRow[] rowArray = cacheAsDataTable.Select("IsBig=0", "ID desc");
     if (rowArray.Length > 0)
     {
         this.tbImageNews.Visible = true;
         this.ImageHref1.HRef = rowArray[0]["Url"].ToString();
         this.Image1.Src = "Private/" + base._Site.ID.ToString() + "/NewsImages/" + rowArray[0]["ImageUrl"].ToString();
         this.tdTitle1.InnerHtml = _String.Cut(rowArray[0]["Title"].ToString(), 8);
         this.Image1.Alt = this.tdTitle1.InnerHtml;
         if (rowArray.Length > 1)
         {
             this.tdTitle2.Visible = true;
             this.tdImage2.Visible = true;
             this.ImageHref2.HRef = rowArray[1]["Url"].ToString();
             this.Image2.Src = "Private/" + base._Site.ID.ToString() + "/NewsImages/" + rowArray[1]["ImageUrl"].ToString();
             this.tdTitle2.InnerHtml = _String.Cut(rowArray[1]["Title"].ToString(), 8);
             this.Image2.Alt = this.tdTitle2.InnerHtml;
         }
     }
 }
示例#7
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");
    }
示例#8
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();
            
            Shove.ControlExt.SetDownListBoxText(ddlImage, dt.Rows[0]["ImageUrl"].ToString());
            tbOldImage.Text = dt.Rows[0]["ImageUrl"].ToString().Trim();

            ImageURL = "/Private/1/NewsImages/" + dt.Rows[0]["ImageUrl"].ToString().Trim();

            if (dt.Rows[0]["ImageUrl"].ToString().Trim() == "")
            {
                cbNoEditImage.Checked = false;
                cbNoEditImage.Visible = false;
            }
        }
    }