コード例 #1
0
ファイル: BoxFactory.cs プロジェクト: oussabl/Angry-Box
    // Search if these is a BoxDescription has the same parameters and return it,
    // if not, create new one, add it to the list and return it.
    public BoxDescription GetBoxDescription(string backImage, Size size)
    {
        BoxDescription description = null;

        Descriptions.ForEach(x => {
            if (x.BackImage == backImage && x.Size == size)
            {
                description = x;
            }
        });

        if (description == null)
        {
            description = new BoxDescription {
                BackImage = backImage, Size = size
            };
        }

        return(description);
    }
コード例 #2
0
        public string GetMappingString(string fields)
        {
            StringBuilder strBuilder = new StringBuilder();

            if (fields.Contains("SQF"))
            {
                strBuilder.Append(SquareFootage);
            }

            if (fields.Contains("NM"))
            {
                strBuilder.Append(" " + Name);
            }

            if (fields.Contains("BD"))
            {
                if (BedDetails != null && BedDetails.Count > 0)
                {
                    BedDetails.ForEach(b => strBuilder.Append(" " + b.Desc));
                }
            }

            if (fields.Contains("RV"))
            {
                if (RoomViews != null && RoomViews.Count > 0)
                {
                    RoomViews.ForEach(r => strBuilder.Append(" " + r.Value));
                }
            }

            if (fields.Contains("DESC"))
            {
                if (Descriptions != null && Descriptions.Count > 0)
                {
                    Descriptions.ForEach(d => strBuilder.Append(" " + d.Value));
                }
            }

            return(strBuilder.ToString());
        }