标签:
Role类
public sealed class Role { private string value = null; private Role(string value) { this.value = value; } public string Value { get { return this.value; } } public static Role GetRole(string roleCode) { switch (roleCode) { case "1A": return Applicant; case "1B": return Coworker; case "2A": return Superior; case "3A": return Secretariat; case "4A": return Committee; case "4B": return Observer; case "5A": return Chairperson; case "9A": return SystemAdministrator; default: throw new InvalidOperationException(); } } public override string ToString() { switch (this.value) { case "1A": return "申請者"; case "1B": return "同僚"; case "2A": return "上長"; case "3A": return "事務局"; case "4A": return "委員"; case "4B": return "オブザーバー"; case "5A": return "委員長"; case "9A": return "システム運用管理者"; default: throw new NotImplementedException(); } } public static Role Applicant = new Role("1A"); public static Role Coworker = new Role("1B"); public static Role Superior = new Role("2A"); public static Role Secretariat = new Role("3A"); public static Role Committee = new Role("4A"); public static Role Observer = new Role("4B"); public static Role Chairperson = new Role("5A"); public static Role SystemAdministrator = new Role("9A"); }
调用索引器
/// <summary> /// 委員会ボタン押下 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCommittee_Click(object sender, EventArgs e) { // 委員会メンバーを検索する List<string> roleCode = new List<string>(); roleCode.Add(Role.Committee.Value); roleCode.Add(Role.Chairperson.Value); search(roleCode); }
标签:
原文地址:http://www.cnblogs.com/haiy/p/4155198.html