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 AdLocationEdit : BasePage { Info_AdLoctionBLL bll_Info_AdLoctionBLL = null; Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; //初始化 public AdLocationEdit() { bll_Info_AdLoctionBLL = new Info_AdLoctionBLL(); bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //页面加载 public void InitData() { this.selRemark.DataSource = bll_Sys_DictionaryBLL.GetDataByType("网站广告位置版块"); this.selRemark.DataValueField = "MeanValue"; this.selRemark.DataTextField = "Name"; this.selRemark.DataBind(); Info_AdLoction m_Info_AdLoction = new Info_AdLoction(); if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) m_Info_AdLoction = bll_Info_AdLoctionBLL.SelectModelByKeyId(Request["Keyid"].ToInt32()); this.txtAP_Title.Value = m_Info_AdLoction.AP_Title.ToString2(); this.txtAP_WidePixels.Value = m_Info_AdLoction.AP_WidePixels.ToString2(); this.txtAP_HighPixels.Value = m_Info_AdLoction.AP_HighPixels.ToString2(); this.afileAP_DefaultImg.HRef = m_Info_AdLoction.AP_DefaultImg.ToString2(); this.selRemark.Value = m_Info_AdLoction.Remark.ToString2(); } //提交事件 protected void btn_Submit_form(object sender, EventArgs e) { Info_AdLoction m_Info_AdLoction = new Info_AdLoction(); if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) m_Info_AdLoction = bll_Info_AdLoctionBLL.SelectModelByKeyId(Request["Keyid"].ToInt32()); m_Info_AdLoction.AP_Title = this.txtAP_Title.Value.ToString2(); m_Info_AdLoction.AP_WidePixels = this.txtAP_WidePixels.Value.ToInt32(); m_Info_AdLoction.AP_HighPixels = this.txtAP_HighPixels.Value.ToInt32(); //图片上传 CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("fileAP_DefaultImg", m_Info_AdLoction.AP_DefaultImg); m_Info_AdLoction.AP_DefaultImg = m_Info_AdLoction.AP_DefaultImg ?? ""; if (_UpFileResult2.returnerror.Count == 0) { if (_UpFileResult2.returnfilename.Count > 0) m_Info_AdLoction.AP_DefaultImg = _UpFileResult2.returnfilename[0].ToString2(); } else { JavaScript.MessageBox(string.Join("
", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this); return; } m_Info_AdLoction.Remark = this.selRemark.Value.ToInt32(); m_Info_AdLoction.LastUpdateTime = DateTime.Now; m_Info_AdLoction.Operator = CurrentUser.ShortName; m_Info_AdLoction.Price_Month = m_Info_AdLoction.Price_Month ?? 0; m_Info_AdLoction.Price_Season = m_Info_AdLoction.Price_Season ?? 0; m_Info_AdLoction.Price_Half = m_Info_AdLoction.Price_Half ?? 0; m_Info_AdLoction.Price_Year = m_Info_AdLoction.Price_Year ?? 0; if (Request["Keyid"] != null && Request["Keyid"].ToInt32() > 0) { if (bll_Info_AdLoctionBLL.UpdateModel(m_Info_AdLoction)) JavaScript.MessageBox("更新成功", this, true, false); else JavaScript.MessageBox("更新失败", this); } else { if (bll_Info_AdLoctionBLL.InsertModel(m_Info_AdLoction)) JavaScript.RefreshParent(this); else JavaScript.MessageBox("添加失败", this); } } } }