| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- 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 knowledgeclassAddandEdit : 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["id"]))
- {
- Initialize(Request.QueryString["id"]);
- }
- }
- }
- #region 信息初始化
- void Initialize(string id)
- {
- T_RepositoryCategory = new BLL.T_RepositoryCategory().GetModel(Convert.ToInt32(id));
- }
- #endregion
- #region 公共属性
- private Model.T_RepositoryCategory T_RepositoryCategory
- {
- get
- {
- Model.T_RepositoryCategory _model = new Model.T_RepositoryCategory();
- if (txtF_CategoryId.Value.Trim() != "")
- {
- _model.F_CategoryId = Convert.ToInt32(txtF_CategoryId.Value.Trim());
- }
- else
- {
- _model.F_CategoryId = 0;
- }
- _model.F_CategoryName = txtF_CategoryName.Text.Trim();
- try
- {
- _model.F_ParentId = Convert.ToInt32(txtF_ParentId.Value.Trim());
- }
- catch
- {
- _model.F_ParentId = 0;
- }
- try
- {
- _model.F_Sort = Convert.ToInt32(txtF_Sort.Text.Trim());
- }
- catch
- {
- _model.F_Sort = 0;
- }
- if (_model.F_CreateOn == null)
- _model.F_CreateOn = DateTime.Now;
- _model.F_DeleteFlag = 0;
- return _model;
- }
- set
- {
- if (value != null)
- {
- this.txtF_CategoryId.Value = value.F_CategoryId.ToString();
- this.txtF_ParentId.Value = value.F_ParentId.ToString();
- this.txtF_CategoryName.Text = value.F_CategoryName;
- this.txtF_Sort.Text = value.F_Sort.ToString();
- }
- }
- }
- #endregion
- #region 保存信息
- private void SaveInfo()
- {
- try
- {
- if (!string.IsNullOrEmpty(Request.QueryString["action"]))
- {
- if (Request.QueryString["action"].Trim() == "Add")
- {
- int bl = new BLL.T_RepositoryCategory().Add(T_RepositoryCategory);
- if (bl > 0)
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('success')</script>");
- }
- else
- {
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>SaveInfo('warn')</script>");
- }
- }
- if (Request.QueryString["action"].Trim() == "Modify")
- {
- bool bl = new BLL.T_RepositoryCategory().Update(T_RepositoryCategory);
- if (bl)
- {
- 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>");
- }
- }
- #endregion
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- SaveInfo();
- }
- }
- }
|