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_AllianceLink : BasePage
|
{
|
Info_AllianceBLL bll_Info_AllianceBLL = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
|
//初始化
|
public Info_AllianceLink()
|
{
|
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()
|
{
|
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.txtOrderNum.Value = m_Info_Alliance.OrderNum.ToString2();
|
this.showImg.Visible = true;
|
this.showImg.HRef = m_Info_Alliance.InfoContent;
|
}
|
else
|
{
|
this.showImg.Visible = false;
|
}
|
}
|
|
|
//提交事件
|
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());
|
|
//图片上传
|
CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult2 = CY.WebForm.cs.UploadCS.Upload("txtInfoContent", m_Info_Alliance.InfoContent);
|
m_Info_Alliance.InfoContent = m_Info_Alliance.InfoContent ?? "";
|
if (_UpFileResult2.returnerror.Count == 0)
|
{
|
if (_UpFileResult2.returnfilename.Count > 0)
|
m_Info_Alliance.InfoContent = _UpFileResult2.returnfilename[0].ToString2();
|
}
|
else
|
{
|
JavaScript.MessageBox(string.Join("<br/>", (string[])_UpFileResult2.returnerror.ToArray(typeof(string))), this);
|
return;
|
}
|
m_Info_Alliance.Title = this.txtTitle.Value.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 = "友情链接";
|
|
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);
|
}
|
}
|
|
|
}
|
}
|