| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace HySoft.BaseCallCenter.Web.knowledgemanage
- {
- public partial class knowledgelistAddandEdit : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Response.Expires = -1;
- if (!IsPostBack)
- {
- if (!string.IsNullOrEmpty(Request.QueryString["categoryId"]))
- {
- txtF_ParentId.Value = Request.QueryString["categoryId"].Trim();
- }
- if (!string.IsNullOrEmpty(Request.QueryString["singleFlage"]))
- {
- Initialize(Request.QueryString["singleFlage"]);
- }
- }
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- SaveInfo();
- }
- private void SaveInfo()
- {
- try
- {
- if (!string.IsNullOrWhiteSpace(Request.QueryString["actionFlag"].Trim())) {
- string actionFlag = Request.QueryString["actionFlag"].Trim();
- if (actionFlag == "add")
- {
- int bl = new BLL.T_RepositoryInformation().Add(T_RepositoryInformation);
- if (bl > 0)
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
- }
- else
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
- }
- }
- if (actionFlag == "edit")
- {
- bool b2 = new BLL.T_RepositoryInformation().Update(T_RepositoryInformation);
- if (b2)
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
- }
- else
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
- }
- }
- }
- }
- catch
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('error')</script>");
- }
- }
- #region 信息初始化
- private void Initialize(string id)
- {
- T_RepositoryInformation = new BLL.T_RepositoryInformation().GetModel(Convert.ToInt32(id));
- }
- #endregion
- #region 公共属性
- private Model.T_RepositoryInformation T_RepositoryInformation
- {
- get
- {
- Model.T_RepositoryInformation _model = new Model.T_RepositoryInformation();
- try
- {
- _model.F_CategoryId = Convert.ToInt32(txtF_ParentId.Value.Trim());
- }
- catch
- {
- _model.F_CategoryId = 0;
- }
- if (!string.IsNullOrEmpty(txtF_RepositoryId.Value))
- _model.F_RepositoryId = Convert.ToInt32(txtF_RepositoryId.Value);
- _model.F_Title = txtTitle.Text.Trim();
- _model.F_KeyWords = txtKeyWords.Text.Trim();
- _model.F_Description = Common.StringUtil.ClearHtmlCode(txtContent.InnerText.TrimEnd());
- _model.F_Content = txtContent.InnerHtml.TrimEnd();
- _model.F_DeleteFlag = 0;
- if (_model.F_CreateOn == null)
- _model.F_CreateOn = DateTime.Now;
- _model.F_ModifyOn = DateTime.Now;
- return _model;
- }
- set
- {
- if (value != null)
- {
- this.txtF_CategoryId.Value = value.F_CategoryId.ToString();
- this.txtF_RepositoryId.Value = value.F_RepositoryId.ToString();
- txtTitle.Text = value.F_Title;
- txtKeyWords.Text = value.F_KeyWords;
- txtF_Description.Text = value.F_Description;
- txtContent.InnerHtml = value.F_Content;
- }
- }
- }
- #endregion
- }
- }
|