public override string ToString() { StringBuilder PrintOrder = new StringBuilder(); PrintOrder.AppendLine("RESUMO DA ORDEM: "); PrintOrder.AppendLine("Data e hora da compra: " + OrderTime.ToString("dd/MM/yyyy HH:mm:ss")); PrintOrder.AppendLine("Status da ordem: " + StatusOrder); PrintOrder.AppendLine("Cliente: " + CustOrder); PrintOrder.AppendLine("Itens da ordem: "); foreach (OrderItem element in ItOrder) { PrintOrder.AppendLine(element.ToString()); } PrintOrder.AppendLine("Valor total: " + TotalOrder().ToString("F2", CultureInfo.InvariantCulture)); return(PrintOrder.ToString()); }
//változott public void Print() { Console.WriteLine("ID: " + ID); Console.WriteLine("Tervezett beérkezés: " + DateIn.ToShortDateString()); Console.WriteLine("Tervezett kivitel: " + DateOut.ToShortDateString()); Console.WriteLine("Megrendelés leadva: " + OrderTime.ToString()); Console.WriteLine("Mennyiség: " + PalletQuantity); if (Comment != "") { Console.WriteLine("Megjegyzés: " + Comment); } if (Cooled) { Console.WriteLine("Hűtött: igen"); } else { Console.WriteLine("Hűtött:nem"); } if (Confirmed) { Console.WriteLine("Jóváhagyott: igen "); } else { Console.WriteLine("Jóváhagyott: nem "); } if (Terminal != 0) { Console.WriteLine("Kocsiszín: " + Terminal); } Console.WriteLine(); if (FirstOccupiedPlace > 0 && LastOccupiedPlace > 0) { if (Cooled) { Console.WriteLine("H" + FirstOccupiedPlace + ":H" + LastOccupiedPlace); } else { Console.WriteLine("S" + FirstOccupiedPlace + ":S" + LastOccupiedPlace); } } Console.WriteLine(); }
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("---------------------------------------------------\n"); stringBuilder.Append($"Order ID: \t{OrderID}\n"); stringBuilder.Append($"Order Time: \t{OrderTime.ToString("yyyy-MM-dd HH:mm:ss")}\n"); stringBuilder.Append($"Customer Name: \t{CustomerName}\n"); stringBuilder.Append($"Address: \t{Address}\n"); stringBuilder.Append("---------------------------------------------------\n"); stringBuilder.Append("Order Details\n"); foreach (OrderItem item in OrderItemList) { stringBuilder.Append("--------------------------\n"); stringBuilder.Append($"{item}\n"); } stringBuilder.Append("--------------------------\n"); stringBuilder.Append($"Total Price: \tCNY¥{TotalPrice}\n"); stringBuilder.Append("---------------------------------------------------"); return(stringBuilder.ToString()); }
public void WriteXml(XmlWriter writer) { writer.WriteStartElement("Order"); writer.WriteElementString("OrderNumber", OrderNumber.ToString()); writer.WriteElementString("Client", Client); writer.WriteElementString("OrderAddress", OrderAddress); writer.WriteElementString("OrderAmount", OrderAmount.ToString()); writer.WriteElementString("OrderTime", OrderTime.ToString("yy-MM-dd")); writer.WriteStartElement("OrderDetails"); foreach (OrderDetail o in OrderDetails) { writer.WriteStartElement("Trade"); writer.WriteElementString("TradeId", o.TradeId.ToString()); writer.WriteElementString("TradeName", o.TradeName); writer.WriteElementString("TradeAmount", o.TradeAmount.ToString()); writer.WriteElementString("TradePrice", o.TradePrice.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndElement(); }