static void Main(string[] args) { int response = 0; do { SellList list = new SellList(); ConsoleMessage.Print(list.ToString(), 3); response = Data.GetIntegerByConsole("Escribe 1 para volver a ejecutar: "); } while (response == 1); }
public static String GetStringByConsole(String message) { String data; do { ConsoleMessage.Print(message, 1); data = Console.ReadLine(); } while (data == ""); return(data); }
public void Fill() { this.Name = Data.GetStringByConsole("Escribe el nombre del producto: "); do { Price = Data.GetDoubleByConsole("Escribe el precio del producto: $"); if (Price <= 0) { ConsoleMessage.Print("Precio no valido!!!", 3); } } while (Price < 0); }
public ProductSellList() { this.product = new Product(); do { this.quantity = Data.GetIntegerByConsole("Escribe la cantidad de este producto: "); if (quantity <= 0) { ConsoleMessage.Print("Cantidad invalida!!!", 3); } } while (this.quantity < 0); CalculateTotal(); }
public static double GetDoubleByConsole(String message) { try { double number; ConsoleMessage.Print(message, 1); number = double.Parse(Console.ReadLine()); return(number); } catch (Exception e) { ConsoleMessage.Print("Entrada invalida", 3); return(GetIntegerByConsole(message)); } }
public SellList() { total = 0; bestSellingProductIndex = 0; averaguePriceProducts = 0; do { this.quantity = Data.GetIntegerByConsole("Cuantos productos conforman la lista? : "); if (this.quantity < 1) { ConsoleMessage.Print("Cantidad Invalida", 3); } } while (this.quantity < 1); list = new ProductSellList[quantity]; Fill(); SetData(); }