using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.Model; using CY.BLL; using CY.Infrastructure.Common; using System.Data; using CY.BLL.Sys; namespace CY.WebForm.Pages.workcar { //吴辉 //添加/修改车辆配置信息 public partial class MemberDictionaryEdit : BasePage { OA_CarDictionaryBLL bll_OA_CarDictionaryBLL = null; Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; //初始化 public MemberDictionaryEdit() { bll_OA_CarDictionaryBLL = new OA_CarDictionaryBLL(); bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //页面加载 public void InitData() { this.selParType.DataSource = bll_Sys_DictionaryBLL.GetDataByType("车辆配置表类型"); this.selParType.DataValueField = "Name"; this.selParType.DataTextField = "Name"; this.selParType.DataBind(); OA_CarDictionary m_OA_CarDictionary = new OA_CarDictionary(); if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) m_OA_CarDictionary = bll_OA_CarDictionaryBLL.GetModelByKeyid(Request["Keyid"].ToInt32()); this.txtParName.Value = m_OA_CarDictionary.ParName.ToString2(); this.selParType.Value = m_OA_CarDictionary.ParType.ToString2(); } //提交事件 protected void btn_Submit_form(object sender, EventArgs e) { OA_CarDictionary m_OA_CarDictionary = bll_OA_CarDictionaryBLL.GetModelByKeyid(Request["Keyid"].ToInt32()); if (m_OA_CarDictionary == null) { m_OA_CarDictionary = new OA_CarDictionary(); m_OA_CarDictionary.MemberId = CurrentUser.MemberId; } m_OA_CarDictionary.ParName = this.txtParName.Value.ToString2(); m_OA_CarDictionary.ParType = this.selParType.Value.ToString2(); m_OA_CarDictionary.Operator = CurrentUser.ShortName; m_OA_CarDictionary.LastUpdateTime = DateTime.Now; if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) { if (bll_OA_CarDictionaryBLL.UpdateModel(m_OA_CarDictionary)) JavaScript.MessageBox("更新成功", this, true, true); else JavaScript.MessageBox("更新失败", this); } else { if (bll_OA_CarDictionaryBLL.InsertModel(m_OA_CarDictionary)) { this.txtParName.Value = ""; JavaScript.MessageBox("新增成功", this, false, true); } else JavaScript.MessageBox("新增失败", this); } } } }