username@email.com
2025-05-14 99ddfbcecf0fa2881eb3a91028257eef87dab6de
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Query;
using CY.Infrastructure.Common;
 
namespace CY.WebForm.Pages.soft
{
    //吴辉
    //软件激活码列表
    public partial class KeyCodeList : BasePage
    {
        Soft_KeyCodeBLL bll_Soft_KeyCodeBLL = null;
        Soft_ManageBLL bll_Soft_ManageBLL = null;
 
        //初始化
        public KeyCodeList()
        {
            bll_Soft_KeyCodeBLL = new Soft_KeyCodeBLL();
            bll_Soft_ManageBLL = new Soft_ManageBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Pagination pa = new Pagination();
                pa.PageSize = 500;
                pa.PageIndex = 1;
                this.txtSoftTypeId.DataSource = bll_Soft_ManageBLL.SelectModelPage(pa, null, null, null, null, null, null);
                this.txtSoftTypeId.DataTextField = "SoftName";
                this.txtSoftTypeId.DataValueField = "Keyid";
                this.txtSoftTypeId.DataBind();
                this.txtSoftTypeId.Items.Insert(0, new ListItem("全部", ""));
 
                this.txtKeyStatus.Value = "1";
 
                BindList();
            }
 
            DateTime nowTime = DateTime.Now;
            if (!string.IsNullOrEmpty(Request["delete"]))
            {
                Soft_KeyCode model = bll_Soft_KeyCodeBLL.GetModelByKeyid(Request["delete"].ToInt32());
                if (model != null && model.Keyid != null)
                {
                    bll_Soft_KeyCodeBLL.DeleteModel(model);
                    JavaScript.MessageBox("删除成功", this);
                }
                else
                {
                    JavaScript.MessageBox("删除失败", this);
                }
                Response.Redirect("/Pages/Soft/KeyCodeList.aspx");
            }
            else if (!string.IsNullOrEmpty(Request["upid"]))
            {
                Soft_KeyCode model = bll_Soft_KeyCodeBLL.GetModelByKeyid(Request["upid"].ToInt32());
                if (model.Keyid != null && model != null)
                {
                    model.KeyNewNum = -1;
                    model.KeyStatus = 4;
                    model.LastUpdateTime = nowTime;
                    model.KeyUpTime = nowTime;
                    model.Operator = CurrentUser.ShortName;
                    bll_Soft_KeyCodeBLL.UpdateModel(model);
                    JavaScript.MessageBox("升级成功", this);
                }
                else
                {
                    JavaScript.MessageBox("升级失败", this);
                }
                Response.Redirect("/Pages/Soft/KeyCodeList.aspx");
            }
            else if (!string.IsNullOrEmpty(Request["deleteKeyIds"]))
            {
                List<int> deleteKeyIdList = new List<int>();
                string deleteKeyIds = Request["deleteKeyIds"].ToString().Trim(',');
                string[] keyIdArry = deleteKeyIds.Split(',');
                foreach (string keyId in keyIdArry)
                {
                    Soft_KeyCode model = bll_Soft_KeyCodeBLL.GetModelByKeyid(keyId.ToInt32());
                    if (model.Keyid != null && model != null)
                        bll_Soft_KeyCodeBLL.DeleteModel(model);
                    else
                    {
                        JavaScript.MessageBox("删除失败", this);
                        return;
                    }
                }
                JavaScript.MessageBox("删除成功", this);
                Response.Redirect("/Pages/Soft/KeyCodeList.aspx");
            }
            else if (!string.IsNullOrEmpty(Request["GranKeyIds"]))
            {
                List<int> deleteKeyIdList = new List<int>();
                string deleteKeyIds = Request["GranKeyIds"].ToString().Trim(',');
                string[] keyIdArry = deleteKeyIds.Split(',');
                foreach (string keyId in keyIdArry)
                {
                    Soft_KeyCode model = bll_Soft_KeyCodeBLL.GetModelByKeyid(keyId.ToInt32());
                    if (model.Keyid != null && model != null)
                    {
                        model.KeyStatus = 2;
                        model.LastUpdateTime = nowTime;
                        model.KeyOutTime = nowTime;
                        model.Operator = CurrentUser.ShortName;
                        bll_Soft_KeyCodeBLL.UpdateModel(model);
                    }
                    else
                    {
                        JavaScript.MessageBox("发放失败", this);
                        return;
                    }
                }
                JavaScript.MessageBox("发放成功", this);
                Response.Redirect("/Pages/Soft/KeyCodeList.aspx");
            }
            else if (!string.IsNullOrEmpty(Request["EndKeyIds"]))
            {
                List<int> deleteKeyIdList = new List<int>();
                string deleteKeyIds = Request["EndKeyIds"].ToString().Trim(',');
                string[] keyIdArry = deleteKeyIds.Split(',');
                foreach (string keyId in keyIdArry)
                {
                    Soft_KeyCode model = bll_Soft_KeyCodeBLL.GetModelByKeyid(keyId.ToInt32());
                    if (model.Keyid != null && model != null)
                    {
                        model.KeyStatus = 0;
                        model.LastUpdateTime = nowTime;
                        model.Operator = CurrentUser.ShortName;
                        bll_Soft_KeyCodeBLL.UpdateModel(model);
                    }
                    else
                    {
                        JavaScript.MessageBox("停用失败", this);
                        return;
                    }
                }
                JavaScript.MessageBox("停用成功", this);
                Response.Redirect("/Pages/Soft/KeyCodeList.aspx");
            }
        }
 
        //绑定数据
        private void BindList()
        {
            Pagination pa = new Pagination();
            pa.PageSize = 50000;
            pa.PageIndex = 1;
            this.RepClientList.DataSource = bll_Soft_KeyCodeBLL.SelectModelPage(pa, this.txtSoftTypeId.Value.ToInt32(), null, this.txtKeyCode.Value, this.txtKeyStatus.Value.ToInt32(), null, null, null, null, null, null, null, null, null, null, null, null, null,this.txtKeyWord.Value,this.txtKeyVersion.Value.ToInt32());
            this.RepClientList.DataBind();
        }
 
        //分页事件
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BindList();
        }
 
        //查询事件
        protected void btn_Search_Click(object src, EventArgs e)
        {
            BindList();
        }
    }
}