101 lines
3.0 KiB
C#
101 lines
3.0 KiB
C#
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.VSAT
|
||
{
|
||
public partial class FaultExam : BaseListPage
|
||
{
|
||
DataService.BLL.pro_fault_exam bll = new DataService.BLL.pro_fault_exam();
|
||
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 exam_title LIKE '%{0}%' ", name.Text.Trim());
|
||
}
|
||
|
||
var data = bll.GetModelList(query.ToString()).OrderByDescending(s => s.create_time).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);
|
||
if (bll.Delete(IdInput.Value))
|
||
{
|
||
List<string> list = new List<string>();
|
||
list.Add(model.pic1);
|
||
list.Add(model.pic2);
|
||
list.Add(model.pic3);
|
||
list.Add(model.pic4);
|
||
list.Add(model.pic5);
|
||
foreach(var pic in list)
|
||
{
|
||
if (!string.IsNullOrEmpty(pic))
|
||
{
|
||
string path = Server.MapPath(pic);
|
||
if (File.Exists(path))
|
||
{
|
||
File.Delete(path);
|
||
}
|
||
}
|
||
}
|
||
|
||
log.write_log("删除故障题目成功。" + "考试标题:" + model.exam_title + ",id:" + IdInput.Value);
|
||
}
|
||
|
||
DataLoad();
|
||
}
|
||
|
||
}
|
||
} |