public static bool CheckVersionLocks(IVersion pVersion) { bool flag; IEnumLockInfo versionLocks = pVersion.VersionLocks; ILockInfo lockInfo = versionLocks.Next(); StringBuilder stringBuilder = new StringBuilder(); while (lockInfo != null) { stringBuilder.Append(string.Concat("数据库被", lockInfo.UserName, "所锁定!")); lockInfo = versionLocks.Next(); } string str = stringBuilder.ToString(); if (str.Equals("")) { flag = true; } else { MessageBox.Show(str, "检查数据库锁定", MessageBoxButtons.OK, MessageBoxIcon.Hand); flag = false; } return(flag); }
/// <summary> /// 数据版本是否被锁定 /// </summary> /// <param name="pVerison">指定的版本</param> /// <returns>是否被锁定</returns> public static bool IsLocked(IVersion pVerison) { IEnumLockInfo pEnumLockInfo = pVerison.VersionLocks; ILockInfo pLockInfo = pEnumLockInfo.Next(); do { if (pLockInfo != null) { return(true); } }while ((pLockInfo = pEnumLockInfo.Next()) != null); return(false); }
private bool method_11(IVersion iversion_0) { try { IEnumLockInfo versionLocks = iversion_0.VersionLocks; if (versionLocks.Next() != null) { this.txtMessage.Text = "版本 " + iversion_0.VersionName + "被锁定"; ILockInfo info2 = versionLocks.Next(); return(true); } } catch { return(true); } return(false); }
/// <summary> /// Gets the locks. /// </summary> /// <param name="source">The source.</param> /// <returns>Returns a <see cref="IEnumerable{ILockInfo}" /> representing the locks.</returns> public static IEnumerable <ILockInfo> GetVersionLocks(this IVersion source) { IEnumLockInfo enumLockInfo = source.VersionLocks; ILockInfo lockinfo; while ((lockinfo = enumLockInfo.Next()) != null) { yield return(lockinfo); } }