using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using CY.Model; using CY.BLL; using CY.Infrastructure.Common; using CY.Infrastructure.Query; namespace CY.WebForm.Pages.soft { //吴辉 //新增/修改软件更新记录 public partial class UpRecordAdd : BasePage { Soft_UpRecordBLL bll_Soft_UpRecordBLL = null; //初始化 public UpRecordAdd() { bll_Soft_UpRecordBLL = new Soft_UpRecordBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //数据加载 public void InitData() { Soft_UpRecord m_Soft_UpRecord = bll_Soft_UpRecordBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_Soft_UpRecord != null) { this.txtClientId.Value = m_Soft_UpRecord.ClientId.ToString2(); this.txtClientName.Value = m_Soft_UpRecord.ClientName.ToString2(); this.txtSoftId.Value = m_Soft_UpRecord.SoftId.ToString2(); this.txtSoftName.Value = m_Soft_UpRecord.SoftName.ToString2(); this.txtKeyCode.Value = m_Soft_UpRecord.KeyCode.ToString2(); this.txtUpdateIP.Value = m_Soft_UpRecord.UpdateIP.ToString2(); this.txtLastUpdateTime.Value = m_Soft_UpRecord.LastUpdateTime.ToString2(); this.txtOperator.Value = m_Soft_UpRecord.Operator.ToString2(); } else { this.txtClientId.Value = ""; this.txtClientName.Value = ""; this.txtSoftId.Value = ""; this.txtSoftName.Value = ""; this.txtKeyCode.Value = ""; this.txtUpdateIP.Value = ""; this.txtLastUpdateTime.Value = ""; this.txtOperator.Value = ""; } } //表单提交 protected void btn_submit_form(object sender, EventArgs e) { try { DateTime nowTime = DateTime.Now; Soft_UpRecord m_Soft_UpRecord = bll_Soft_UpRecordBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_Soft_UpRecord == null) { m_Soft_UpRecord = new Soft_UpRecord(); } m_Soft_UpRecord.ClientId = this.txtClientId.Value.ToInt32(); m_Soft_UpRecord.ClientName = this.txtClientName.Value.ToString2(); m_Soft_UpRecord.SoftId = this.txtSoftId.Value.ToInt32(); m_Soft_UpRecord.SoftName = this.txtSoftName.Value.ToString2(); m_Soft_UpRecord.KeyCode = this.txtKeyCode.Value.ToString2(); m_Soft_UpRecord.UpdateIP = this.txtUpdateIP.Value.ToString2(); m_Soft_UpRecord.LastUpdateTime = this.txtLastUpdateTime.Value.ToDateTime2(); m_Soft_UpRecord.Operator = this.txtOperator.Value.ToString2(); if (Request["keyid"].ToInt32() > 0) { if (bll_Soft_UpRecordBLL.UpdateModel(m_Soft_UpRecord)) JavaScript.MessageBox("更新成功", this, true, true); else JavaScript.MessageBox("更新失败", this); } else { if (bll_Soft_UpRecordBLL.InsertModel(m_Soft_UpRecord)) { JavaScript.MessageBox("新增成功", this, false, true); InitData(); } else JavaScript.MessageBox("新增失败", this); } } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } } }