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

149 lines
5.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
namespace Mtxfw.VipSite
{
public partial class Admin_Member_Products_guest : Mtxfw.Utility.MemberBase
{
public Mtxfw.DAL.Guest daoGuest = new Mtxfw.DAL.Guest();
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
public int gtype = 0;
#region
private bool _refreshState;
private bool _isRefresh;
/// <summary>
/// 判断页面是否刷新
/// </summary>
public bool IsRefresh
{
get
{
return _isRefresh;
}
}
protected override void LoadViewState(object savedState)
{
object[] allStates = (object[])savedState;
base.LoadViewState(allStates[0]);
_refreshState = (bool)allStates[1];
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
}
protected override object SaveViewState()
{
Session["__ISREFRESH"] = _refreshState;
object[] allStates = new object[2];
allStates[0] = base.SaveViewState();
allStates[1] = !_refreshState;
return allStates;
}
#endregion
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string hostname = Request.Url.Host;
if (!IsPostBack)
{
if (Session["IFPassword"] == null)
{
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_Products_guest.aspx");
}
if (IFStores != 1)
{
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
}
if (MemberJS.IndexOf("商品问答管理") == -1)
{
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
}
Page.Title = "商品问答管理 - " + GetWebName;
Data_Bind();
}
MyPager.PageChanged += delegate(object s, EventArgs ex)
{
Data_Bind();
};
}
protected void Data_Bind()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
MyPager.PageSize = 20;
MyPager.RecordCount = daoGuest.GetCount("gtype=" + gtype + " and ttype=1" + sb.ToString());
Mtxfw.Utility.Tools.ToBind(Repeater1, daoGuest.GetPager(MyPager, "(select top 1 P_NAME from P_Product as b where b.P_Id=BusinessID) as bName,(select top 1 UserNAME from user_info as b where b.Id=userid) as UserName,(select top 1 UserNAME from user_info as b where b.Id=userid2) as UserName2,", "gtype=" + gtype + " and ttype=1" + sb.ToString() + " Order by IsShow,IsShow2,ID desc"));
foreach (RepeaterItem item in Repeater1.Items)
{
LinkButton lb = item.FindControl("Btn_Check") as LinkButton;
HiddenField hf = item.FindControl("Hidd_IsShow") as HiddenField;
if (hf.Value == "1")
{
lb.Enabled = false;
lb.Text = "问题已审";
}
lb = item.FindControl("Btn_Check2") as LinkButton;
hf = item.FindControl("Hidd_IsShow2") as HiddenField;
if (hf.Value == "1")
{
lb.Enabled = false;
lb.Text = "回答已审";
}
}
}
protected void Delete_Click(object s, CommandEventArgs ex)
{
Int32 ID = int.Parse(ex.CommandName);
daoGuest.Delete(ID);
Response.Redirect(Request.Url.AbsoluteUri);
}
protected void Check_Click(object s, CommandEventArgs ex)
{
Int32 ID = int.Parse(ex.CommandName);
daoGuest.UpdataCheck(ID);
Response.Redirect(Request.Url.AbsoluteUri);
}
protected void Check_Click2(object s, CommandEventArgs ex)
{
Int32 ID = int.Parse(ex.CommandName);
daoGuest.UpdataCheck2(ID);
Response.Redirect(Request.Url.AbsoluteUri);
}
protected void Run_Click(object s, System.EventArgs e)
{
CheckBox Check = new CheckBox();
string strs = seclect_Drop.SelectedItem.Value;
foreach (RepeaterItem Item in Repeater1.Items)
{
//在行中查找到该单选框
Check = (CheckBox)Item.FindControl("checka");
int strID = int.Parse(Check.CssClass);
if (Check.Checked == true)
{
if (strs == "0")
{
daoGuest.Delete(strID);
}
if (strs == "1")
{
daoGuest.UpdataCheck(strID);
}
if (strs == "2")
{
daoGuest.UpdataCheck2(strID);
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
}
}