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.work { //吴辉 //新增/修改公文基础数据 public partial class OA_DocumentDicAdd : BasePage { OA_DocumentDicBLL bll_OA_DocumentDicBLL = null; //初始化 public OA_DocumentDicAdd() { bll_OA_DocumentDicBLL = new OA_DocumentDicBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //数据加载 public void InitData() { OA_DocumentDic m_OA_DocumentDic = bll_OA_DocumentDicBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_OA_DocumentDic != null) { this.txtParType.Value = m_OA_DocumentDic.ParType.ToString2(); this.txtParName.Value = m_OA_DocumentDic.ParName.ToString2(); } else { this.txtParType.Value = ""; this.txtParName.Value = ""; } } //表单提交 protected void btn_submit_form(object sender, EventArgs e) { try { DateTime nowTime = DateTime.Now; OA_DocumentDic m_OA_DocumentDic = bll_OA_DocumentDicBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_OA_DocumentDic == null) { m_OA_DocumentDic = new OA_DocumentDic(); } m_OA_DocumentDic.MemberId = CurrentUser.MemberId; m_OA_DocumentDic.ParType = this.txtParType.Value.ToString2(); m_OA_DocumentDic.ParName = this.txtParName.Value.ToString2(); m_OA_DocumentDic.LastUpdateTime =nowTime; m_OA_DocumentDic.Operator = CurrentUser.ShortName; if (Request["keyid"].ToInt32() > 0) { if (bll_OA_DocumentDicBLL.UpdateModel(m_OA_DocumentDic)) JavaScript.MessageBox("更新成功", this, true, true); else JavaScript.MessageBox("更新失败", this); } else { if (bll_OA_DocumentDicBLL.InsertModel(m_OA_DocumentDic)) { JavaScript.MessageBox("新增成功", this, false, true); InitData(); } else JavaScript.MessageBox("新增失败", this); } } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } } }