using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TopWinCMS.BLL;
using TopWinCMS.Common;
namespace TopWinCMS.WebUI.Admin.Task
{
    public partial class Task_Setting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                ReadTaskConfigXML();
        }

        protected void BT_Save_Click(object sender, EventArgs e)
        {
            string ErrMsg = "";
            try
            {
                WriteTaskConfigXML();
            }
            catch (Exception Ex)
            {
                ErrMsg = (Ex.Message.Replace(@"\", @"\\"));
            }
            if (ErrMsg.Length == 0)
            {
                MsgBox.Alert("操作完成！", this.UpdatePanel1);
            }
            else
            {
                MsgBox.Alert(ErrMsg, this.UpdatePanel1);
            }
        }
        #region Task
        private void ReadTaskConfigXML()
        {
            TB_TimerMinutesInterval.Text = SchedulerConfig.TimerMinutesInterval.ToString();

            CB_Enabled.Checked = SchedulerConfig.Enabled;

        }

        private void WriteTaskConfigXML()
        {
            SchedulerConfig.TimerMinutesInterval = int.Parse(TB_TimerMinutesInterval.Text);
            SchedulerConfig.Enabled = CB_Enabled.Checked;

        }
        #endregion
    }
}