- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using System.Windows.Forms;
- using qminoa.BLL;
- using qminoa.DA;
- using qminoa.Common;
- using qminoa.Common.Data;
- namespace qminoa.Webs.sysSecurity
- {
- public class AddCatalog : qminoa.Webs.PageBase
- {
- protected System.Web.UI.WebControls.Label Label1;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.Label Label4;
- protected System.Web.UI.WebControls.Label Label12;
- protected System.Web.UI.WebControls.ImageButton cmdSaveCon;
- protected System.Web.UI.WebControls.ImageButton cmdSaveExi;
- protected System.Web.UI.WebControls.ImageButton cmdExi;
- protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
- protected System.Web.UI.WebControls.TextBox tabid;
- protected System.Web.UI.WebControls.TextBox indexid;
- protected System.Web.UI.WebControls.TextBox description;
- protected System.Web.UI.WebControls.TextBox name;
- protected System.Web.UI.WebControls.TextBox url;
- protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator1;
- protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator2;
- protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator3;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.Label lblErr;
- private void Page_Load(object sender, System.EventArgs e)
- {
- this.PageBegin("目录管理",true);
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.cmdSaveCon.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveCon_Click);
- this.cmdSaveExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdSaveExi_Click);
- this.cmdExi.Click += new System.Web.UI.ImageClickEventHandler(this.cmdExi_Click);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private bool CreateNewCatalog()
- {
- if(ValidateUtil.isNumeric(tabid.Text.ToString())&&ValidateUtil.isNumeric(indexid.Text.ToString()))
- {
- CatalogData _catalogdata = new CatalogData();
- DataTable catalogTB = _catalogdata.Tables[CatalogData.CATALOG_TABLE_NAME];
- DataRow row = catalogTB.NewRow();
- row[CatalogData.TABID_FIELD] = tabid.Text;
- row[CatalogData.INDEXID_FIELD] = indexid.Text;
- row[CatalogData.NAME_FIELD] = name.Text;
- row[CatalogData.DESCRIPTION_FIELD] = description.Text;
- row[CatalogData.URL_FIELD] = url.Text;
- catalogTB.Rows.Add(row);
- return (new CatalogSystem()).CreateCatalog(_catalogdata);
- }
- else
- {
- JScript.Alert("目录一级代码或目录二级代码必须为数字,请重新填写!");
- return false;
- }
- }
- private void cmdSaveCon_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- if(this.EmpRightCode>=2)
- {
- if(CreateNewCatalog())
- {
- JScript.Alert("添加成功!");
- tabid.Text = String.Empty;
- indexid.Text = String.Empty;
- name.Text = String.Empty;
- description.Text = String.Empty;
- url.Text = String.Empty;
- }
- else
- JScript.Alert("添加失败!");
- }
- else
- {
- JScript.Alert("您没有权限进行此操作!");
- }
- }
- private void cmdSaveExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- if(this.EmpRightCode>=2)
- {
- if(CreateNewCatalog())
- JScript.Alert("添加成功!");
- else
- JScript.Alert("添加失败!");
- }
- else
- JScript.Alert("您没有权限进行此操作!");
- Response.Redirect("RegCatalog.aspx",false);
- }
- private void cmdExi_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- Response.Redirect("RegCatalog.aspx",false);
- }
- }
- }