accountmanager.cs

来自「这个版本(InteliIM Open Kernel Release 2)是目前最」· CS 代码 · 共 68 行

CS
68
字号
#region Using Directives

using System;
using System.Collections.Generic;
using System.Text;
using Org.InteliIM.Configurations.Services;

#endregion

namespace Org.InteliIM.Applications.Tourism.ServiceDesk
{
    /// <summary>
    /// Represents the manager for accounts.
    /// </summary>
    public class AccountManager: BasicManager
    {
        /// <summary>
        /// Initializes a new instance of the AccountManager class.
        /// </summary>
        public AccountManager()
        {
        }

        private Collection<AccountInfo> accounts;

        /// <summary>
        /// Gets or sets the accounts collection.
        /// </summary>
        /// <value></value>
        public Collection<AccountInfo> Accounts
        {
            get
            {
                if (this.accounts == null)
                    this.accounts = new Collection<AccountInfo>();

                return this.accounts;
            }
        }
        
        /// <summary>
        /// Gets the specified user's account info is exists.
        /// </summary>
        public AccountInfo this[string userId]
        {
        	get
        	{
        		foreach(AccountInfo info in this.Accounts)
        		{
        			if(info.UserId == userId)
        				return info;
        		}
        		
        		return null;
			}        		
        }
        
        /// <summary>
        /// Determines whether the account info 
        /// for the specified user id exists or not.
        /// </summary>
        public bool Exists(string userId)
        {
        	return (this[userId] != null);
        }
    }
}

⌨️ 快捷键说明

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