using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using EnterpriseNET.BusinessLogicLayer;
using EnterpriseNET.DataAccessHelper;
using EnterpriseNET.CommonComponent;

public partial class certpic_view : System.Web.UI.Page
{
    public string SeoTitle, SeoKeywords, SeoDesc, FacPicTitle, PicPathBig, FacPicContent;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                int facPicID = -1;
                string strSql = "";
                if (Request.QueryString["FacPicID"] != "")
                    facPicID = Convert.ToInt32(Request.QueryString["FacPicID"]);

                FacPic facPic = new FacPic();
                facPic.LoadData(facPicID);

                if (facPic.exist)
                {
                    //显示工程案例详细内容
                    SeoTitle = facPic.seoTitle;
                    SeoKeywords = facPic.seoKeywords;
                    SeoDesc = facPic.seoDesc;
                    FacPicTitle = facPic.facPicTitle;
                    PicPathBig = facPic.picPathBig;
                    FacPicContent = facPic.facPicContent;

                    //上一条
                    strSql = "select top 1 FacPicID,FacPicTitle,PicPathSmall from cai_FacPic where PicClassID=10 and FacPicID<" + facPicID + " order by FacPicID desc";
                    DataView dvlist_N = News.QueryNews(strSql);
                    if (dvlist_N.Count > 0)
                    {
                        this.pre_p.Text = "<a href=certpic_detail-" + dvlist_N.Table.Rows[0][0].ToString() + ".html>" + dvlist_N.Table.Rows[0][1].ToString() + "</a>";
                    }
                    else
                    {
                        this.pre_p.Text = "<a href=cert_1.html>[" + "企业资质" + "]</a>";
                    }

                    //下一条
                    strSql = "select top 1 FacPicID,FacPicTitle,PicPathSmall from cai_FacPic where PicClassID=10 and FacPicID>" + facPicID + " order by FacPicID";
                    DataView dvlist_N2 = Product2.QueryProducts(strSql);
                    if (dvlist_N2.Count > 0)
                    {
                        this.next_p.Text = "<a href=certpic_detail-" + dvlist_N2.Table.Rows[0][0].ToString() + ".html>" + dvlist_N2.Table.Rows[0][1].ToString() + "</a>";
                    }
                    else
                    {
                        this.next_p.Text = "<a href=cert_1.html>[" + "企业资质" + "]</a>";
                    }


                    Page.DataBind();

                }
                else
                {
                    Response.Write("数据不存在.");
                    Response.End();
                }
            }
            catch
            {
                Response.Write("发生错误.");
                Response.End();
            }
        }
    }

    protected string cutstr(string strChar, int intLength)
    {
        //取得自定义长度的字符串
        if (strChar.Length > intLength)
        {
            return strChar.Substring(0, intLength);
        }
        else
        {
            return strChar;
        }
    }
}