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

114 lines
3.4 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;
using System.IO;
namespace Mtxfw.VipSite
{
public partial class bindlinks : Mtxfw.Utility.MemberBase
{
public Mtxfw.DAL.Link daoLink = new Mtxfw.DAL.Link();
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
public int gtype = 0;
public string strTitle = "绑定链接";
#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;
gtype = new DAL.host().GetId(hostname);
if (!IsPostBack)
{
if (Session["IFPassword"] == null)
{
Response.Redirect("/Member_IFPassword.aspx?Url=/bindlinks.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();
String key = HttpUtility.UrlDecode(Request.QueryString["key"]);
sb.Append("id>0");
if (!String.IsNullOrEmpty(key))
{
sb.Append(" and linkname like '%" + key + "%'");
}
string groupby = "";
string strOrder = " CreateTime desc";
int Start = 0;
int Limit = 0;
Int32 Recount = 0;
MyPager.PageSize = 50;
Start = MyPager.PageSize * (MyPager.CurrentPageIndex - 1);
Limit = MyPager.PageSize;
DataSet dss = daoLink.GetDataSet(groupby, strOrder, "id,linkname,linkimg,createtime", "", sb.ToString(), Start, Limit, out Recount);
Mtxfw.Utility.Tools.ToBind(Repeater1, dss.Tables[1]);
MyPager.RecordCount = Recount;
if (MyPager.RecordCount == 0)
{
MyPager.Visible = false;
}
}
}
}