|
using Common;
|
using Dao;
|
using Model;
|
using System;
|
using System.Web;
|
using System.Web.Profile;
|
using System.Web.SessionState;
|
|
public partial class _GwStrategyUpdate : PageBase<SysUser>, IRequiresSessionState
|
{
|
private string _action = "";
|
private GwStrategy _gwStrategy = new GwStrategy();
|
|
|
|
public GwStrategy GwStrategy
|
{
|
get
|
{
|
return this._gwStrategy;
|
}
|
set
|
{
|
this._gwStrategy = value;
|
}
|
}
|
|
public string Action
|
{
|
get
|
{
|
return this._action;
|
}
|
set
|
{
|
this._action = value;
|
}
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (this.IsPostBack)
|
return;
|
this.Action = this.Request["action"];
|
if (this.Action == null)
|
return;
|
if (this.Action == "addDeal")
|
{
|
this.CheckRight("1011", FailedOperation.HistoryGoBack);
|
this.add();
|
}
|
else if (this.Action == "editDeal")
|
{
|
this.CheckRight("1012", FailedOperation.HistoryGoBack);
|
this.edit();
|
}
|
else if (this.Action == "edit")
|
{
|
this.CheckRight("1012", FailedOperation.HistoryGoBack);
|
this.GwStrategy = new GwStrategyDao().getObjById(this.Request["StrategyId"]);
|
}
|
else if (this.Action == "del")
|
{
|
this.CheckRight("1014", FailedOperation.HistoryGoBack);
|
if (this.del(this.Request["StrategyId"]))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除成功!');location.href='GwStrategy.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除失败!');location.href='GwStrategy.aspx';</script>");
|
this.Response.End();
|
}
|
}
|
else if (this.Action == "delSelect")
|
{
|
this.CheckRight("1014", FailedOperation.HistoryGoBack);
|
string[] strArray = this.Request["StrategyId"].Split(",".ToCharArray());
|
bool flag = false;
|
foreach (string StrategyId in strArray)
|
flag = this.del(StrategyId);
|
if (flag)
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除成功!');location.href='GwStrategy.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除失败!');location.href='GwStrategy.aspx';</script>");
|
this.Response.End();
|
}
|
}
|
else
|
this.CheckRight("1011", FailedOperation.HistoryGoBack);
|
}
|
|
protected bool del(string StrategyId)
|
{
|
return new GwStrategyDao().delById(StrategyId);
|
}
|
|
protected void add()
|
{
|
GwStrategy o = new GwStrategy();
|
o.StrategyId = DataConverter.StrToInt((object)this.Request["StrategyId"], 0);
|
o.StrategyName = this.Request["StrategyName"];
|
o.WordList = this.Request["WordList"];
|
o.PatternList = this.Request["PatternList"];
|
GwStrategyDao gwStrategyDao = new GwStrategyDao();
|
if (gwStrategyDao.hasName(o.StrategyName))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('该策略名称已经存在!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
if (gwStrategyDao.InsertInfo(o))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('添加成功!');location.href='GwStrategy.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('添加失败!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
}
|
|
protected void edit()
|
{
|
GwStrategy o = new GwStrategy();
|
o.StrategyId = DataConverter.StrToInt((object)this.Request["StrategyId"], 0);
|
o.StrategyName = this.Request["StrategyName"];
|
o.WordList = this.Request["WordList"];
|
o.PatternList = this.Request["PatternList"];
|
GwStrategyDao gwStrategyDao = new GwStrategyDao();
|
if (gwStrategyDao.hasName(o.StrategyName, string.Concat((object)o.StrategyId)))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('该策略名称已经存在!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
if (gwStrategyDao.UpdateInfo(o))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('修改成功!');location.href='GwStrategy.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('修改失败!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
}
|
}
|