예제 #1
0
        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);
        }
예제 #2
0
        public static String GetStringByConsole(String message)
        {
            String data;

            do
            {
                ConsoleMessage.Print(message, 1);
                data = Console.ReadLine();
            } while (data == "");

            return(data);
        }
예제 #3
0
 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);
 }
예제 #4
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();
 }
예제 #5
0
 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));
     }
 }
예제 #6
0
 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();
 }