示例#1
0
        //TODO: public bool RushShipping { get; set; }

        //used as the short description
        public string GetDescription(bool longDescription = false)
        {
            var baseName = $"({Quantity}x) {CleanedItemName}";
            var Options  = new List <string>();

            if (!string.IsNullOrEmpty(Color))
            {
                Options.Add("Color: " + Color);
            }
            if (SizeInInches != 0)
            {
                Options.Add("Size: " + SizeInInches.ToString() + " in");
            }
            if (!string.IsNullOrEmpty(SKU))
            {
                // Options.Add("SKU: " + SKU.ToString());
            }
            if (!string.IsNullOrEmpty(Personalization))
            {
                var personalizationLabel = longDescription ? "Personalization" : "P";
                if (!longDescription && Personalization.Length > 30)
                {
                    Options.Add($"{personalizationLabel}: " + Personalization.Substring(0, 30) + "");
                }
                else
                {
                    Options.Add($"{personalizationLabel}: " + PersonalizationWithSize + "");
                }
            }
            foreach (var item in CustomFields)
            {
                Options.Add($"{item.Key}: " + item.Value + "");
            }

            if (Options.Count > 0)
            {
                if (longDescription)
                {
                    baseName += "\r\n   " + string.Join("\r\n   ", Options.ToArray());
                }
                else
                {
                    baseName += " (" + string.Join(", ", Options.ToArray()) + ")";
                }
            }

            return(baseName);
        }