ProductAlter.aspx.cs代码

using System;
using HoverTree.HoverTreeFrame.HtWeb;
using HoverTreeTop.HtBll;
using HoverTreeTop.HtModel.HtInfo;

namespace HoverTreeTop.HoverTree.HoverTreePanel.HTPanel.HProduct
{
public partial class ProductAlter : System.Web.UI.Page
{
/// <summary>
/// 文件名
/// </summary>
//protected string _fileName="";

/// <summary>
///
/// </summary>
/// <param name="fileName">图片文件名</param>
private void PicAdd1_OperateSuccess(string fileName)
{
// literal_tips.Text = literal_tips.Text + " |请添加记录产品文件名:"+literal_fileName.Text+",图片文件名:"+fileName;

if( HtProduct.AddPicture(literal_fileName.Text,fileName)=="")
{
literal_tips.Text = literal_tips.Text + " |把图片添加到产品成功。";
}
else
{
literal_tips.Text = literal_tips.Text + " |把图片添加到产品失败!";
}

picList1.SetProduct(literal_fileName.Text);
}

protected void Page_Load(object sender, EventArgs e)
{
//picAdd1.PictureFileName;
if (!IsPostBack)
{
int h_htid = RequestHelper.GetQueryInt("htid", 0);
string h_fileName = "";
if(h_htid==0)
{
h_fileName= RequestHelper.GetQueryString("htfn", "");
}
HtProductInfo h_info = null;
if (h_htid > 0)
{
h_info = HtProduct.Get(h_htid);

}
else if(h_fileName!=string .Empty)
{
h_info = HtProduct.Get(h_fileName);
}

if (h_info != null)
{
// _fileName = h_info.HtFileName;
literal_id.Text = h_info.HtId.ToString();
textBox_title.Text = h_info.HtTitle;
textBox_moreInfo.Text = h_info.HtMoreInfo;
textBox_number.Text = h_info.HtNumber;
textBox_price.Text = h_info.HtPrice;
textBox_content.Text = h_info.HtContent;
//textBox_fileName.Text = h_info.HtFileName;
literal_fileName.Text = h_info.HtFileName;
literal_addTime.Text = h_info.HtAddTime.ToString();
checkBox_isTop.Checked = h_info.HtIsTop;
checkBox_isShow.Checked = h_info.HtIsShow;
// picList1.HtProductFilename = h_info.HtFileName;
picAdd1.Visible = true;

picList1.SetProduct(h_info.HtFileName);
}
else
{
literal_tips.Text = "不存在该id或者文件名的产品";
button_alter.Enabled = false;
}
}
//为picAdd1控件的事件添加监听方法
picAdd1.OperateSuccess += PicAdd1_OperateSuccess;
}

protected void button_alter_Click(object sender, EventArgs e)
{
HtProductInfo h_info = new HtProductInfo();
h_info.HtId = Convert.ToInt32(literal_id.Text);
if (h_info.HtId < 1)
{
literal_tips.Text = "id小于1的产品不存在";
return;
}
h_info.HtTitle = textBox_title.Text.Trim();
h_info.HtContent = textBox_content.Text;
h_info.HtIsTop = checkBox_isTop.Checked;
h_info.HtIsShow = checkBox_isShow.Checked;
h_info.HtPrice = textBox_price.Text.Trim();
h_info.HtNumber = textBox_number.Text.Trim();
h_info.HtMoreInfo = textBox_moreInfo.Text;
//h_info.HtFileName = literal_fileName.Text;

literal_tips.Text = HtBll.HtProduct.Alter(h_info);
if (literal_tips.Text == "")
literal_tips.Text = "修改成功,"+DateTime.Now.ToString();
}
}
}