using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.Config; using CY.BLL.OA; using CY.BLL.Sys; using CY.Model; using CY.Infrastructure.Common; namespace CY.WebForm.Pages.sysglobal { //吴辉 //快递单模版 public partial class ExSingleTemEdit : BasePage { EC_ExSingleTemBLL bll_EC_ExSingleTemBLL = null; Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; //初始化 public ExSingleTemEdit() { bll_EC_ExSingleTemBLL = new EC_ExSingleTemBLL(); bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindType(); } } //绑定快递单类型 public void BindType() { this.selEMSType.DataSource = bll_Sys_DictionaryBLL.GetDataByType("快递单模版"); this.selEMSType.DataValueField = "Name"; this.selEMSType.DataTextField = "Name"; this.selEMSType.DataBind(); this.selEMSType.Items.Insert(0, new ListItem("请选择", "")); } //数据绑定 public void BindData() { EC_ExSingleTem m_EC_ExSingleTem = bll_EC_ExSingleTemBLL.GetModelByType(this.selEMSType.SelectedValue); if (m_EC_ExSingleTem != null) { this.txtEST_Width.Value = m_EC_ExSingleTem.EST_Width.ToString(); this.txtEST_Height.Value = m_EC_ExSingleTem.EST_Height.ToString(); this.hideBackground.Value = m_EC_ExSingleTem.EST_Background.ToString(); this.hideHtml.Value = m_EC_ExSingleTem.EST_Html; } else { this.txtEST_Width.Value = "0"; this.txtEST_Height.Value = "0"; this.hideBackground.Value = ""; this.hideHtml.Value = ""; } } //类型选择 protected void ChangeTypeBindData(object sender, EventArgs e) { BindData(); } //提交背景 protected void btn_SubmitBackground(object sender, EventArgs e) { //网站图标上传 CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload("Background", this.hideBackground.Value); if (_UpFileResult1.returnerror.Count == 0) { if (_UpFileResult1.returnfilename.Count > 0) { //this.All_Html.InnerHtml = Request["oldHtml"].ToString(); this.TopDIV.Style.Add("background-image", "url('" + _UpFileResult1.returnfilename[0].ToString2() + "')"); System.Drawing.Image bacImg = System.Drawing.Image.FromFile(Server.MapPath(_UpFileResult1.returnfilename[0].ToString2())); this.TopDIV.Style.Add("width", bacImg.Width.ToString2() + "px"); this.TopDIV.Style.Add("height", bacImg.Height.ToString2() + "px"); this.txtEST_Width.Value = bacImg.Width.ToString2(); this.txtEST_Height.Value = bacImg.Height.ToString2(); this.hideBackground.Value = _UpFileResult1.returnfilename[0].ToString2(); } } } //保存快递单 protected void SaveAsThisSore(object sender, EventArgs e) { EC_ExSingleTem m_EC_ExSingleTem = bll_EC_ExSingleTemBLL.GetModelByType(this.selEMSType.SelectedValue); if (m_EC_ExSingleTem == null) m_EC_ExSingleTem = new EC_ExSingleTem(); m_EC_ExSingleTem.EST_Background = this.hideBackground.Value.ToString(); m_EC_ExSingleTem.EST_Height = this.txtEST_Height.Value.ToInt32(); m_EC_ExSingleTem.EST_Html = this.hideHtml.Value; m_EC_ExSingleTem.EST_IsUse = true; m_EC_ExSingleTem.EST_Name = this.selEMSType.SelectedValue; m_EC_ExSingleTem.EST_Type = this.selEMSType.SelectedValue; m_EC_ExSingleTem.EST_Width = this.txtEST_Width.Value.ToInt32(); m_EC_ExSingleTem.LastUpdateTime = DateTime.Now; m_EC_ExSingleTem.MemberId = CurrentUser.MemberId; m_EC_ExSingleTem.Operator = CurrentUser.ShortName; m_EC_ExSingleTem.OrderNum = 0; if (m_EC_ExSingleTem.Keyid > 0) { if (bll_EC_ExSingleTemBLL.UpdateModel(m_EC_ExSingleTem)) JavaScript.MessageBox("保存成功", this); else JavaScript.MessageBox("保存失败", this); }else if (bll_EC_ExSingleTemBLL.InsertModel(m_EC_ExSingleTem)) JavaScript.MessageBox("保存成功", this); else JavaScript.MessageBox("保存失败", this); } } }