地铁二期项目正式开始

CreateKey.aspx.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using HySoft.Common;
  8. using System.Text;
  9. namespace XKPCallCenter.Key
  10. {
  11. public partial class CreateKey : System.Web.UI.Page
  12. {
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. }
  16. protected void btnCreateKey_Click(object sender, EventArgs e)
  17. {
  18. string datetime = monthCalendar.SelectedDate.ToString();
  19. txtSelectTime.Text = datetime;
  20. string aes_datetime = DESEncrypt.Encrypt(datetime);
  21. txtDateTime.Text = aes_datetime;
  22. string filepath = HttpRuntime.AppDomainAppPath + "hykj.hy";
  23. MakeFile(filepath, txtDateTime.Text.Trim());
  24. lblFilePath.Text = filepath;
  25. }
  26. public static void MakeFile(string FileName, string Content)
  27. {
  28. System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName, false, Encoding.UTF8);
  29. try
  30. {
  31. sw.Write(Content);
  32. sw.Flush();
  33. }
  34. finally
  35. {
  36. if (sw != null) sw.Close();
  37. }
  38. }
  39. protected void monthCalendar_SelectionChanged(object sender, EventArgs e)
  40. {
  41. string datetime = monthCalendar.SelectedDate.ToString();
  42. txtSelectTime.Text = datetime;
  43. }
  44. }
  45. }