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 deleteKeyIdList = new List(); 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 deleteKeyIdList = new List(); 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 deleteKeyIdList = new List(); 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(); } } }