private void AddNewRec_Click(object sender, EventArgs e)
        {
            #region 添加新的附件信息

            if (extension.Text == "")
            {
                base.RegisterStartupScript("", "<script>alert('要添加的附件扩展名不能为空');window.location.href='forum_attachtypesgrid.aspx';</script>");
                return;
            }

            if ((maxsize.Text == "") || (Convert.ToInt32(maxsize.Text) <= 0))
            {
                base.RegisterStartupScript("", "<script>alert('要添加的附件最大尺寸不能为空且要大于0');window.location.href='forum_attachtypesgrid.aspx';</script>");
                return;
            }


            //if (DbHelper.ExecuteDataset("Select Top 1  * From [" + BaseConfigs.GetTablePrefix + "attachtypes] WHERE [extension]='" + extension.Text + "'").Tables[0].Rows.Count > 0)
            foreach (DataRow dr in Attachments.GetAttachmentType().Rows)
            {
                if (dr["extension"].ToString() == extension.Text)
                {
                    base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的附件扩展名');window.location.href='forum_attachtypesgrid.aspx';</script>");
                    return;
                }
            }

            //if(Discuz.Data.DatabaseProvider.GetInstance().IsExistExtensionInAttachtypes(extension.Text))
            //{
            //    base.RegisterStartupScript( "", "<script>alert('数据库中已存在相同的附件扩展名');window.location.href='forum_attachtypesgrid.aspx';</script>");
            //    return;
            //}

            //string sql = string.Format("INSERT INTO [" + BaseConfigs.GetTablePrefix + "attachtypes] ([extension], [maxsize]) VALUES ('{0}','{1}')",
            //    extension.Text,
            //    maxsize.Text
            //    );
            AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加附件类型", "添加附件类型,扩展名为:" + extension.Text);
            try
            {
                //DataGrid1.Insert(sql);
                Attachments.AddAttchType(extension.Text, maxsize.Text);
                base.RegisterStartupScript("PAGE", "window.location.href='forum_attachtypesgrid.aspx';");
                return;
            }
            catch
            {
                base.RegisterStartupScript("", "<script>alert('无法更新数据库.');window.location.href='forum_attachtypesgrid.aspx';</script>");
                return;
            }

            #endregion
        }