wzp
2022-10-25 1961452ebc018cf758924f26d9c7aa0b31495227
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 
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();
        }
    }
}