using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HySoft.Common;
using System.Text;

namespace XKPCallCenter.Key
{
    public partial class CreateKey : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnCreateKey_Click(object sender, EventArgs e)
        {
            string datetime = monthCalendar.SelectedDate.ToString();
            txtSelectTime.Text = datetime;
            string aes_datetime = DESEncrypt.Encrypt(datetime);
            txtDateTime.Text = aes_datetime;
            string filepath = HttpRuntime.AppDomainAppPath + "hykj.hy";
            MakeFile(filepath, txtDateTime.Text.Trim());
            lblFilePath.Text = filepath;
        }
        public static void MakeFile(string FileName, string Content)
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName, false, Encoding.UTF8);
            try
            {
                sw.Write(Content);
                sw.Flush();
            }
            finally
            {
                if (sw != null) sw.Close();
            }
        }

        protected void monthCalendar_SelectionChanged(object sender, EventArgs e)
        {
            string datetime = monthCalendar.SelectedDate.ToString();
            txtSelectTime.Text = datetime;
        }
    }
}