using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.OA;
|
using CY.BLL.Promotion;
|
|
|
namespace CY.WebForm.Pages.sysglobal
|
{
|
public partial class Promotion_PictureEdit : BasePage
|
{
|
|
Promotion_PictureBLL _Promotion_PictureBLL = null;
|
Promotion_Picture Picture = null;
|
public Promotion_PictureEdit()
|
{
|
_Promotion_PictureBLL = new Promotion_PictureBLL();
|
}
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
|
if (!IsPostBack)
|
{
|
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
InitialModifyData();
|
}
|
}
|
|
}
|
/// <summary>
|
/// 如果是修改则显示原来数据的信息
|
/// </summary>
|
public void InitialModifyData()
|
{
|
|
Picture = _Promotion_PictureBLL.SelectSingleModel(Request["Keyid"].ToString2());
|
this.trImg.Visible = string.IsNullOrEmpty(Picture.FileId) ? false : true;
|
this.imgFileId.Src = Picture.FileId;
|
this.txtHeight.Value = Picture.Height.ToString2();
|
this.txtRemark.Value = Picture.Remark;
|
this.txtWidth.Value = Picture.Width.ToString2();
|
|
}
|
|
protected void btn_Submit_Click(object sender, EventArgs e)
|
{
|
Promotion_Picture m_Promotion_Picture = new Promotion_Picture();
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
m_Promotion_Picture = _Promotion_PictureBLL.SelectSingleModel(Request["Keyid"].ToString2());
|
}
|
|
|
//图片上传
|
CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("FileId", m_Promotion_Picture.FileId);
|
m_Promotion_Picture.FileId = m_Promotion_Picture.FileId ?? "";
|
if (_UpFileResult2.returnerror.Count == 0)
|
{
|
if (_UpFileResult2.returnfilename.Count > 0)
|
m_Promotion_Picture.FileId = _UpFileResult2.returnfilename[0].ToString2();
|
}
|
else
|
{
|
JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
|
return;
|
}
|
|
m_Promotion_Picture.Height = this.txtHeight.Value.ToInt32();
|
m_Promotion_Picture.Width = this.txtWidth.Value.ToInt32();
|
m_Promotion_Picture.Remark = this.txtRemark.Value;
|
m_Promotion_Picture.LastUpdateTime = DateTime.Now;
|
m_Promotion_Picture.Operator = CurrentUser.ShortName;
|
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
if (_Promotion_PictureBLL.UpdateModel(m_Promotion_Picture))
|
{
|
JavaScript.RefreshDIVOpener(this);
|
|
}
|
else
|
{
|
JavaScript.MessageBox("更新失败", this);
|
}
|
|
}
|
else
|
{
|
|
if (_Promotion_PictureBLL.insertModel(m_Promotion_Picture))
|
{
|
JavaScript.RefreshDIVOpener(this);
|
}
|
else
|
{
|
JavaScript.MessageBox("添加失败", this);
|
}
|
|
}
|
|
}
|
|
}
|
}
|