public Registration(DataPersistance dp, string EngineName) { this.dp = dp; this.EngineName = EngineName; Vars = dp.GetVariables("License"); _AppName = dp.GetVariable <string>("System", "AppName", string.Empty); UserName = Vars.GetVariable <string>("UserName", string.Empty); CompanyName = Vars.GetVariable <string>("CompanyName", string.Empty); Limitation = Vars.GetVariable <int>("Limitation", 0); MonthLimitation = Vars.GetVariable <int>( "MonthLimitation", 6); _RegistrationNo = HardwareIdentification.Pack( HardwareIdentification.Value() + _AppName); ActivationCode = Vars.GetVariable <string>( EngineName + _RegistrationNo, string.Empty); if (Limitation < 0 || Limitation > 2) { Limitation = 0; } IsOldValidReg = IsValidActivationCode() && Limitation != 0; }
//Backup private void simpleButton4_Click(object sender, EventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); string LastBackupFolder = CurrDp.GetVariable <string>("System", "LastBackupFolder", string.Empty); fbd.SelectedPath = LastBackupFolder; fbd.Description = "Pilih Folder yang digunakan untuk membackup Database :"; if (fbd.ShowDialog() != DialogResult.OK) { return; } CurrDp.SetVariable("System", "LastBackupFolder", fbd.SelectedPath); Type EngineType = BaseFramework.DpEngine.DictEngine[comboBoxEdit1.Text]; if (EngineType.Equals(typeof(SqlServerPersistance))) { string FileName = string.Concat(fbd.SelectedPath, "\\", ((SqlServerPersistance)CurrDp).DatabaseName, "_", DateTime.Today.ToString("yyyy_MM_dd"), ".bak"); if (File.Exists(FileName)) { XtraMessageBox.Show(string.Concat( "File Tujuan Backup '", FileName, "' sudah ada. Hapus File tersebut untuk melanjutkan !"), "Error Backup Database", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { using (new FormWaitCursor()) { CurrDp.ExecuteNonQuery(string.Concat( "BACKUP DATABASE [", ((SqlServerPersistance)CurrDp).DatabaseName, "] TO DISK = '", FileName, "'")); } XtraMessageBox.Show(string.Concat( "Backup Database ", ((SqlServerPersistance)CurrDp).DatabaseName, " telah sukses dilakukan di File '", FileName, "' !"), "Konfirmasi Backup Database", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error Backup Database", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { XtraMessageBox.Show("Backup untuk database " + comboBoxEdit1.Text + "belum didukung !", "Konfirmasi Backup Database", MessageBoxButtons.OK, MessageBoxIcon.Information); } }