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.InfoManage { //吴辉 //添加/修改联盟信息 public partial class Info_AllianceEdit : BasePage { Info_AllianceBLL bll_Info_AllianceBLL = null; Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; //初始化 public Info_AllianceEdit() { bll_Info_AllianceBLL = new Info_AllianceBLL(); bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //页面加载 public void InitData() { this.selSortId.DataSource = bll_Sys_DictionaryBLL.GetDataByType("网站联盟资讯类型"); this.selSortId.DataValueField = "Name"; this.selSortId.DataTextField = "Name"; this.selSortId.DataBind(); this.selSortId.Items.Insert(0, new ListItem("请选择", "")); Info_Alliance m_Info_Alliance = new Info_Alliance(); if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) m_Info_Alliance = bll_Info_AllianceBLL.SelectModelByKeyId(Request["Keyid"].ToInt32()); if (m_Info_Alliance != null && m_Info_Alliance.Keyid != null) { this.txtTitle.Value = m_Info_Alliance.Title.ToString2(); this.selSortId.Value = m_Info_Alliance.Type.ToString2(); this.txtInfoContent.Text = m_Info_Alliance.InfoContent.ToString2(); this.txtOrderNum.Value = m_Info_Alliance.OrderNum.ToString2(); } } //提交事件 protected void btn_Submit_form(object sender, EventArgs e) { Info_Alliance m_Info_Alliance = new Info_Alliance(); if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) m_Info_Alliance = bll_Info_AllianceBLL.SelectModelByKeyId(Request["Keyid"].ToInt32()); m_Info_Alliance.Title = this.txtTitle.Value.ToString2(); m_Info_Alliance.InfoContent = this.txtInfoContent.Text.ToString2(); m_Info_Alliance.OrderNum = this.txtOrderNum.Value.ToInt32(); m_Info_Alliance.LastUpdateTime = DateTime.Now; m_Info_Alliance.Operator = CurrentUser.ShortName; m_Info_Alliance.Type = this.selSortId.Value; if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) { if (bll_Info_AllianceBLL.UpdateModel(m_Info_Alliance)) JavaScript.MessageBox("更新成功", this, true,true); else JavaScript.MessageBox("更新失败", this); } else { m_Info_Alliance.CreatTime = DateTime.Now; if (bll_Info_AllianceBLL.InsertModel(m_Info_Alliance)) JavaScript.MessageBox("发布成功", this,true,true); else JavaScript.MessageBox("发布失败", this); } } } }