public void defineNewArticle() { Console.WriteLine("Enter article name"); string name = Console.ReadLine(); if (name == null || name.Length == 0) { Console.WriteLine("Article name is mandatory"); } Console.WriteLine("Enter article price"); string price = Console.ReadLine(); if (price == null || price.Length == 0) { Console.WriteLine("Article price is mandatory"); } Console.WriteLine("Choose pdv type:"); Console.WriteLine("1 - Croatian PDV"); int pdvType = Int32.Parse(Console.ReadLine()); PDV pdv = null; if (pdvType == CroatianPDV.getInstance().getId()) { pdv = CroatianPDV.getInstance(); } else { Console.WriteLine("PDV type does not exists"); } Console.WriteLine("Enter article type"); Console.WriteLine("1 - Article per item"); Console.WriteLine("2 - Article per kg"); int articleType = Int32.Parse(Console.ReadLine()); if (articleType == 1) { ArticlePerItem articlePerItem = new ArticlePerItem(Util.getGlobalIdCounter(), name, float.Parse(price), pdv); articlePerItem.save(); Console.WriteLine("Article created:"); articlePerItem.print(); } else if (articleType == 2) { ArticlePerKg articlePerKg = new ArticlePerKg(Util.getGlobalIdCounter(), name, float.Parse(price), pdv); articlePerKg.save(); Console.WriteLine("Article created:"); articlePerKg.print(); } else { Console.WriteLine("PDV type does not exists"); } }
private static void initArticles() { ArticlePerKg Tangerines = new ArticlePerKg(1, "Tangerines", 30, 80, 3, 1); ArticlePerKg Honey = new ArticlePerKg(2, "Honey", 100, 220, 2.5, 1); ArticlePerKg Cables = new ArticlePerKg(3, "Cables", 10, 85, 10, 1); List <Article> articles = new List <Article>(); articles.Add(Tangerines); articles.Add(Honey); articles.Add(Cables); Util.saveArticles(articles); }
public void defineNewArticle() { Console.WriteLine("Enter article name"); string name = Console.ReadLine(); if (name == null || name.Length == 0) { Console.WriteLine("Article name is required"); } Console.WriteLine("Enter article retail price"); string retailprice = Console.ReadLine(); if (retailprice == null || retailprice.Length == 0) { Console.WriteLine("Article retail price is required"); } Console.WriteLine("Enter article promoution price"); string promprice = Console.ReadLine(); if (promprice == null || promprice.Length == 0) { Console.WriteLine("Article promoution price is required"); } Console.WriteLine("Enter article promoution quantity"); string promquantity = Console.ReadLine(); if (promquantity == null || promquantity.Length == 0) { Console.WriteLine("Article promoution quantity is required"); } ArticlePerKg articlePerKg = new ArticlePerKg(Util.getGlobalIdCounter(), name, double.Parse(retailprice), double.Parse(promprice), double.Parse(promquantity), 1); articlePerKg.save(); Console.WriteLine("Article created:"); articlePerKg.print(); }
private static void initArticles() { ArticlePerItem auto = new ArticlePerItem(200, "Auto", 1250, CroatianPDV.getInstance()); ArticlePerItem bicikl = new ArticlePerItem(201, "Bicikl", 100, CroatianPDV.getInstance()); ArticlePerItem stol = new ArticlePerItem(202, "Stol", 300, CroatianPDV.getInstance()); ArticlePerItem cvijet = new ArticlePerItem(203, "Cvijet", 30, CroatianPDV.getInstance()); ArticlePerKg limun = new ArticlePerKg(100, "Limun", 10, CroatianPDV.getInstance()); ArticlePerKg lubenica = new ArticlePerKg(101, "Lubenica", 5, CroatianPDV.getInstance()); ArticlePerKg jabuka = new ArticlePerKg(102, "Jabuka", 3, CroatianPDV.getInstance()); List <Article> articles = new List <Article>(); articles.Add(auto); articles.Add(bicikl); articles.Add(stol); articles.Add(cvijet); articles.Add(limun); articles.Add(lubenica); articles.Add(jabuka); Util.saveArticles(articles); }