代码修改后的版本,全部提交
This commit is contained in:
152
Mtxfw.VipSite/Admin_Member_link.aspx.cs
Normal file
152
Mtxfw.VipSite/Admin_Member_link.aspx.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.IO;
|
||||
namespace Mtxfw.VipSite
|
||||
{
|
||||
public partial class Admin_Member_link : 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;
|
||||
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=/Admin_Member_link.aspx");
|
||||
}
|
||||
if (IFStores != 1)
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||||
}
|
||||
if (MemberJS.IndexOf("视频管理") == -1)
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||||
}
|
||||
Data_Bind();
|
||||
Page.Title = "链接管理 - " + GetWebName;
|
||||
}
|
||||
|
||||
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"]);
|
||||
|
||||
if (!String.IsNullOrEmpty(key))
|
||||
{
|
||||
sb.Append(" and linkname like '%" + key + "%'");
|
||||
}
|
||||
MyPager.PageSize = 50;
|
||||
MyPager.RecordCount = daoLink.GetCount("id>0" + sb.ToString());
|
||||
if (MyPager.RecordCount == 0)
|
||||
{
|
||||
MyPager.Visible = false;
|
||||
}
|
||||
Mtxfw.Utility.Tools.ToBind(Repeater1, daoLink.GetPager(MyPager, "", "id>0" + sb.ToString() + " Order by CreateTime desc"));
|
||||
}
|
||||
protected void Delete_Click(object s, CommandEventArgs ex)
|
||||
{
|
||||
Int32 ID = int.Parse(ex.CommandName);
|
||||
Mtxfw.Model.Link model = daoLink.GetModel(ID);
|
||||
if (model != null)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (model.LinkImg != "")
|
||||
{
|
||||
string yvideo = model.LinkImg;
|
||||
// 空间名
|
||||
string Bucket = config.qiniuScope;
|
||||
// 文件名
|
||||
string Key = yvideo;
|
||||
Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config.qiniuAccessKey, config.qiniuSecretKey);
|
||||
Qiniu.Storage.Config sconfig = new Qiniu.Storage.Config();
|
||||
sconfig.Zone = Qiniu.Storage.Zone.ZONE_CN_South;
|
||||
Qiniu.Http.HttpResult deleteRet = new Qiniu.Storage.BucketManager(mac, sconfig).Delete(Bucket, Key);
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||||
logmodel.MemberId = Card;
|
||||
logmodel.AddTime = DateTime.Now;
|
||||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||||
logmodel.Body = "删除链接,标题:" + model.LinkName + "";
|
||||
logmodel.UType = 0;
|
||||
logmodel.gtype = gtype;
|
||||
new DAL.User_CZ_log().Add(logmodel);
|
||||
}
|
||||
daoLink.Delete(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")
|
||||
{
|
||||
Mtxfw.Model.Link model = daoLink.GetModel(strID);
|
||||
if (model != null)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (model.LinkImg != "")
|
||||
{
|
||||
string yvideo = model.LinkImg;
|
||||
// 空间名
|
||||
string Bucket = config.qiniuScope;
|
||||
// 文件名
|
||||
string Key = yvideo;
|
||||
Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config.qiniuAccessKey, config.qiniuSecretKey);
|
||||
Qiniu.Storage.Config sconfig = new Qiniu.Storage.Config();
|
||||
sconfig.Zone = Qiniu.Storage.Zone.ZONE_CN_South;
|
||||
Qiniu.Http.HttpResult deleteRet = new Qiniu.Storage.BucketManager(mac, sconfig).Delete(Bucket, Key);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||||
logmodel.MemberId = Card;
|
||||
logmodel.AddTime = DateTime.Now;
|
||||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||||
logmodel.Body = "删除链接,标题:" + model.LinkName + "";
|
||||
logmodel.UType = 0;
|
||||
logmodel.gtype = gtype;
|
||||
new DAL.User_CZ_log().Add(logmodel);
|
||||
daoLink.Delete(strID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Data_Bind();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user