Esempio n. 1
0
 /// <summary>
 /// Lưu vào hệ thống các key
 /// </summary>
 private void btnConfirmLicense_Click(object sender, EventArgs e)
 {
     try
     {
         lblMsg.Text  = "";
         CheckSuccess = true;
         if (MacAddress == null)
         {
             string strCPUID = "";
             MacAddress = _objLicense.GetServerInformation(out strCPUID);
             CPUID      = strCPUID;
         }
         int licenseTime = BALicenseManager.CheckValidateLicense(txtCodeLicense.Text, txtKeyLicense.Text, DateTime.Now, MacAddress, CPUID);
         if (licenseTime >= 0)
         {
             int result = _objLicense.AuthoriseLicenseKey(txtAPIKey.Text, txtKeyLicense.Text, txtCodeLicense.Text, true, -1);
             if (result != 1)
             {
                 CheckSuccess = false;
             }
             else
             {
                 new MessageBoxBA().Show("Xác thực hệ thống thành công!");
             }
         }
         else
         {
             lblMsg.Text  = "Bản quyền không hợp lệ";
             CheckSuccess = false;
         }
     }
     catch (Exception ex)
     {
         new MessageBoxBA().Show("Lỗi");
         LogError.WriteLogError("btnConfirmLicense_Click:", ex);
         CheckSuccess = true;
     }
 }