本文整理汇总了C#中UserType类的典型用法代码示例。如果您正苦于以下问题:C# UserType类的具体用法?C# UserType怎么用?C# UserType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserType类属于命名空间,在下文中一共展示了UserType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IdentificationPacket
/// <summary>
/// Initializes a new instance of the <see cref="IdentificationPacket"/> class.
/// </summary>
/// <param name="UserNameOrServerName">Name of the user name or server.</param>
/// <param name="VerificationKeyOrMOTD">The verification key or MOTD.</param>
/// <param name="UserType">Type of the user.</param>
/// <remarks></remarks>
public IdentificationPacket(string UserNameOrServerName, string VerificationKeyOrMOTD, UserType UserType)
{
this.ProtocolVersion = 7;
this.UserNameOrServerName = UserNameOrServerName;
this.VerificationKeyOrMOTD = VerificationKeyOrMOTD;
this.UserType = UserType;
}
示例2: GetUser
/// <summary>
/// The get user.
/// </summary>
/// <param name="userType">
/// The user type.
/// </param>
/// <returns>
/// The <see cref="User"/>.
/// </returns>
public static User GetUser(UserType userType)
{
switch (userType)
{
case UserType.Picker:
{
return new Picker();
}
case UserType.Packer:
{
return new Packer();
}
case UserType.Stocker:
{
return new Stocker();
}
case UserType.Manager:
{
return new Manager();
}
case UserType.Customer:
{
return new Customer();
}
default:
{
return null;
}
}
}
示例3: User
/// <summary>
/// Creates a new user
/// </summary>
/// <param name="Name">The name of the user</param>
/// <param name="Username">The user's username</param>
/// <param name="Password">The user's password</param>
/// <param name="Type">The type of the user</param>
public User(string Name, string Username, string Password, UserType Type)
{
this.Name = Name;
this.Password = Password;
this.Username = Username;
this.Type = Type;
}
示例4: Delete
public bool Delete(UserType userType, int userId)
{
ManagerLock.EnterReadLock(); // Read
XElement userElement;
try {
if ((userElement = FindUser(userType, userId)) == null)
return false;
}
finally{
ManagerLock.ExitReadLock(); // EO Read
}
ManagerLock.EnterWriteLock(); // Write
try {
userElement.Remove();
// Save persistent
Configs.Save(FileName);
return true;
}
finally{
ManagerLock.ExitWriteLock(); // EO Write
}
}
示例5: Login
//public Login(string loginName, string userName, string password, UserType userType, int[] sectionedGrades)
//{
// this.loginName = loginName;
// this.userName = userName;
// this.password = password;
// this.userType = userType;
// this.sectionedGrades = sectionedGrades;
//}
public Login(XElement loginElement)
{
loginName = loginElement.Attribute("LoginName").Value;
userName = loginElement.Element("UserName").Value;
password = loginElement.Element("Password").Value;
personName = loginElement.Element("PersonName").Value;
userType = (UserType)Enum.Parse(typeof(UserType), loginElement.Element("UserType").Value);
string[] gradesStringArray = loginElement.Element("SectionedGrades").Value.Split(',');
this.sectionedGrades = new int[gradesStringArray.Length];
for (int i = 0; i < gradesStringArray.Length; i++)
{
sectionedGrades[i] = int.Parse(gradesStringArray[i]);
}
if (loginElement.Descendants("NavigationInfo").Any())
{
XElement navigationInfoElement = loginElement.Element("NavigationInfo");
string subjectName;
foreach (XElement subjectInfoElement in navigationInfoElement.Elements())
{
subjectName = subjectInfoElement.Attribute("SubjectName").Value;
foreach (XElement TaskInfoElement in subjectInfoElement.Elements())
{
TaskInfoList.Add(new TaskInfo(TaskInfoElement, subjectName));
}
}
}
}
示例6: ChangeConnectionUser
public void ChangeConnectionUser(UserType type)
{
Connection.Close();
switch (type)
{
case UserType.STORE_MANAGER:
LoginConnStr = @"server=" + Server + ";userid=Storemanager;password=sm!9876;database=ggsr";
break;
case UserType.DEPT_MANAGER:
LoginConnStr = @"server=" + Server + ";userid=Deptmanager;password=dm!9876;database=ggsr";
break;
case UserType.TEAM_MEMBER:
LoginConnStr = @"server=" + Server + ";userid=Teammember;password=tm!9876;database=ggsr";
break;
}
try
{
Connection = new MySqlConnection(LoginConnStr);
Connection.Open();
}
catch (MySqlException ex)
{
MessageBox.Show("Error: " + ex.ToString());
Connection.Close();
}
}
示例7: Authorize
/// <summary>
/// Method that checks if the user is authenticated and authorized to execute the method based on the authorization token.
/// If authorization is optional and the user is not yet authenticated, a new account is created for the user.
/// </summary>
/// <param name="allowedUserTypes">Array of authorized UserTypes.</param>
public void Authorize(UserType[] allowedUserTypes)
{
// Get user info using the AuthorizationToken HTTP header
OpenIDUserInfo userInfo = this.userManager.GetOpenIDUserInfo();
// Only continue if user info was successfully retrieved from the Access token issuer
if (userInfo != null)
{
// Try to match a user using the user info retrieved from the Access Token issuer
User matchedUser = this.userManager.MatchUser(userInfo);
// Set the property that indicates if the user is authenticated
this.IsAuthenticated = (matchedUser != null);
// Check if the user is authenticated
if (this.IsAuthenticated)
{
// The user is authenticated, set the property that indicates if the user is authorized to execute the method
this.IsAuthorized = (allowedUserTypes.Count() == 0 || allowedUserTypes.Contains(matchedUser.Type));
}
else
{
// The user is not authenticated - check if authorization is optional or if a customer is authorized to execute the method
if (allowedUserTypes.Count() == 0 || allowedUserTypes.Contains(UserType.Customer))
{
// Authorization is optional or a customer is authorized to execute the method, create a new user using the user info retrieved from the Access Token issuer
this.userManager.CreateUser(userInfo);
// Set the properties that indicate that the user is authenticated and authorized to execute the method
this.IsAuthenticated = true;
this.IsAuthorized = true;
}
}
}
}
示例8: User
public User( string username, string password, UserType accesstype)
{
//no id, for insertion of new users
this.UserName = username;
this.UserPassword = password;
this.AccessType = accesstype;
}
示例9: UserToken
public UserToken(string guid, DateTime lastAccessed, UserType userType, int? id)
{
GUID = guid;
LastAccessed = lastAccessed;
Type = userType;
ID = id;
}
示例10: SelectOption
public void SelectOption (int option)
{
label.text = labels[option];
ToggleOptions ();
CurrentType = (UserType) option;
ToogleOption ();
}
示例11: CreateNewUserDashboard
public static void CreateNewUserDashboard(int uid, UserType utype)
{
//Adds 4 entries to dashboardsettings table to give user default dash items 1 item for customers
LINQ_UsersDataContext dc = new LINQ_UsersDataContext();
List<string> DefaultDashItems = ListDashboardItems(utype);
if (utype == UserType.AccountCustomer)
{
DashBoardSetting ds = new DashBoardSetting();
ds.DashBoardNumber = 1;
ds.DashBoardItem = DefaultDashItems[2];
ds.UserId = uid;
dc.DashBoardSettings.InsertOnSubmit(ds);
}
else
{
for (int i = 1; i <= 4; i++)
{
DashBoardSetting ds = new DashBoardSetting();
ds.DashBoardNumber = i;
ds.DashBoardItem = DefaultDashItems[i];
ds.UserId = uid;
dc.DashBoardSettings.InsertOnSubmit(ds);
}
}
try
{
dc.SubmitChanges();
}
catch (Exception ex)
{
Database.WriteException("Error inserting new DashBoardSettings items", uid, "Users.CreateNewUserDashboard", ex);
}
}
示例12: ValidateDealer
public static void ValidateDealer(UserType userType)
{
if (userType != UserType.Dealer)
{
throw new ServerErrorException("User is not a dealer!");
}
}
示例13: ValidateAdmin
public static void ValidateAdmin(UserType userType)
{
if (userType != UserType.Administrator)
{
throw new ServerErrorException("User is not an administrator!");
}
}
示例14: User
public User(string username, string password, string email, UserType type)
{
Username = username;
Password = password;
Email = email;
Type = type;
}
示例15: RegisterUser
public RollingRides.WebApp.Components.Datalayer.Models.User RegisterUser(string username, string password, string email, string phoneNumber,
string firstName, string lastName,
string street1, string street2,
string city, string state, string zipcode,
UserType type, string companyName)
{
var user = new Components.Datalayer.Models.User();
user.AccountType =(int) type;
user.Username = username;
user.City = city;
user.DateJoined = DateTime.Now;
user.Email = email;
user.CompanyName = companyName;
user.Expires = null;
user.FirstName = firstName;
user.LastName = lastName;
//user.Id = -1;
user.State = state;
user.Street1 = street1;
user.Street2 = street2;
user.ZipCode = zipcode;
user.PhoneNumber = phoneNumber;
user.Password = password;
return _userRepository.AddUpdate (user);
}