public SSLock(AcSmDatabase ssDb) { this.ssDb = ssDb; if (ssDb.GetLockStatus() == AcSmLockStatus.AcSmLockStatus_UnLocked) { ssDb.LockDb(ssDb); } else { ssDb.GetLockOwnerInfo(out var user, out var machine); throw new Exception($"Подшивка заблокарована {user}, {machine}. Попробуйте позже."); } }
// Helper Methods //////////////////////////////////////////////////////////////////////////////////////// // Used to lock/unlock a sheet set database private bool LockDatabase(ref AcSmDatabase database, bool lockFlag) { bool dbLock = false; // If lockFalg equals True then attempt to lock the database, otherwise // attempt to unlock it. if (lockFlag == true & database.GetLockStatus() == AcSmLockStatus.AcSmLockStatus_UnLocked) { database.LockDb(database); dbLock = true; } else if (lockFlag == false && database.GetLockStatus() == AcSmLockStatus.AcSmLockStatus_Locked_Local) { database.UnlockDb(database, true); dbLock = true; } else { dbLock = false; } return(dbLock); }