gyhlw_dotnet/网站项目/VRS/Management/VSAT/TechSpecManage.aspx.cs

112 lines
3.5 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace VRS.Management.VSAT
{
public partial class TechSpecManage : BaseListPage
{
DataService.BLL.pro_know bll = new DataService.BLL.pro_know();
DataService.BLL.pro_type_manage bll_type_manage = new DataService.BLL.pro_type_manage();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
protected override void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataLoad();
}
}
protected override void DataLoad()
{
string type_id = "";
var type = bll_type_manage.GetModelList(" type_name='技术规范' ").FirstOrDefault();
if (null != type)
{
type_id = type.type_id;
}
StringBuilder query = new StringBuilder(" 1 = 1 and type_id='" + type_id + "' ");
if (!string.IsNullOrWhiteSpace(title.Text.Trim()))
{
query.AppendFormat(" AND title LIKE '%{0}%' ", title.Text.Trim());
}
if (!string.IsNullOrWhiteSpace(content.Text.Trim()))
{
query.AppendFormat(" AND keyword LIKE '%{0}%' ", content.Text.Trim());
}
var data = bll.GetList(query.ToString());
dataList.DataSource = data;
dataList.Rebind();
}
protected override void GridList_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
DataLoad();
}
protected override void GridList_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
{
DataLoad();
}
protected override void GridList_SortCommand(object sender, GridSortCommandEventArgs e)
{
DataLoad();
}
protected override void GrdList_DeleteCommand(object sender, GridCommandEventArgs e)
{
string Id = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString();
bll.Delete(Id);
DataLoad();
}
protected override void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
}
protected void btnSelect_Click(object sender, EventArgs e)
{
DataLoad();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
var model = bll.GetModel(IdInput.Value);
if (bll.Delete(IdInput.Value))
{
string path = Server.MapPath(model.pic_url);
if (File.Exists(path))
{
File.Delete(path);
}
log.write_log("删除技术规范成功。" + "技术规范名称:" + model.title + "技术规范ID" + IdInput.Value);
}
DataLoad();
}
protected void dataList_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;
HtmlAnchor anchor = e.Item.FindControl("file_link") as HtmlAnchor;
var row=e.Item.DataItem as DataRowView;
anchor.HRef = row["pic_url"].ToString();
anchor.InnerHtml= row["r1"].ToString();
}
}
}
}