Example #1
0
    private void BindData()
    {
        if (tv.Nodes.Count < 1)
        {
            return;
        }

        string TypeID = tv.SelectedValue;

        if (TypeID == "")
        {
            TypeID = tv.Nodes[0].Value;
        }

        DataTable dt = new DAL.Tables.T_News().Open("", "SiteID = 1 and TypeID = " + Shove._Web.Utility.FilteSqlInfusion(TypeID), "[DateTime] desc");

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

        //    return;
        //}



        DataGridBindData(g, dt, gPager);
    }
Example #2
0
    private void BindData()
    {
        DataTable dt = new DAL.Tables.T_News().Open("", "SiteID = " + _Site.ID.ToString() + " and TypeID = '"+ddlType.SelectedValue+"'", "[DateTime] desc");

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

            return;
        }

        PF.DataGridBindData(g, dt, gPager);
    }
Example #3
0
    private void BindNews()
    {
        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable("DataCache_Challenge_72_News");

        if (dt == null)
        {
            dt = new DAL.Tables.T_News().Open("top 5 [ID],[Title],[Content]", "TypeID = 9", "DateTime desc");

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

            if (dt.Rows.Count > 1)
            {
                Shove._Web.Cache.SetCache("DataCache_Challenge_72_News", dt, 1200);
            }
        }
        if (dt == null)
        {
            return;
        }
        if (dt.Rows.Count < 1)
        {
            return;
        }

        Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled);

        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        foreach (DataRow dr in dt.Rows)
        {
            sb.AppendLine("<li>");
            Match m = regex.Match(dr["Content"].ToString());

            if (m.Success)
            {
                sb.Append("<a href=\"" + dr["Content"].ToString() + "\" target=\"_blank\">" + Shove._String.Cut(dr["Title"].ToString(), 16) + "</a>");
            }
            else
            {
                sb.Append("<a href=\"../Home/Web/ShowNews.aspx?Id=" + dr["ID"].ToString() + "\" target=\"_blank\">" + Shove._String.Cut(dr["Title"].ToString(), 16) + "</a>");
            }
            sb.AppendLine("</li>");
        }

        NewsHTML = sb.ToString();
    }
Example #4
0
 private void BindData()
 {
     if (this.tv.Nodes.Count >= 1)
     {
         string selectedValue = this.tv.SelectedValue;
         if (selectedValue == "")
         {
             selectedValue = this.tv.Nodes[0].Value;
         }
         DataTable dt = new Tables.T_News().Open("", "SiteID = " + base._Site.ID.ToString() + " and TypeID = " + Utility.FilteSqlInfusion(selectedValue), "[DateTime] desc");
         if (dt == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName);
         }
         else
         {
             PF.DataGridBindData(this.g, dt, this.gPager);
         }
     }
 }
Example #5
0
    private void BindData()
    {
        long NewsID = Shove._Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), -1);

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

        //    return;
        //}

        tbID.Text = NewsID.ToString();

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

        string UploadPath = this.Server.MapPath("../../Cache/thumbnail/");

        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_News().Open("", "SiteID = 1 and [ID] = " + NewsID.ToString(), "");

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

        //    return;
        //}

        if (dt.Rows.Count > 0)
        {
            hdIsusesId.Value = dt.Rows[0]["IsusesId"].ToString();
            tbDateTime.Text = dt.Rows[0]["DateTime"].ToString();
            tbReadCount.Text = dt.Rows[0]["ReadCount"].ToString();
            cbisShow.Checked = Shove._Convert.StrToBool(dt.Rows[0]["isShow"].ToString(), true);
            cbisCanComments.Checked = Shove._Convert.StrToBool(dt.Rows[0]["isCanComments"].ToString(), true);
            cbisCommend.Checked = Shove._Convert.StrToBool(dt.Rows[0]["isCommend"].ToString(), false);
            cbisHot.Checked = Shove._Convert.StrToBool(dt.Rows[0]["isHot"].ToString(), false);
            tbTitle.Text = dt.Rows[0]["Title"].ToString();
            if (tbTitle.Text.IndexOf("red") > 0)
            {
                ddlTitleColor.Items[1].Selected = true;
                ddlTitleColor.Items[2].Selected = false;
                ddlTitleColor.Items[0].Selected = false;
            }
            else if (tbTitle.Text.IndexOf("black") > 0)
            {
                ddlTitleColor.Items[2].Selected = true;
                ddlTitleColor.Items[1].Selected = false;
                ddlTitleColor.Items[0].Selected = false;
            }
            else
            {
                ddlTitleColor.Items[0].Selected = true;
                ddlTitleColor.Items[2].Selected = false;
                ddlTitleColor.Items[1].Selected = false;
            }
            string UC = dt.Rows[0]["Content"].ToString();

            Regex regex = new Regex(@"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            Match m = regex.Match(UC);

            if (m.Success)
            {
                trContent.Visible = false;

                tbUrl.Text = UC;
                rblType.SelectedValue = "1";
            }
            else
            {
                trUrl.Visible = false;

                tbContent.Text = UC;
                rblType.SelectedValue = "2";
            }

            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;
            }


        }

    }