本文整理汇总了C#中Role.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Role.ToString方法的具体用法?C# Role.ToString怎么用?C# Role.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveToDB
public void SaveToDB(int matchNo, DateTime matchDay, Location location, Role role, MatchDayShort matchDayShort, char matchType, int round, string row, DrivingInfo drivingInfo, Team homeTeam, Team awayTeam)
{
using (var conn = new MySqlConnection(ConnectionString))
{
conn.Open();
var locationId = GetLocationId(location);
var homeTeamId = GetTeamId(homeTeam);
var awayTeamId = GetTeamId(awayTeam);
var cmd = new MySqlCommand(
"INSERT INTO DbuGrabber_Game " +
"(GameNo, Round, GameDayShort, GameDay, Row, LocationId, HomeTeamId, AwayTeamId, Role, DrivingHours, DrivingMinutes, MatchType) " +
"VALUES " +
"(@GameNo, @Round, @GameDayShort, @GameDay, @Row, @LocationId, @HomeTeamId, @AwayTeamId, @Role, @DrivingHours, @DrivingMinutes, @MatchType)" +
" ON DUPLICATE KEY UPDATE Round = @Round, GameDayShort = @GameDayShort, GameDay = @GameDay, Row = @Row, LocationId = @LocationId, HomeTeamId= @HomeTeamId, AwayTeamId = @AwayTeamId, Role = @Role, DrivingHours = CASE WHEN (DrivingHours <> @DrivingHours) THEN @DrivingHours ELSE DrivingHours END, DrivingMinutes = CASE WHEN (DrivingMinutes <> @DrivingMinutes) THEN @DrivingMinutes ELSE DrivingMinutes END, MatchType= @MatchType, Sent = CASE WHEN (DrivingHours <> @DrivingHours OR DrivingMinutes <> @DrivingMinutes) THEN 0 ELSE Sent END", conn);
cmd.Parameters.AddWithValue("@GameNo", matchNo);
cmd.Parameters.AddWithValue("@Round", round);
cmd.Parameters.AddWithValue("@GameDayShort", matchDayShort.ToString());
cmd.Parameters.AddWithValue("@GameDay", matchDay);
cmd.Parameters.AddWithValue("@Row", row);
cmd.Parameters.AddWithValue("@LocationId", locationId);
cmd.Parameters.AddWithValue("@HomeTeamId", homeTeamId);
cmd.Parameters.AddWithValue("@AwayTeamId", awayTeamId);
cmd.Parameters.AddWithValue("@Role", role.ToString());
cmd.Parameters.AddWithValue("@DrivingHours", drivingInfo.Hours);
cmd.Parameters.AddWithValue("@DrivingMinutes", drivingInfo.Minutes);
cmd.Parameters.AddWithValue("@MatchType", matchType);
cmd.ExecuteNonQuery();
}
}
示例2: Node
public Node(Role source)
: this()
{
if (source == null)
throw new ArgumentNullException("the source si null!!!!");
this.data = source.ToString();
this.attr = new Attr(source.Key.ToString(), Rel.floder);
this.state = State.closed;
}
示例3: CreateListViewRoleItem
private ListViewItem CreateListViewRoleItem(Role item) {
ListViewItem listViewItem = new ListViewItem();
listViewItem.Text = item.ToString();
rolesListView.SmallImageList.Images.Add(item.ItemImage);
listViewItem.ImageIndex = rolesListView.SmallImageList.Images.Count - 1;
listViewItem.Tag = item;
return listViewItem;
}
示例4: IsInRole
public static bool IsInRole(Role role)
{
if (HttpContext.Current.Session["Role"] != null && HttpContext.Current.Session["Role"].ToString() != "")
{
if (HttpContext.Current.Session["Role"].ToString() == role.ToString())
return true;
else
return false;
}
else
return false;
}
示例5: GetUsersByRole
public IEnumerable<User> GetUsersByRole(Role role)
{
using (var connection = new SqlConnection(_connectionString))
{
connection.Open();
var users = new List<User>();
var reader = connection.Select(_tableName, new KeyValuePair<string, object>("Role", role.ToString()));
while (reader.Read())
users.Add(ExtractUser(reader));
reader.Close();
return users;
}
}
示例6: IsInRole
public bool IsInRole(Role role)
{
return Role == role.ToString();
}
示例7: AuthorizeRoleAttribute
public AuthorizeRoleAttribute(Role role)
{
Roles = role.ToString();
}
示例8: CleanupBadRole
protected static void CleanupBadRole(Role.RoleType type)
{
try
{
List<Role> roles = RoleManager.GetRolesOfType(type);
if (roles != null)
{
for (int i = roles.Count - 1; i >= 0; i--)
{
if (roles[i] == null)
{
roles.RemoveAt(i);
}
}
}
}
catch (Exception e)
{
Common.Exception(type.ToString(), e);
}
}
示例9: GetInternalUsers
public static List<InternalUser> GetInternalUsers(Role role)
{
string dsn = ConfigurationManager.ConnectionStrings["RJLouEntities"].ToString();
string sql = @"
SELECT iu.Person_ID,
First_Name,
Last_Name,
Date_Of_Birth,
Gender,
Email,
Race,
Password,
Title
FROM Internal_User iu
INNER JOIN Person p ON iu.Person_ID = p.Person_ID
INNER JOIN User_Type ut ON iu.User_Type_ID = ut.User_Type_ID
WHERE Title LIKE @Title";
List<InternalUser> results = new List<InternalUser>();
using (SqlConnection conn = new SqlConnection(dsn))
{
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("Title", role.ToString());
SqlDataReader read = cmd.ExecuteReader();
while (read.Read())
{
InternalUser newUser = new InternalUser()
{
PersonID = Convert.ToInt32(read["Person_ID"]),
FirstName = read["First_Name"].ToString(),
LastName = read["Last_Name"].ToString(),
DateOfBirth = Convert.ToDateTime(read["Date_Of_Birth"]),
Gender = read["Gender"].ToString(),
Race = read["Race"].ToString(),
Email = read["Email"].ToString(),
Password = read["Password"].ToString()
};
newUser.GetPhoneNumbers();
newUser.GetAddresses();
newUser.GetRole(read["Title"].ToString());
results.Add(newUser);
}
}
return results;
}
示例10: Comingout
/// <summary>
/// Comingout someone's role.
/// </summary>
/// <param name="target"></param>
/// <param name="role"></param>
/// <returns></returns>
public static string Comingout(Agent target, Role role)
{
string[] split = { Topic.COMINGOUT.ToString(), (target != null) ? target.ToString() : "null", role.ToString() };
return WordAttachment(split);
}
示例11: NewUser
public User NewUser(string name, string password, Role role, Nullable<int> customerId)
{
User user = null;
using (OracleConnection connection = new OracleConnection(connectionString))
{
if (connection.State != ConnectionState.Open)
connection.Open();
// insert record to table
if (role != Role.Zakaznik)
customerId = null;
NewUser(connection, name, password, role.ToString(), customerId);
// read record from table
user = GetUser(connection, name);
}
return user;
}
示例12: RoleActionSelectorAttribute
public RoleActionSelectorAttribute(Role role)
{
this.role = role.ToString();
}
示例13: RoleIsInList
private bool RoleIsInList(string[] roleList, Role roleType)
{
foreach (string rolestring in roleList)
{
if (rolestring.Equals(roleType.ToString()))
{
return true;
}
}
return false;
}
示例14: HandleIsUserInRole
/// <summary>
/// @see MembershipExample.Service.MembershipService#IsUserInRole(User user, RoleType role)
/// </summary>
protected bool HandleIsUserInRole(UserVO user, Role role)
{
foreach (string currole in user.Roles)
{
if (currole.Equals(role.ToString()))
{
return true;
}
}
return false;
}
示例15: GetRole
public RoleEntity GetRole(Role roleName)
{
return storage.GetStorageFor<RoleEntity>().Single(r => r.Name == roleName.ToString());
}