918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/712bd9e6/ca967f19/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/712bd9e6/ca967f19/App_Web_ckft0hmx.3.cs
?#pragma checksum "D:\wwwroot\bgsciences\wwwroot\index.aspx.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "AE64E52FE093EFE4A396A44EF7A4729271761D22"

#line 1 "D:\wwwroot\bgsciences\wwwroot\index.aspx.cs"
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;

public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindBanner();
        }
    }

    protected string BindTopNews()
    {
        int picid = 0;
        StringBuilder sb = new StringBuilder();
        DataTable dtpic = SQLServerHelper.ExecuteTable("select top 1 * from TB_News where pic <> '' order by orders desc,id desc");
        if (dtpic != null && dtpic.Rows.Count > 0)
        {
            picid = Convert.ToInt32(dtpic.Rows[0]["id"].ToString());
            sb.Append("<div class=\"news_ts\">");
            sb.Append("<img src=\"" + dtpic.Rows[0]["pic"] + "\" width=\"73\" height=\"56\" alt=\"" + dtpic.Rows[0]["title"].ToString() + "\" />");
            sb.Append("<span><strong><a href=\"newshow.aspx?id=" + dtpic.Rows[0]["id"] + "\" >" + SubLength(dtpic.Rows[0]["title"].ToString(), 20) + "</a></strong><br />");
            sb.Append("<a href=\"newshow.aspx?id=" + dtpic.Rows[0]["id"] + "\" >" + SubLength(dtpic.Rows[0]["ftitle"].ToString(), 40) + "...</a></span> </div>");
        }
        sb.Append("<div class=\"news_xw\">");
        sb.Append("<ul>");
        if (picid != 0)
        {
            DataTable dt = SQLServerHelper.ExecuteTable("select top 10 * from TB_News where id <> " + picid + " order by orders desc,id desc");
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb.Append("<li><a href=\"newshow.aspx?id=" + dt.Rows[i]["id"] + "\" tilte=\"" + dt.Rows[i]["title"].ToString() + "\">" + SubLength(dt.Rows[i]["title"].ToString(), 20) + "</a><span>" + Convert.ToDateTime(dt.Rows[i]["regtime"].ToString()).ToString("yyyy.MM.dd") + "</span></li>");
                }
            }
        }
        else
        {
            DataTable dt = SQLServerHelper.ExecuteTable("select top 10 * from TB_News order by orders desc,id desc");
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb.Append("<li><a href=\"newshow.aspx?id=" + dt.Rows[i]["id"] + "\" tilte=\"" + dt.Rows[i]["title"].ToString() + "\">" + SubLength(dt.Rows[i]["title"].ToString(), 20) + "</a><span>" + Convert.ToDateTime(dt.Rows[i]["regtime"].ToString()).ToString("yyyy.MM.dd") + "</span></li>");
                }
            }
        }
        sb.Append("</ul>");
        sb.Append("</div>");
        return sb.ToString();
    }

    protected string BindProduct()
    {
        StringBuilder sb = new StringBuilder();
        DataTable dt = SQLServerHelper.ExecuteTable("select top 15 * from TB_Product where pic <> '' order by orders desc,id asc");
        if (dt != null && dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sb.Append("<li><a href=\"proshow.aspx?id=" + dt.Rows[i]["id"] + "\"><img src=\"" + dt.Rows[i]["pic"].ToString() + "\" width=\"150\" height=\"109\" alt=\"" + dt.Rows[i]["title"] + "\"/><br />" + dt.Rows[i]["title"].ToString() + "</a></li>");
            }
        }
        return sb.ToString();
    }

    protected string SubLength(string str, int length)
    {
        string result = str;
        if (result.Length > length)
        {
            result = result.Substring(0, length);
        }
        return result;
    }

    protected string BindContactByType(int type)
    {
        string strcontent = string.Empty;
        DataTable dt = SQLServerHelper.ExecuteTable("select contents from TB_About where lg = 1 and types = " + type + "");
        if (dt.Rows.Count > 0)
        {
            strcontent = dt.Rows[0]["contents"].ToString();
        }
        return strcontent;
    }

    protected void BindBanner()
    {
        DataTable dt = SQLServerHelper.ExecuteTable("select top 5 * from TB_Link where types =2 order by orders desc,id asc");
        if (dt != null && dt.Rows.Count > 0)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["url"].ToString() == "")
                {
                    sb.Append("<li style=\"background: url('/" + dt.Rows[i]["pic"] + "') no-repeat center top\"></li>");
                }
                else
                {
                    sb.Append("<li style=\"background: url('/" + dt.Rows[i]["pic"] + "') no-repeat center top\"><a href=\"" + dt.Rows[i]["url"] + "\" target=\"_blank\"></a></li>");
                }
            }
            lt_banner.Text = sb.ToString();
        }
    }

    protected string BindTop5Case(int top)
    {
        StringBuilder sb = new StringBuilder();
        DataTable dt = SQLServerHelper.ExecuteTable("select top " + top + " * from TB_Case where pic <> '' order by orders desc,id desc");
        if (dt != null && dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sb.Append("<a rel=\"example_group\" href=\"/" + dt.Rows[i]["pic"] + "\"><img src=\"/" + dt.Rows[i]["pic"] + "\" width=\"280\" height=\"140\" alt=\"" + dt.Rows[i]["title"].ToString() + "\"/></a>");
            }
        }
        return sb.ToString();
    }
    protected void bt_search_Click(object sender, EventArgs e)
    {
        string key = txt_key.Text.Trim();
        if (key != "")
        {
            Response.Redirect("product.aspx?k=" + key + "");
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            string sql = "insert into TB_GuestBook(title,sname,tel,contents,lg,ip,regtime) values('" + txtName.Text + "给您留言了','" + txtName.Text + "','" + txtTel.Text + "','" + txtRemark.Text + "',1,'" + GetHostAddress() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";
            SQLServerHelper.execNonQuery(sql);
            MessageBox.ShowAndRedirect(this, "留言成功!", "index.aspx");
        }
        catch(Exception ex) {
            MessageBox.ShowAndRedirect(this, "留言失败!"+ex.Message, "index.aspx");
        }
    }

    public static string GetHostAddress()
    {
        string userHostAddress = HttpContext.Current.Request.UserHostAddress;

        if (string.IsNullOrEmpty(userHostAddress))
        {
            userHostAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
        }

        //最后判断获取是否成功,并查抄IP地址的体式(查抄其体式极度沉要)
        if (!string.IsNullOrEmpty(userHostAddress) && IsIP(userHostAddress))
        {
            return userHostAddress;
        }
        return "127.0.0.1";
    }

    public static bool IsIP(string ip)
     {
         return System.Text.RegularExpressions.Regex.IsMatch(ip, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");
     }
}

#line default
#line hidden