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

67 lines
2.0 KiB
C#
Raw 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 KnowledgeManage : 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)
{
if (!IsPostBack)
{
Dataload();
}
}
private void Dataload()
{
var typeModel = GetTypeByName("维修知识");
if (typeModel != null)
{
var models = bll.GetModelList(string.Format(" type_id = '{0}' ", typeModel.type_id));
if (models.Any())
{
hideId.Value = models.First().know_id;
RadEditor1.Content = models.First().content;
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
var model = new DataService.Model.pro_know();
if (!string.IsNullOrWhiteSpace(hideId.Value))
{
model = bll.GetModel(hideId.Value);
model.content = RadEditor1.Content;
if(bll.Update(model))
{
log.write_log("更新维修知识成功。" + "ID" + hideId.Value);
}
}
else
{
model.know_id = Guid.NewGuid().ToString();
model.type_id = GetTypeByName("维修知识").type_id;
model.create_time = DateTime.Now;
model.content = RadEditor1.Content;
if(bll.Add(model))
{
log.write_log("添加维修知识成功。" + "ID" + model.know_id);
}
}
}
protected void btnReset_Click(object sender, EventArgs e)
{
Dataload();
}
}
}