roles.cs

来自「Time Tracker Starter Kit 使您能轻松创建这样一个应用程序」· CS 代码 · 共 52 行

CS
52
字号
using System;
using System.Data;
using System.Configuration;
using ASPNET.StarterKit.TimeTracker.DataAccessLayer;

namespace ASPNET.StarterKit.TimeTracker.BusinessLogicLayer
{
	//****************************************************************************
	//
	// Roles Class
	//
	// The Roles class represents a list of custom Time Tracker roles.
	//
	//****************************************************************************

	public class Roles
	{
		private string _name;
		private int _roleID;

		public string Name
		{
			get {return _name;}
			set {_name = value;}
		}

		public int RoleID
		{
			get {return _roleID;}
			set {_roleID = value;}
		}

		public static RolesCollection GetRoles()
		{
			DataSet ds = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings[Web.Global.CfgKeyConnString], "TT_ListAllRoles");
			RolesCollection roleArray = new RolesCollection();

			// Separate Data into a collection of Roles
			foreach(DataRow r in ds.Tables[0].Rows)
			{
				Roles role = new Roles();
				role.RoleID = Convert.ToInt32(r["RoleID"]);
				role.Name = r["Name"].ToString();
				
				roleArray.Add(role);
			}
			return roleArray;
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?