/// <summary>
        /// 添加
        /// </summary>
        protected void Add()
        {
            if (serverBll.Exist(txtServerCode.Text.Trim()))
            {
                MessageBox.Show(this,"该服务器编号已经在数据库中存在!");
            }
            else
            {
                Model.TN_Server server = new Model.TN_Server();

                server.ServerCode = txtServerCode.Text.Trim();
                server.ServerName = txtServerName.Text.Trim();
                server.ServerIP = txtServerIP.Text.Trim();
                server.DBConfig = txtDBConfig.Text.Trim();
                server.IsForbid = chkIsForbid.Checked;
                server.Remark = txtRemark.Text.Trim();

                if (serverBll.Add(server) == 1)
                {
                    #region commit by songhx at zichang on 2009-10-13
                    //MessageBox.Show(this, "添加成功!");
                    #endregion commit by songhx at zichang on 2009-10-13
                    #region add by songhx at zichang on 2009-10-13
                    ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('保存成功!');this.top.currForm.close();", true);
                    #endregion add by songhx at zichang on 2009-10-13
                    ClearText();
                }
                else
                {
                    MessageBox.Show(this, "添加失败!");
                }
            }
        }
        /// <summary>
        /// 由Id获取特定的Model
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>TN_server model</returns>
        public Model.TN_Server GetModel(int id)
        {
            Model.TN_Server server = new Model.TN_Server();

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("select * from TN_Servers where Id = {0}",id.ToString());

            DataSet dst = dal.GetDataSet(sb.ToString());

            if (dst != null)
            {
                server.Id = Convert.ToInt32(dst.Tables[0].Rows[0]["Id"]);
                server.ServerCode = dst.Tables[0].Rows[0]["ServerCode"].ToString();
                server.ServerName = dst.Tables[0].Rows[0]["ServerName"].ToString();
                server.ServerIP = dst.Tables[0].Rows[0]["ServerIP"].ToString();
                server.DBConfig = dst.Tables[0].Rows[0]["DBConfig"].ToString();
                server.IsForbid = Convert.ToBoolean(dst.Tables[0].Rows[0]["IsForbid"]);
                server.Remark = dst.Tables[0].Rows[0]["Remark"].ToString();
            }
            else
            {
                server = null;
            }

            return server;
        }
        /// <summary>
        /// 更新
        /// </summary>
        protected void Update()
        {
            if (serverBll.ExistWithCode(Convert.ToInt32(Request.QueryString["serverId"]), txtServerCode.Text.Trim()))
            {
                MessageBox.Show(this,"该编号已经被其他服务器使用!");
            }
            else
            {
                Model.TN_Server server = new Model.TN_Server();

                server.ServerCode = txtServerCode.Text.Trim();
                server.ServerName = txtServerName.Text.Trim();
                server.ServerIP = txtServerIP.Text.Trim();
                server.DBConfig = txtDBConfig.Text.Trim();
                server.IsForbid = chkIsForbid.Checked;
                server.Remark = txtRemark.Text.Trim();
                server.Id = Convert.ToInt32(Request.QueryString["serverId"]);

                if (serverBll.Update(server) == 1)
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "", "this.top.currForm.close();", true);
                }
                else
                {
                    MessageBox.Show(this, "修改失败!");
                }
            }
        }