本文整理汇总了C#中UserType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UserType.ToString方法的具体用法?C# UserType.ToString怎么用?C# UserType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserType
的用法示例。
在下文中一共展示了UserType.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public bool Add(UserType userType, int userId, IEnumerable<EmailConfig> values)
{
ManagerLock.EnterReadLock(); // Read
try {
if (FindUser(userType, userId) != null)
return false;
}
finally{
ManagerLock.ExitReadLock(); // EO Read
}
ManagerLock.EnterWriteLock(); // Write
try {
Configs.Element(userType.ToString()) // Não retorna null porque nunca é apagado e existe sempre
.Add(new XElement("user",
new XAttribute("id", userId), // Coloca atributo
values.Select(c => new XElement("value", (int)c)) // Coloca coleccao de values
));
// Save persistent to file
Configs.Save(FileName);
return true;
}
finally{
ManagerLock.ExitWriteLock(); // EO Write
}
}
示例2: SignIn
private void SignIn( bool isPersistent,string username,UserType type)
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, username), new Claim(ClaimTypes.Role,type.ToString()), new Claim(ClaimTypes.Name,username)}, DefaultAuthenticationTypes.ApplicationCookie, ClaimTypes.Name, ClaimTypes.Role);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent}, identity);
}
示例3: GetPasswordForUser
public string GetPasswordForUser(UserType user)
{
SQLiteResult sqlResult = SQLiteController.Instance.Query(
"SELECT password FROM Users WHERE (username = '" + user.ToString().ToLower() + "')");
if (sqlResult.HasRows)
{
return sqlResult.Rows[0]["password"].ToString();
}
else { return string.Empty; }
}
示例4: PlayerEntity
/// <summary>
/// The user entity constructor
/// </summary>
/// <param name="userType">The type which the user is</param>
/// <param name="userId">The Id of the user in question</param>
public PlayerEntity(UserType userType, int userId)
{
// Set the partition and row keys to match the user type and id
this.PartitionKey = userType.ToString();
this.RowKey = userId.ToString();
// Create the basic values
TreasureChest = new Dictionary<int, DateTime>();
Achievements = new Dictionary<string, DateTime>();
CurrentSearchedTreasure = 1;
CurrentRoute = 1;
}
示例5: LoginOnServer
public CostCentreLoginResponse LoginOnServer(string userName, string password, UserType userType)
{
var config = _configService.Load();
string _url = config.WebServiceUrl + "api/Login/LoginGet?Username={0}&Password={1}&UserType={2}";
string url = string.Format(_url, userName, _otherUtilities.MD5Hash(password), userType.ToString());
_log.Info("Attempting logon on server --> " + url);
Uri uri = new Uri(url, UriKind.Absolute);
WebClient wc = new WebClient();
string response = wc.DownloadString(uri);
CostCentreLoginResponse _response = JsonConvert.DeserializeObject<CostCentreLoginResponse>(response, new IsoDateTimeConverter());
if (_response.ErrorInfo != null && _response.ErrorInfo.Equals("Success"))
{
_log.InfoFormat("Remote login success. Saving CC {0} ", _response.CostCentreId);
config.CostCentreId = _response.CostCentreId;
_configService.Save(config);
}
return _response;
}
示例6: DoSuccessFullLogin
private void DoSuccessFullLogin(AuthenticatedUserDTO authenticatedUser, UserType role, string redirectPath)
{
var defaultCulture = new CultureDTO {Id = Guid.NewGuid(), Name = "English"};
With.Mocks(mockery)
.Expecting(() =>
{
Expect.Call(authenticationService.AuthenticateUser(authenticationRequest)).Return(authenticatedUser);
Expect.Call(formsAuthentication.Encrypt(null)).IgnoreArguments();
Expect.Call(cultureService.GetDefaultCulture()).Return(defaultCulture);
})
.Verify(() => controller.Login(authenticationRequest));
Assert.IsTrue(Context.CurrentUser.Identity.IsAuthenticated);
Assert.IsTrue(Context.CurrentUser.IsInRole(role.ToString()));
Assert.AreEqual(defaultCulture, Context.Session["Culture"]);
Assert.AreEqual(redirectPath, Response.RedirectedTo);
}
示例7: GetMessage
public static string GetMessage(UserType userType, string language)
{
return GetMessage(userType.ToString(), language);
}
示例8: ListDashboardItems
public static List<string> ListDashboardItems(UserType utype)
{
//Put together list of dashboard items based on user type - There must be a minimum of 4 items returned in the list
List<string> DashItems = new List<string>();
DashItems.Add("My Services");
DashItems.Add("Reports");
DashItems.Add("Customers");
DashItems.Add("Recent Activity");
DashItems.Add("Overview");
if (utype == UserType.AccountManager || utype == UserType.AccountOwner || utype == UserType.AccountAdmin)
{
DashItems.Add("Accounting Activity");
DashItems.Add("Employees");
DashItems.Add("Business Overview");
DashItems.Add("Sales Overview");
}
if (utype == UserType.PSIOwner)
{
DashItems.Add("PSI Overview");
}
if (utype.ToString().Contains("PSI"))
{
DashItems.Add("PSI Support Tickets");
DashItems.Add("PSI Support Follow Up");
}
return DashItems;
}
示例9: FindUser
// Helper Methods
private XElement FindUser(UserType userType, int userId)
{
return Configs.Element(userType.ToString())
.Elements("user")
.SingleOrDefault(x => (int)x.Attribute("id") == userId);
}
示例10: GetLogin
public static Login GetLogin(UserType userType, int sectionedGrade)
{
string startupPath = System.IO.Directory.GetCurrentDirectory();
string outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
string xmlfilepath = Path.Combine(outPutDirectory, "Logins.xml");
string xmlfile_path = new Uri(xmlfilepath).LocalPath;
XElement loginXElement = XElement.Load(xmlfile_path).Elements("Login").Where(login => login.Element("UserType").Value == userType.ToString() && login.Element("SectionedGrades").Value.Contains(sectionedGrade.ToString())).FirstOrDefault<XElement>();
return new Login(loginXElement);
}