dlmh_system/VRS/Management/Loop.aspx.cs

119 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.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace VRS.Management
{
public partial class Loop : BaseListPage
{
DataService.BLL.pro_loop bll = new DataService.BLL.pro_loop();
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()
{
StringBuilder query = new StringBuilder(" 1 = 1 ");
if (!string.IsNullOrWhiteSpace(name.Text.Trim()))
{
query.AppendFormat(" AND (head LIKE '%{0}%' or dsc LIKE '%{0}%' ) ", name.Text.Trim());
}
var sql = query.ToString();
var data = bll.GetModelList(sql).OrderBy(s => s.id).ToList();
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);
/*
var list = bll_app.GetModelList("soft_id='" + soft_id + "' "); // 附件条件进度未完成now() < end_time
if (list.Count > 0)
{
RadAjaxManager1.Alert("无法删除,该软件类型已经在使用中!");
return;
}
*/
if (bll.Delete(IdInput.Value))
{
if (!string.IsNullOrEmpty(model.pic_url))
{
string path = Server.MapPath(model.pic_url);
if (File.Exists(path))
{
File.SetAttributes(path, FileAttributes.Normal);
File.Delete(path);
}
}
if (!string.IsNullOrEmpty(model.video_url))
{
string path = Server.MapPath(model.video_url);
if (File.Exists(path))
{
File.SetAttributes(path, FileAttributes.Normal);
File.Delete(path);
}
}
log.write_log("删除轮播素材成功。" + "名称:" + model.head + "ID" + IdInput.Value);
}
DataLoad();
}
protected void dp_type_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
DataLoad();
}
}
}