代码修改后的版本,全部提交
This commit is contained in:
114
Mtxfw.VipSite/Admin_Member_link_add.aspx.cs
Normal file
114
Mtxfw.VipSite/Admin_Member_link_add.aspx.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace Mtxfw.VipSite
|
||||
{
|
||||
public partial class Admin_Member_link_add : Mtxfw.Utility.MemberBase
|
||||
{
|
||||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
||||
public Mtxfw.DAL.Link daoLink = new Mtxfw.DAL.Link();
|
||||
public String strTitle = "",strBody = "";
|
||||
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();
|
||||
}
|
||||
Btn_Insert.Click += delegate(object s, EventArgs ex)
|
||||
{
|
||||
Mtxfw.Model.Link model = new Mtxfw.Model.Link();
|
||||
model.LinkName = Text_Title.Text;
|
||||
model.LinkImg = hiddenphoto.Value;
|
||||
model.LinkUrl = Text_LinkUrl.Text;
|
||||
model.CreateTime = DateTime.Now;
|
||||
daoLink.Add(model);
|
||||
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);
|
||||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('添加链接成功!');location.replace('" + Hidd_Url.Value + "')</script>");
|
||||
};
|
||||
|
||||
Btn_Update.Click += delegate(object s, EventArgs ex)
|
||||
{
|
||||
Int32 ID = int.Parse(Request.QueryString["ID"]);
|
||||
Mtxfw.Model.Link model = daoLink.GetModel(ID);
|
||||
model.LinkName = Text_Title.Text;
|
||||
model.LinkImg = hiddenphoto.Value;
|
||||
model.LinkUrl = Text_LinkUrl.Text;
|
||||
daoLink.Update(model);
|
||||
|
||||
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);
|
||||
|
||||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('更新链接成功!');location.replace('" + Hidd_Url.Value + "')</script>");
|
||||
};
|
||||
}
|
||||
|
||||
protected void Data_Bind()
|
||||
{
|
||||
if (Request.UrlReferrer != null)
|
||||
{
|
||||
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Hidd_Url.Value = "Admin_Member_link.aspx";
|
||||
}
|
||||
|
||||
if (Request.QueryString["ID"] == null)
|
||||
{
|
||||
strTitle = "添加链接";
|
||||
Page.Title = strTitle + " - " + GetWebName;
|
||||
Btn_Update.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
strTitle = "更新链接";
|
||||
Page.Title = strTitle + " - " + GetWebName;
|
||||
Btn_Insert.Visible = false;
|
||||
|
||||
Mtxfw.Model.Link model = daoLink.GetModel(int.Parse(Request.QueryString["ID"]));
|
||||
if (model != null)
|
||||
{
|
||||
Text_Title.Text = model.LinkName;
|
||||
if (!String.IsNullOrEmpty(model.LinkImg))
|
||||
{
|
||||
hiddenphoto.Value = model.LinkImg;
|
||||
}
|
||||
Text_LinkUrl.Text = model.LinkUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user