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 facpic_view : System.Web.UI.Page
{
    public string 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)
                {
                    //显示工程案例详细内容
                    FacPicTitle = facPic.facPicTitle;
                    PicPathBig = facPic.picPathBig;
                    FacPicContent = facPic.facPicContent;

                    Page.DataBind();

                    Random random = new Random(System.Guid.NewGuid().GetHashCode());
                    int r = random.Next();
                    strSql = "select top 3 FacPicID,FacPicTitle,PicPathSmall from cai_FacPic where PicClassID=1 order by rnd(" + (-r) + "*FacPicID)";
                    DataView dvlist = FacPic.QueryFacPic(strSql);
                    ProductListNew.DataSource = dvlist;
                    ProductListNew.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;
        }
    }

}