本文整理汇总了C#中ServerInfo.NullCheck方法的典型用法代码示例。如果您正苦于以下问题:C# ServerInfo.NullCheck方法的具体用法?C# ServerInfo.NullCheck怎么用?C# ServerInfo.NullCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServerInfo
的用法示例。
在下文中一共展示了ServerInfo.NullCheck方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncGroupMembers
public static void SyncGroupMembers(string sourceDN, string destinationPath, ServerInfo serverInfo)
{
serverInfo.NullCheck("serverInfo");
ADHelper helper = ADHelper.GetInstance(serverInfo);
helper.EntryExists(sourceDN).FalseThrow("{0}在域中不存在");
DataRow groupRow = FindGroup(destinationPath);
(groupRow != null).FalseThrow("{0}在机构人员管理系统中不存在", destinationPath);
StringBuilder strB = new StringBuilder(256);
string groupID = groupRow["GUID"].ToString();
strB.AppendFormat("DELETE GROUP_USERS WHERE GROUP_GUID = {0}", TSqlBuilder.Instance.CheckUnicodeQuotationMark(groupID));
int index = 0;
using (DirectoryEntry groupEntry = helper.NewEntry(sourceDN))
{
IEnumerable<DataRow> rows = CollectGroupUserRows(groupEntry);
foreach (DataRow row in rows)
{
strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
InsertSqlClauseBuilder builder = new InsertSqlClauseBuilder();
builder.AppendItem("GROUP_GUID", groupID);
builder.AppendItem("USER_GUID", row["USER_GUID"].ToString());
builder.AppendItem("USER_PARENT_GUID", row["PARENT_GUID"].ToString());
builder.AppendItem("INNER_SORT", string.Format("{0:000000}", index));
builder.AppendItem("CREATE_TIME", "GETDATE()", "=", true);
builder.AppendItem("MODIFY_TIME", "GETDATE()", "=", true);
strB.AppendFormat("INSERT INTO GROUP_USERS{0}", builder.ToSqlString(TSqlBuilder.Instance));
index++;
}
}
using (TransactionScope scope = TransactionScopeFactory.Create())
{
DbHelper.ExecSql(db => db.ExecuteNonQuery(CommandType.Text, strB.ToString()));
scope.Complete();
}
}