guestmanager.cs

来自「酒店管理软件,c#版本可以选择不同的模式」· CS 代码 · 共 142 行

CS
142
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Hotel.Guest.Bll
{
    public class GuestManager
    {

        /// <summary>
        /// </summary>
        private ArrayList _myGU;
        /// <summary>
        /// 团队数量统计
        /// </summary>
        public GuestBase Find(string teamId)
        {
            foreach (GuestBase var in _myGU)
            {
                if (var is Team)
                {
                    Team  tm = new Team();
                    tm = (Team)var;
                    if (tm.Name == teamId)
                        return tm;
                }
                else
                {
                    Customer tm = new Customer();
                    tm=(Customer)var;
                    if (tm.Name == teamId)
                        return tm;
                }
            }
            return null;

        }

        public GuestBase Find(int index)
        {
            GuestBase gb = new GuestBase();
            _myGU.IndexOf(gb, index);

            return gb;
        }

        public Int32 GetTeamCount()
        {
            return TeamCount();
        }

        public Int32 GetCustomerCount()
        {
            return CustomerCount();
        }

        public Int32 GetCountPeason()
        {
            return PeasonCount();
        }

        private Int32 CustomerCount()
        {
            Int32 count = 0;
            foreach (GuestBase var in _myGU)
            {
                if (var is Customer)
                {
                    count++;

                }
            }
            return count;
        }

        private Int32 TeamCount()
        {
            Int32 count = 0;
            foreach (GuestBase var in _myGU)
            {
                if (var is Team)
                {
                    count++;

                }
            }
            return count;
        }

        private Int32 PeasonCount()
        {
            Int32 count = 0;
            foreach (GuestBase var in _myGU)
            {
                if (var is Team)
                {
                    Team  tm = new Team();
                    tm = (Team)var;
                    count+=tm.Count;
                    

                }
                else
                {
                    count++;
                }
            }
            return count;
        }
        

        /// <summary>
        /// 所有客人统计
        /// </summary>
        private Int32 _Count;

        public int Count
        {
            get { return _myGU.Count; }
            
        }

        public void Add(GuestBase gu)
        {
            if (_myGU == null)
            {
                _myGU = new ArrayList();
            }
            _myGU.Add(gu);
        }

        public GuestManager()
        {
            //_myGU = new ArrayList();
            //LoadData();
        }


    }
}

⌨️ 快捷键说明

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