コード例 #1
0
 public string DisplayPrice(bool includeAdjustments)
 {
     if (OverrideText.Length > 0)
     {
         return(OverrideText);
     }
     else
     {
         if (includeAdjustments)
         {
             decimal pricewith = PriceWithAdjustments();
             if (pricewith < this.BasePrice)
             {
                 return("<strike>" + this.BasePrice.ToString("C") + "</strike> " + pricewith.ToString("C"));
             }
             else
             {
                 return(pricewith.ToString("C"));
             }
         }
         else
         {
             return(BasePrice.ToString("C"));
         }
     }
 }
コード例 #2
0
 public void PrintSummary()
 {
     Console.WriteLine("\n   The details for this " + Name + " are:\r\n");
     Console.WriteLine("\tSIZE: " + Size + "\t\t" + BasePrice.ToString("C") + "\r");
     Console.WriteLine("\t\t" + NumberOfSugars + " sugars\t" + (_priceList.SugarPrice * NumberOfSugars).ToString("C") + "\r");
     Console.WriteLine("\t\t" + NumberOfCreams + " creams\t" + (_priceList.CreamPrice * NumberOfCreams).ToString("C") + "\r");
     Console.WriteLine("\t---------------------------------\r");
     Console.WriteLine("\tTOTAL" + "\t\t\t" + TotalPrice.ToString("C") + "\r");
 }
コード例 #3
0
    public void WriteXml(XmlWriter writer)
    {
        // If we reach this point through inventories we definitely have a tile
        // If we don't have a tile, that means we're writing a character's inventory
        if (Tile != null)
        {
            writer.WriteAttributeString("X", Tile.X.ToString());
            writer.WriteAttributeString("Y", Tile.Y.ToString());
            writer.WriteAttributeString("Z", Tile.Z.ToString());
        }

        writer.WriteAttributeString("objectType", ObjectType);
        writer.WriteAttributeString("maxStackSize", MaxStackSize.ToString());
        writer.WriteAttributeString("stackSize", StackSize.ToString());
        writer.WriteAttributeString("basePrice", BasePrice.ToString());
        writer.WriteAttributeString("category", Category);
    }
コード例 #4
0
 public string DisplayPrice(bool includeAdjustments, bool noFormatting)
 {
     if (OverrideText.Length > 0)
     {
         return(OverrideText);
     }
     if (includeAdjustments)
     {
         var pricewith = PriceWithAdjustments();
         if (pricewith < BasePrice)
         {
             return(noFormatting
                 ? pricewith.ToString("F")
                 : string.Format("<strike>{0}</strike> {1}", BasePrice.ToString("C"), pricewith.ToString("C")));
         }
         return(noFormatting ? pricewith.ToString("F") : pricewith.ToString("C"));
     }
     return(noFormatting ? BasePrice.ToString("F") : BasePrice.ToString("C"));
 }
コード例 #5
0
 public string GetFormattedBasePrice() => BasePrice.ToString("0.00");
コード例 #6
0
ファイル: PizzaSpecial.cs プロジェクト: kacey90/DialAPizza
 public string GetFormattedBasePrice() => BasePrice.ToString("N", CultureInfo.InvariantCulture);
コード例 #7
0
ファイル: Articles.cs プロジェクト: mol1987/grp4db
        /// <summary>
        /// Print out values with $n for padding distance
        /// </summary>
        /// <param name="n"></param>
        public void Print(int n = 16)
        {
            string ingredients = "";

            Ingredients.ForEach(a => ingredients += a.Name + ", ");
            ingredients = new Regex(", $").Replace(ingredients, "");
            Console.Write("{0}{1}{2}{3}{4}\n", ID.ToString().PadRight(n), Name.PadRight(n), BasePrice.ToString().PadRight(n), Type.PadRight(n), ingredients.PadLeft(n));
        }
コード例 #8
0
        public string GetState()
        {
            string result = String.Format("{0}*{1}", BasePrice.ToString(), ClosePositionSum.ToString());

            return(result);
        }