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

72 lines
2.3 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.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace VRS.Management.VSAT
{
public partial class TechKnowManage_Edit : BasePage
{
DataService.BLL.pro_know bll = new DataService.BLL.pro_know();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
if (!IsPostBack)
{
DataLoad();
}
}
protected void DataLoad()
{
string Id = Request.Params["Id"];
if (!string.IsNullOrWhiteSpace(Id))
{
var model = bll.GetModel(Id);
title.Text = model.title;
RadEditor1.Content = model.content;
keyword.Text = model.keyword;
}
else
{
OnError(null);
}
}
protected void btnSure_Click(object sender, EventArgs e)
{
var id = Request.Params["Id"];
if (string.IsNullOrEmpty(title.Text.Trim()))
{
RadAjaxManager1.Alert("标题不能为空!");
return;
}
if (bll.GetRecordCount(string.Format(" title = '{0}' and know_id !='{1}'", title.Text.Trim(), id)) > 0)
{
RadAjaxManager1.Alert("标题禁止重复!");
return;
}
if (string.IsNullOrEmpty(keyword.Text.Trim()))
{
RadAjaxManager1.Alert("关键字不能为空!");
return;
}
DataService.Model.pro_know model = bll.GetModel(id);
model.title = title.Text.Trim();
model.keyword = keyword.Text.Trim();
model.content = RadEditor1.Content;
if (bll.Update(model))
{
log.write_log("修改维修知识成功。" + "名称:" + model.title + "ID" + model.know_id);
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
}
else
RadAjaxManager1.Alert("修改失败!");
}
}
}