Files
g.hnyhua.cn/Mtxfw.shop/bbs/particular.aspx.cs
2026-02-07 15:48:27 +08:00

322 lines
17 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Globalization;
namespace Mtxfw.shop.bbs
{
/// <summary>
/// myShoppingCart 的摘要说明。
/// </summary>
public partial class particular : System.Web.UI.Page
{
Mtxfw.DAL.Ads daoAds = new Mtxfw.DAL.Ads();
protected string ShowConent = "";
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
public Mtxfw.DAL.forum daoforum = new Mtxfw.DAL.forum();
public Mtxfw.DAL.bbs daobbs = new Mtxfw.DAL.bbs();
Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
protected int IFStores = 0;
protected string AdsName01, AdsName02;
protected string indexTP01, indexTP02;
protected string indexTPLink01, indexTPLink02;
protected string strposition = "", iftj = "0", B_ID = "0", B_ForumId = "0", B_Title = "", B_ForumName = "", strBody="";
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["MemberId"] != null && Session["MemberIFStores"] != null)
{
IFStores = int.Parse(Session["MemberIFStores"].ToString());
}
System.Data.DataSet Ds_Ads = daoAds.GetCacheList("top 1", "utype=N'论坛广告' Order By AdsSort desc", "bbs_Ads2");
System.Data.DataTable Dt_Ads = Ds_Ads != null && Ds_Ads.Tables[0] != null ? Ds_Ads.Tables[0] : null;
foreach (System.Data.DataRow Dr in Dt_Ads.Rows)
{
indexTP01 = Dr["AdsPic"].ToString();
indexTPLink01 = Dr["AdsUrl"].ToString();
AdsName01 = Dr["AdsName"].ToString();
}
if (!Page.IsPostBack)
{
if (Request.UrlReferrer != null)
{
Hidd_Url.Value = Request.UrlReferrer.ToString();
}
myDataBind();
}
}
private void myDataBind()
{
if (Request.QueryString["BBSID"] != null)
{
B_ID = Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["BBSID"].ToString());
int B_TType = 0, B_seef = 0, B_IFDelete = 0, B_IFReBack=0;
DataSet ds = daobbs.GetList1("B_TType,B_Title,B_ForumId,B_Layer,B_seef,B_IFDelete,B_IFReBack,(select b.B_ForumName From forum b where b.B_Id=a.B_ForumID) as B_ForumName", "B_ID=" + B_ID);
if (ds.Tables[0].Rows.Count > 0)
{
B_Title = ds.Tables[0].Rows[0]["B_Title"].ToString();
B_ForumName = ds.Tables[0].Rows[0]["B_ForumName"].ToString();
B_ForumId = ds.Tables[0].Rows[0]["B_ForumId"].ToString();
B_TType = Convert.ToInt32(ds.Tables[0].Rows[0]["B_TType"].ToString());
B_seef = Convert.ToInt32(ds.Tables[0].Rows[0]["B_seef"].ToString());
B_IFDelete = Convert.ToInt32(ds.Tables[0].Rows[0]["B_IFDelete"].ToString());
B_IFReBack = Convert.ToInt32(ds.Tables[0].Rows[0]["B_IFReBack"].ToString());
}
ds.Clear();
if (B_IFReBack == 1)
{
Add_Panel.Visible = false;
}
int B_pid = 0, B_Layer=0;
string PForumName = "";
ds = daoforum.GetList1("B_Layer,B_pid,(select b.B_ForumName From forum b where b.B_Id=a.B_pid) as PForumName", "B_ID=" + B_ForumId);
if (ds.Tables[0].Rows.Count > 0)
{
B_Layer = Convert.ToInt32(ds.Tables[0].Rows[0]["B_Layer"].ToString());
B_pid = Convert.ToInt32(ds.Tables[0].Rows[0]["B_pid"].ToString());
PForumName = ds.Tables[0].Rows[0]["PForumName"].ToString();
}
ds.Clear();
if (B_Layer == 2)
{
Page.Title = B_ForumName + "-" + PForumName + "-" + config.webName;
Page.MetaDescription = B_ForumName + "-" + PForumName + "-" + config.webDescription;
Page.MetaKeywords = B_ForumName + "," + PForumName + "-" + config.webKeywords;
strposition = "<a href=\"/bbs/forum-" + B_pid + ".html\">" + PForumName + "</a> &gt; <a href=\"/bbs/forum-" + B_ForumId + ".html\">" + B_ForumName + "</a> &gt; 帖子详情";
}
else
{
Page.Title = B_ForumName + "-" + config.webName;
Page.MetaDescription = B_ForumName + "-" + config.webDescription;
Page.MetaKeywords = B_ForumName + "-" + config.webKeywords;
strposition = "<a href=\"/bbs/forum-" + B_ForumId + ".html\">" + B_ForumName + "</a> &gt; 帖子详情";
}
ds = daobbs.GetList1("B_ID,B_TType,B_Title,B_Body,B_ForumId,B_MemberId,B_SetTop,B_Hits,B_Childs,B_Layer,B_seef,B_IFTJ,B_IFHot,B_Lock,B_IFDelete,B_IFLogin,B_IFShow,B_SubmitDate,B_UpDate,(select b.UserName From User_Info b where b.Id=a.B_MemberId) as MemberName", "(B_ID=" + B_ID + " Or B_FatherId=" + B_ID + ") Order By B_Layer asc,B_SubmitDate asc");
MyRepeater.DataSource = ds;
MyRepeater.DataBind();
if (B_IFDelete == 1)
{
Mtxfw.Utility.Tools.Message("该贴已被删除!", Hidd_Url.Value);
}
if (B_seef == 0)
{
Mtxfw.Utility.Tools.Message("该贴还没有审核通过!", Hidd_Url.Value);
}
daobbs.Update("B_Hits",1, Convert.ToInt64(B_ID));
}
}
protected void MyRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
//这个判断语句表示,只有对于数据行才执行,对于标题栏和脚注栏则不执行
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.SelectedItem)
{
int B_MemberId = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["B_MemberId"].ToString());
string B_MemberName = ((System.Data.DataRowView)e.Item.DataItem)["MemberName"].ToString();
int MemberId = 0;
string MemberName="";
if (Session["MemberId"] != null && Session["MemberName"] != null)
{
MemberId = Convert.ToInt32(Session["MemberId"].ToString());
MemberName = Session["MemberName"].ToString();
}
Label lblFloor = (Label)e.Item.FindControl("lblFloor");
Label UserLabel = (Label)e.Item.FindControl("UserLabel");
Label Hits_label = (Label)e.Item.FindControl("Hits_label");
Label Body_Label = (Label)e.Item.FindControl("Body_Label");
Label BBSConent_Label = (Label)e.Item.FindControl("BBSConent_Label");
HyperLink lnkDel = (HyperLink)e.Item.FindControl("lnkDel");
HyperLink lnkUpdate = (HyperLink)e.Item.FindControl("lnkUpdate");
HyperLink lnkSetTop = (HyperLink)e.Item.FindControl("lnkSetTop");
HyperLink lnkSetTJ = (HyperLink)e.Item.FindControl("lnkSetTJ");
HyperLink lnkSetHot = (HyperLink)e.Item.FindControl("lnkSetHot");
HyperLink lnkSetLock = (HyperLink)e.Item.FindControl("lnkSetLock");
HyperLink lnkReBack = (HyperLink)e.Item.FindControl("lnkReBack");
lnkDel.Attributes.Add("onclick", "javascript:return confirm('您真的要删除文章 " + ((System.Data.DataRowView)e.Item.DataItem)["B_Title"].ToString() + " 吗?');");
//下面根据第几楼,分别进行不同的操作
int B_ID = 0;
int B_IFLogin =0;
int B_IFShow = 0;
if (e.Item.ItemIndex == 0)
{
B_ID = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["B_ID"].ToString());
B_IFLogin = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["B_IFLogin"].ToString());
B_IFShow = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["B_IFShow"].ToString());
//添加序号
lblFloor.Text = "楼主";
Hits_label.Text = "发表时间:" + ((System.Data.DataRowView)e.Item.DataItem)["B_SubmitDate"].ToString();
Hits_label.Text += "&nbsp;&nbsp;阅读/回复:" + ((System.Data.DataRowView)e.Item.DataItem)["B_Hits"].ToString() + "/" + ((System.Data.DataRowView)e.Item.DataItem)["B_Childs"].ToString();
Hits_label.Text += "&nbsp;&nbsp;&nbsp;&nbsp;" + (((System.Data.DataRowView)e.Item.DataItem)["B_SetTop"].ToString() == "1" ? "<span class=\"SetTop\">顶</span>" : "");
Hits_label.Text += "" + ((System.Data.DataRowView)e.Item.DataItem)["B_IFHot"].ToString() == "1" ? "<span class=\"IFHot\">热</span>" : "";
Hits_label.Text += "" + ((System.Data.DataRowView)e.Item.DataItem)["B_IFTJ"].ToString() == "1" ? "<span class=\"IFTJ\">荐</span>" : "";
if (MemberId>0)
{
lnkReBack.Visible = true;
if (daoforum.IsForumManager(Convert.ToInt32(B_ForumId), MemberName))
{
lnkDel.Visible = true;
lnkSetTop.Visible = true;
lnkSetTJ.Visible = true;
lnkSetHot.Visible = true;
lnkSetLock.Visible = true;
lnkUpdate.Visible = true;
}
if (MemberId == B_MemberId)
{
lnkUpdate.Visible = true;
}
}
if (((System.Data.DataRowView)e.Item.DataItem)["B_IFDelete"].ToString() == "1")
{
Body_Label.Text = "<div class='IFdel'>此回贴已被删除</div>";
}
else if (((System.Data.DataRowView)e.Item.DataItem)["B_Lock"].ToString() == "1")
{
Body_Label.Text = "<div class='IFdel'>此回贴已被锁定</div>";
}
else if (((System.Data.DataRowView)e.Item.DataItem)["B_seef"].ToString() == "0")
{
Body_Label.Text = "<div class='IFdel'>此回贴未被审核</div>";
}
else
{
Body_Label.Text = ((System.Data.DataRowView)e.Item.DataItem)["B_body"].ToString() + "";
}
if (B_IFLogin == 1)
{
if (MemberId <= 0)
{
Body_Label.Text = "<div class='IFdel'>此贴需要登录才能查看内容</div>";
}
}
if (B_IFShow == 1)
{
if (MemberId <= 0)
{
Body_Label.Text = "<div class='IFdel'>此贴需要回复才能查看内容</div>";
}
else
{
if (daobbs.GetCount("B_MemberId=" + MemberId + " And B_FatherId=" + B_ID + " And B_Layer=1 And B_seef=1") == 0)
{
Body_Label.Text = "<div class='IFdel'>此贴需要回复才能查看内容</div>";
}
}
}
}
else
{
Hits_label.Text = "回复时间:" + ((System.Data.DataRowView)e.Item.DataItem)["B_SubmitDate"].ToString();
Hits_label.Text += "";
//添加序号
lblFloor.Text = "第" + e.Item.ItemIndex + "楼";
if (((System.Data.DataRowView)e.Item.DataItem)["B_IFDelete"].ToString() == "1")
{
Body_Label.Text = "<div class='IFdel'>此贴已被删除</div>";
}
else if (((System.Data.DataRowView)e.Item.DataItem)["B_Lock"].ToString() == "1")
{
Body_Label.Text = "<div class='IFdel'>此贴已被锁定</div>";
if (MemberId > 0)
{
if (daoforum.IsForumManager(Convert.ToInt32(B_ForumId), MemberName))
{
lnkSetLock.Visible = true;
}
}
}
else
{
if (MemberId > 0)
{
lnkReBack.Visible = true;
if (daoforum.IsForumManager(Convert.ToInt32(B_ForumId), MemberName))
{
lnkDel.Visible = true;
lnkSetLock.Visible = true;
lnkUpdate.Visible = true;
}
if (MemberId == B_MemberId)
{
lnkUpdate.Visible = true;
}
}
Body_Label.Text = ((System.Data.DataRowView)e.Item.DataItem)["B_body"].ToString();
}
}
string strpic = "", strNCName = "", strArticle = "", strReArticle = "", strArticleJF = "", strMoney = "", strSubmitDate = "", strEmail = "", strSex = "", strBBSConent = "";
DataSet ds = daoUser.GetList1("NCName,UserPic,ArticleNum,ReArticleNum,ArticleJF,ArticleMoney,regtime,email,Sex,BBSConent", "id=" + B_MemberId);
if (ds.Tables[0].Rows.Count > 0)
{
strNCName = ds.Tables[0].Rows[0]["NCName"].ToString();
strpic = ds.Tables[0].Rows[0]["UserPic"].ToString();
strArticle = ds.Tables[0].Rows[0]["ArticleNum"].ToString();
strReArticle = ds.Tables[0].Rows[0]["ReArticleNum"].ToString();
strArticleJF = ds.Tables[0].Rows[0]["ArticleJF"].ToString();
strMoney = ds.Tables[0].Rows[0]["ArticleMoney"].ToString();
strSubmitDate = ds.Tables[0].Rows[0]["regtime"].ToString();
strEmail = ds.Tables[0].Rows[0]["email"].ToString();
strSex = ds.Tables[0].Rows[0]["Sex"].ToString();
strBBSConent = ds.Tables[0].Rows[0]["BBSConent"].ToString();
}
ds.Clear();
UserLabel.Text = "<div class='P_userid'><a href='mailto:" + strEmail + "' target='_blank'>" + (strNCName == "" ? B_MemberName : strNCName) + "</a></div>";
if (strSex == "女")
{
UserLabel.Text += "<div class='P_sex' alt='美女' title='美女'><img src='../images/bbs/FeMale.gif'></div>";
}
else if (strSex == "男")
{
UserLabel.Text += "<div class='P_sex' alt='帅哥' title='帅哥'><img src='../images/bbs/Male.gif'></div>";
}
else
{
UserLabel.Text += "<div class='P_sex' alt='保密' title='保密'>?</div>";
}
if (strpic == "")
{
UserLabel.Text += "<div class='P_pic'></div>";
}
else
{
UserLabel.Text += "<div class='P_pic'><img src='" + Mtxfw.Utility.Common.GetCoverPic(strpic, "150x150", "cut") + "' width=\"150\"></div>";
}
UserLabel.Text += "<div class='P_Forum'>版块:" + B_ForumName + "</div>";
if (!daoforum.IsForumManager(Convert.ToInt32(B_ForumId), B_MemberName))
{
UserLabel.Text += "<div class='P_SF'>身份:会员</div>";
}
else
{
UserLabel.Text += "<div class='P_SF'>身份:版主</div>";
}
UserLabel.Text += "<div class='P_Article'>发贴:" + strArticle + "</div>";
UserLabel.Text += "<div class='P_ReArticle'>回贴:" + strReArticle + "</div>";
UserLabel.Text += "<div class='P_ArticleJF'>积分:" + strArticleJF + "</div>";
UserLabel.Text += "<div class='P_Money'>金币:" + strMoney + "</div>";
UserLabel.Text += "<div class='P_SubmitDate'>注册时间:" + Convert.ToDateTime(strSubmitDate).ToString("yyyy-MM-dd", DateTimeFormatInfo.InvariantInfo) + "</div>";
if (Convert.ToInt32(strArticleJF) >= 500)
{
BBSConent_Label.Text = strBBSConent;
}
}
}
}
}