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")); } } }
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"); }
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); }
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")); }
public string GetFormattedBasePrice() => BasePrice.ToString("0.00");
public string GetFormattedBasePrice() => BasePrice.ToString("N", CultureInfo.InvariantCulture);
/// <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)); }
public string GetState() { string result = String.Format("{0}*{1}", BasePrice.ToString(), ClosePositionSum.ToString()); return(result); }