Files
g.hnyhua.cn/Mtxfw.shop/_Admin/admin_Guide_add.aspx.cs

63 lines
2.0 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Mtxfw.shop._admin
{
public partial class admin_Guide_add : Mtxfw.Utility.AdminPage
{
public Mtxfw.DAL.Guide daoGuide = new Mtxfw.DAL.Guide();
public String TitName = String.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Hidd_Url.Value = Request.UrlReferrer.ToString();
if (Request.QueryString["action"] == "add")
{
TitName = "添加指南";
Btn_Update.Visible = false;
}
else
{
TitName = "更新指南";
Btn_Insert.Visible = false;
Int32 ID = int.Parse(Request.QueryString["ID"]);
Mtxfw.Model.Guide model = daoGuide.GetModel(ID);
Text_Question.Text = model.Question;
Text_Answer.Value = model.Answer;
}
}
#region
//添加
Btn_Insert.Click += delegate(object s, EventArgs ex)
{
Mtxfw.Model.Guide model = new Model.Guide();
model.Question = Text_Question.Text;
model.Answer = Text_Answer.Value;
daoGuide.Add(model);
Response.Redirect(Hidd_Url.Value);
};
//更改
Btn_Update.Click += delegate(object s, EventArgs ex)
{
Int32 ID = int.Parse(Request.QueryString["ID"]);
Mtxfw.Model.Guide model = daoGuide.GetModel(ID);
model.Question = Text_Question.Text;
model.Answer = Text_Answer.Value;
daoGuide.Update(model);
Response.Redirect(Hidd_Url.Value);
};
#endregion
}
}
}