コード例 #1
0
        /// <summary>
        /// Get a specific type of silverware
        /// </summary>
        /// <param name="type">a type of silverware</param>
        /// <returns>a silverware</returns>
        public Silverware GetByType(SilverwareType type)
        {
            int id = 0;

            switch (type)
            {
            case SilverwareType.KNIFE:
                id = 1;
                break;

            case SilverwareType.FORK:
                id = 2;
                break;

            case SilverwareType.DESSERTSPOON:
                id = 3;
                break;

            case SilverwareType.TEASPOON:
                id = 4;
                break;
            }

            this.Datas.Clear();
            this.Request = this.MapTable.GetByType(id);
            this.Datas   = this.Bdd.getRows(this.Request, "Silverware");

            Silverware result = this.CreateSilverware(this.Datas.Tables["Silverware"].Rows[0]);

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Build a silverware from datarow
        /// </summary>
        /// <param name="row">Datarow from request</param>
        /// <returns>a silverware</returns>
        private Silverware CreateSilverware(DataRow row)
        {
            Silverware silverware = new Silverware();

            silverware.Id       = int.Parse(row["Id"].ToString());
            silverware.Name     = row["Nom"].ToString();
            silverware.Quantity = int.Parse(row["Quantite"].ToString());
            silverware.Type     = this.DefineTypeSilverware(int.Parse(row["TypeCouvertid"].ToString()));
            return(silverware);
        }
コード例 #3
0
        /// <summary>
        /// Get all the silverwares available
        /// </summary>
        /// <returns></returns>
        public override List <RoomMaterial> GetAll()
        {
            this.Datas.Clear();
            this.Request = this.MapTable.GetAll();
            this.Datas   = this.Bdd.getRows(this.Request, "Silverware");

            List <RoomMaterial> results = new List <RoomMaterial>();

            foreach (DataRow item in this.Datas.Tables["Silverware"].Rows)
            {
                Silverware plate = this.CreateSilverware(item);
                results.Add(plate);
            }

            return(results);
        }