本文整理汇总了C#中UserKey类的典型用法代码示例。如果您正苦于以下问题:C# UserKey类的具体用法?C# UserKey怎么用?C# UserKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserKey类属于命名空间,在下文中一共展示了UserKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Two_keys_with_same_value
public void Two_keys_with_same_value()
{
var one = new UserKey("one");
var two = new UserKey("one");
one.ShouldBe(two);
}
示例2: Two_different_keys
public void Two_different_keys()
{
var one = new UserKey("one");
var two = new UserKey("two");
one.ShouldNotBe(two);
}
示例3: GetUserDetails
private async Task GetUserDetails(IOwinContext context)
{
var key = new UserKey(context.GetRouteValue("key"));
var user = _collectionsReadModel.Users.Single(r => r.Key == key);
await context.WriteJson(user, _settings);
}
示例4: GetAccess
/// <summary>
/// Gets a specific access for a user.
/// </summary>
/// <param name="aUserKey">A user key composite.</param>
/// <param name="aFunction">A function.</param>
/// <returns></returns>
public static Access GetAccess(UserKey aUserKey, string aFunction)
{
UserFunctionAccess vUserFunctionAccess = new UserFunctionAccess() { UsrKey = aUserKey.UsrKey };
vUserFunctionAccess.FunctionAccess.Function = aFunction;
Load(vUserFunctionAccess);
return vUserFunctionAccess.FunctionAccess.Access;
}
示例5: UserCreatedEvent
public UserCreatedEvent(Operator @operator, Guid id, UserKey key, string name)
: base(@operator)
{
ID = id;
Key = key;
Name = name;
}
示例6: Two_keys_with_different_values_by_case
public void Two_keys_with_different_values_by_case()
{
var one = new UserKey("one");
var two = new UserKey("ONE");
one.ShouldBe(two);
}
示例7: When_serializing
public void When_serializing()
{
var input = new UserKey("one");
var json = JsonConvert.SerializeObject(input);
var output = JsonConvert.DeserializeObject<UserKey>(json);
output.ShouldBe(input);
}
示例8: GetUser
internal User GetUser(UserKey key, bool manageRole = true)
{
User user = _userModule.Get(key);
if(user != null && manageRole)
CompleteUserRole(user);
return user;
}
示例9: AddUser
/// <summary>
/// The <c>AddUser</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="User"/> object.
/// It invokes the <c>Insert</c> method of <see cref="UserBusiness"/> with the newly deserialized <see cref="User"/> object.
/// Finally, it returns the inserted object (now with an assigned User Key) as a serialized <see cref="string"/> of XML.
/// </summary>
/// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
/// <returns><see cref="User"/> as XML <see cref="string"/>.</returns>
/// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
public static string AddUser(UserKey aUserKey, string aXmlArgument)
{
if (aXmlArgument == null)
{
throw new ArgumentNullException("aXmlArgument of AddUser");
}
User vUser = new User();
vUser = XmlUtils.Deserialize<User>(aXmlArgument);
UserBusiness.Insert(aUserKey, vUser);
return XmlUtils.Serialize<User>(vUser, true);
}
示例10: AddRoleFunction
/// <summary>
/// The <c>AddRoleFunction</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="RoleFunction"/> object.
/// It invokes the <c>Insert</c> method of <see cref="RoleFunctionBusiness"/> with the newly deserialized <see cref="RoleFunction"/> object.
/// Finally, it returns the inserted object (now with an assigned RoleFunction Key) as a serialized <see cref="string"/> of XML.
/// </summary>
/// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
/// <returns><see cref="RoleFunction"/> as XML <see cref="string"/>.</returns>
/// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
public static string AddRoleFunction(UserKey aUserKey, string aXmlArgument)
{
if (aXmlArgument == null)
{
throw new ArgumentNullException("aXmlArgument of AddRoleFunction");
}
RoleFunction vRoleFunction = new RoleFunction();
vRoleFunction = XmlUtils.Deserialize<RoleFunction>(aXmlArgument);
RoleFunctionBusiness.Insert(aUserKey, vRoleFunction);
return XmlUtils.Serialize<RoleFunction>(vRoleFunction, true);
}
示例11: AddDocument
/// <summary>
/// The <c>AddDocument</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Document"/> object.
/// It invokes the <c>Insert</c> method of <see cref="DocumentBusiness"/> with the newly deserialized <see cref="Document"/> object.
/// Finally, it returns the inserted object (now with an assigned Document Key) as a serialized <see cref="string"/> of XML.
/// </summary>
/// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
/// <returns><see cref="Document"/> as XML <see cref="string"/>.</returns>
/// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
public static string AddDocument(UserKey aUserKey, string aXmlArgument)
{
if (aXmlArgument == null)
{
throw new ArgumentNullException("aXmlArgument of AddDocument");
}
Document vDocument = new Document();
vDocument = XmlUtils.Deserialize<Document>(aXmlArgument);
DocumentBusiness.Insert(aUserKey, vDocument);
return XmlUtils.Serialize<Document>(vDocument, true);
}
示例12: AddContributor
/// <summary>
/// The <c>AddContributor</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="Contributor"/> object.
/// It invokes the <c>Insert</c> method of <see cref="ContributorBusiness"/> with the newly deserialized <see cref="Contributor"/> object.
/// Finally, it returns the inserted object (now with an assigned Contributor Key) as a serialized <see cref="string"/> of XML.
/// </summary>
/// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
/// <returns><see cref="Contributor"/> as XML <see cref="string"/>.</returns>
/// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
public static string AddContributor(UserKey aUserKey, string aXmlArgument)
{
if (aXmlArgument == null)
{
throw new ArgumentNullException("aXmlArgument of AddContributor");
}
Contributor vContributor = new Contributor();
vContributor = XmlUtils.Deserialize<Contributor>(aXmlArgument);
ContributorBusiness.Insert(aUserKey, vContributor);
return XmlUtils.Serialize<Contributor>(vContributor, true);
}
示例13: AddContributorLanguage
/// <summary>
/// The <c>AddContributorLanguage</c> implementation method deserializes an incoming XML Argument <see cref="string"/> as a new <see cref="ContributorLanguage"/> object.
/// It invokes the <c>Insert</c> method of <see cref="ContributorLanguageBusiness"/> with the newly deserialized <see cref="ContributorLanguage"/> object.
/// Finally, it returns the inserted object (now with an assigned ContributorLanguage Key) as a serialized <see cref="string"/> of XML.
/// </summary>
/// <param name="aXmlArgument">XML Argument <see cref="string"/>.</param>
/// <returns><see cref="ContributorLanguage"/> as XML <see cref="string"/>.</returns>
/// <exception cref="ArgumentNullException">If <c>aXmlArgument</c> is <c>null</c>.</exception>
public static string AddContributorLanguage(UserKey aUserKey, string aXmlArgument)
{
if (aXmlArgument == null)
{
throw new ArgumentNullException("aXmlArgument of AddContributorLanguage");
}
ContributorLanguage vContributorLanguage = new ContributorLanguage();
vContributorLanguage = XmlUtils.Deserialize<ContributorLanguage>(aXmlArgument);
ContributorLanguageBusiness.Insert(aUserKey, vContributorLanguage);
return XmlUtils.Serialize<ContributorLanguage>(vContributorLanguage, true);
}
示例14: Delete
/// <summary>
/// Delete data in database
/// </summary>
/// <param name="key">Primary Key</param>
public void Delete(UserKey key)
{
if (key == null || string.IsNullOrWhiteSpace(key.Id))
return;
var row = _dbContext.Users.Where(m => m.Id == key.Id).FirstOrDefault();
if (row != null)
{
_dbContext.Users.Remove(row);
_dbContext.SaveChanges();
}
}
示例15: Load
/// <summary>
/// The overloaded Load method that will return a <see cref="LanguageCollection"/>.
/// </summary>
/// <param name="aUserKey">A <see cref="UserKey"/> object.</param>
/// <param name="aLanguageCollection">A <see cref="LanguageCollection"/> object.</param>
/// <exception cref="ArgumentNullException">If <c>aLanguageCollection</c> argument is <c>null</c>.</exception>
public static void Load(UserKey aUserKey, LanguageCollection aLanguageCollection)
{
if (aLanguageCollection == null)
{
throw new ArgumentNullException("Load Language Business");
}
if (!UserFunctionAccessData.HasModeAccess(aUserKey, "Language", AccessMode.List))
{
throw new ZpAccessException("Access Denied", String.Format("{0}", aUserKey.UsrKey), AccessMode.List, "Language");
}
LanguageData.Load(aLanguageCollection);
}