当前位置: 首页>>代码示例>>C#>>正文


C# Role.ToString方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:woodbase,项目名称:Woodbase.RefereeToolkit,代码行数:29,代码来源:MySqlConnector.cs

示例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;
        }
开发者ID:dalinhuang,项目名称:cy-pdcpms,代码行数:10,代码来源:RoleTree.cs

示例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;
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:10,代码来源:LightweightUserInformationView.cs

示例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;
 }
开发者ID:getfirstblood,项目名称:course-website,代码行数:12,代码来源:UserIdentity.cs

示例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;
     }
 }
开发者ID:tomtung,项目名称:Homework.PatentApplicationSystem,代码行数:13,代码来源:UserService.cs

示例6: IsInRole

 public bool IsInRole(Role role)
 {
     return Role == role.ToString();
 }
开发者ID:ReszkeM,项目名称:VolleyballLeagueManagement,代码行数:4,代码来源:LeaguePrincipal.cs

示例7: AuthorizeRoleAttribute

 public AuthorizeRoleAttribute(Role role)
 {
     Roles = role.ToString();
 }
开发者ID:simplyio,项目名称:snippet-box,代码行数:4,代码来源:AuthorizeRoleAttribute.cs

示例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);
     }
 }
开发者ID:Chain-Reaction,项目名称:NRaas,代码行数:21,代码来源:Register.cs

示例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;
        }
开发者ID:jblackett,项目名称:RJLou,代码行数:53,代码来源:InternalUser.cs

示例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);
 }
开发者ID:AIWolfSharp,项目名称:AIWolfSharp,代码行数:11,代码来源:TemplateTalkFactory.cs

示例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;
 }
开发者ID:bashocz,项目名称:CompanyIS,代码行数:16,代码来源:OracleDataConnection.cs

示例12: RoleActionSelectorAttribute

 public RoleActionSelectorAttribute(Role role)
 {
     this.role = role.ToString();
 }
开发者ID:dzhivtsov,项目名称:GangsterBank,代码行数:4,代码来源:RoleActionSelectorAttribute.cs

示例13: RoleIsInList

		private bool RoleIsInList(string[] roleList, Role roleType)
		{
			foreach (string rolestring in roleList)
			{
				if (rolestring.Equals(roleType.ToString()))
				{
					return true;
				}
			}
			return false;
		}
开发者ID:siwiwit,项目名称:andromda,代码行数:11,代码来源:MembershipService.cs

示例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;
		}
开发者ID:siwiwit,项目名称:andromda,代码行数:14,代码来源:MembershipService.cs

示例15: GetRole

 public RoleEntity GetRole(Role roleName)
 {
     return storage.GetStorageFor<RoleEntity>().Single(r => r.Name == roleName.ToString());
 }
开发者ID:derzelas,项目名称:BusinessTripsRegistration,代码行数:4,代码来源:RoleRepository.cs


注:本文中的Role.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。