using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using TopWinCMS.BLL;
using TopWinCMS.Common;
namespace TopWinCMS.WebUI.Admin.GuestBook
{
    public partial class GuestBook_Setting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RightsCheck.CheckWorkPower("S_2");
                ReadGuestBookConfigXML();
            }
        }

        protected void BT_Save_Click(object sender, EventArgs e)
        {
            string ErrMsg = "";
            try
            {
                WriteGuestBookConfigXML();
            }
            catch (Exception Ex)
            {
                ErrMsg = (Ex.Message.Replace(@"\", @"\\"));
            }
            if (ErrMsg.Length == 0)
            {
                MsgBox.Alert("操作完成！");
            }
            else
            {
                MsgBox.Alert(ErrMsg);
            }
        }

        #region GuestBook
        private void ReadGuestBookConfigXML()
        {
            TB_GuestBookName.Text = GuestBookConfig.GuestBookName;
            TB_GBPageSize.Text = GuestBookConfig.GBPageSize.ToString();
            CB_ShowGB.Checked = GuestBookConfig.ShowGB;
            CB_GBPass.Checked = GuestBookConfig.GBPass;
        }

        private void WriteGuestBookConfigXML()
        {
            GuestBookConfig.GBPageSize = int.Parse(TB_GBPageSize.Text);
            GuestBookConfig.GuestBookName = TB_GuestBookName.Text;
            GuestBookConfig.ShowGB = CB_ShowGB.Checked;
            GuestBookConfig.GBPass = CB_GBPass.Checked;
        }
        #endregion
    }
}
