dlmh_system/VRS/Management/FirstCooper.aspx.cs

107 lines
3.2 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 FirstCooper : BaseListPage
{
DataService.BLL.pro_first_cooper bll = new DataService.BLL.pro_first_cooper();
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 (cooper_name LIKE '%{0}%' ) ", name.Text.Trim());
}
var sql = query.ToString();
var data = bll.GetModelList(sql).OrderBy(s => s.pos).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.cooper_url))
{
string path = Server.MapPath(model.cooper_url);
if (File.Exists(path))
{
File.SetAttributes(path, FileAttributes.Normal);
File.Delete(path);
}
}
log.write_log("删除首页合作厂商成功。" + "名称:" + model.cooper_name + "ID" + IdInput.Value);
}
DataLoad();
}
protected void dp_type_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
DataLoad();
}
}
}