InviteOfflineFrom.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using DevExpress.XtraEditors;
  11. using System.Security.Cryptography;
  12. using System.IO;
  13. namespace Uninpho.Tools.components.SomethingSetting
  14. {
  15. public partial class InviteOfflineFrom : DevExpress.XtraEditors.XtraForm
  16. {
  17. public InviteOfflineFrom()
  18. {
  19. InitializeComponent();
  20. }
  21. private void simpleButton1_Click(object sender, EventArgs e)
  22. {
  23. double n = 0;
  24. try
  25. {
  26. if (JHFXJCCcomboBoxEdit.Text == "期限授权")
  27. {
  28. n = Convert.ToDouble(dateText.Text.Trim());
  29. }
  30. }
  31. catch
  32. {
  33. XtraMessageBox.Show("请填写正确的授权期限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  34. return;
  35. }
  36. if (PubKey.Text == null)
  37. {
  38. XtraMessageBox.Show("请填写授权机器识别码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  39. return;
  40. }
  41. DateTime nowdtime = DateTime.Now.AddDays(Convert.ToDouble(dateText.Text));
  42. string datestr = JHFXJCCcomboBoxEdit.Text == "期限授权" ? nowdtime.ToString() : "forever";
  43. richTextBox1.Text = sqClass.Encrypt(PubKey.Text+ "灬" + datestr, UserInform.sqkey);
  44. }
  45. private void InviteOfflineFrom_Load(object sender, EventArgs e)
  46. {
  47. }
  48. private void JHFXJCCcomboBoxEdit_SelectedValueChanged(object sender, EventArgs e)
  49. {
  50. dateText.Visible = JHFXJCCcomboBoxEdit.Text == "期限授权"?true:false;
  51. }
  52. }
  53. }