public static void Update(LICENSE _version)
        {
            var temp = (from p in Database.LICENSEs
                        where p.DataKey == _version.DataKey
                        select p).Single();

            temp.LicenseKey = _version.LicenseKey;
            Database.SubmitChanges();
        }
 internal static extern E TTLoadEmbeddedFont(out IntPtr phFontReference,
                                             TTLOAD ulFlags,
                                             out EMBED pulPrivStatus,
                                             LICENSE ulPrivs,
                                             out TTLOAD pulStatus,
                                             READEMBEDPROC lpfnReadFromStream,
                                             FileStream lpvReadStream,
                                             [MarshalAs(UnmanagedType.LPWStr)] string szWinFamilyName,
                                             [MarshalAs(UnmanagedType.LPStr)] string szMacFamilyName,
                                             TTLOADINFO pTTLoadInfo);
 private void KiemTraInsertMayTram()
 {
     try
     {
         GlobalSettings.MaDatabase = Base.KiemTraLicense.LayThongTinMaDatabase();
         LICENSE _license = LicenseLogic.Select(GlobalSettings.MaDatabase);
         if (_license == null) //Insert
         {
             LICENSE _insert = new LICENSE();
             _insert.DataKey    = GlobalSettings.MaDatabase;
             _insert.LicenseKey = O2S_Common.EncryptAndDecrypt.MD5EncryptAndDecrypt.Encrypt("", true);
             LicenseLogic.Insert(_insert);
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Error(ex);
     }
 }
 private void HienThiThongTinVeLicense()
 {
     try
     {
         MaDatabase        = Base.KiemTraLicense.LayThongTinMaDatabase();
         txtMaMay.Text     = MaDatabase;
         txtMaMay.ReadOnly = true;
         LICENSE license = LicenseLogic.Select(MaDatabase);
         if (license != null)
         {
             txtKeyKichHoat.Text = license.LicenseKey;
         }
         txtKeyKichHoat.Focus();
         btnLicenseKiemTra.PerformClick();
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
 private void btnLicenseLuu_Click(object sender, EventArgs e)
 {
     try
     {
         LICENSE _license = new LICENSE();
         _license.DataKey    = txtMaMay.Text;
         _license.LicenseKey = txtKeyKichHoat.Text.Trim();
         try
         {
             LicenseLogic.Update(_license);
             O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao("Lưu mã kích hoạt thành công!");
             frmthongbao.Show();
         }
         catch (Exception)
         {
             O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CO_LOI_XAY_RA);
             frmthongbao.Show();
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Warn(ex);
     }
 }
 public static void Insert(LICENSE lh)
 {
     Database.LICENSEs.InsertOnSubmit(lh);
     Database.SubmitChanges();
 }
 internal static extern E TTLoadEmbeddedFont(out IntPtr phFontReference,
     TTLOAD ulFlags,
     out EMBED pulPrivStatus,
     LICENSE ulPrivs,
     out TTLOAD pulStatus,
     READEMBEDPROC lpfnReadFromStream,
     FileStream lpvReadStream,
     [MarshalAs(UnmanagedType.LPWStr)] string szWinFamilyName,
     [MarshalAs(UnmanagedType.LPStr)] string szMacFamilyName,
     TTLOADINFO pTTLoadInfo);