/// <summary> /// Printing Inventory Items /// </summary> /// <param name="ps"></param> public static void PrintInventoryItems(PawnShop ps) { foreach (var item in ps.InventoryItemList) { Console.WriteLine(item); } }
/// <summary> /// Searching items, if they exist, writing then on the console /// </summary> /// <param name="ps"></param> /// <param name="s"></param> static void PrintSearchResults(PawnShop ps, string s) { List<ISearchable> res = ps.Find(s); foreach (ISearchable r in res) { Console.WriteLine(r); } }
/// <summary> /// Method that takes firstname and lastname from user /// </summary> /// <param name="pawnShop"></object> static void AddCasualEmployee(PawnShop pawnShop) { Console.Clear(); Console.WriteLine("Enter firstname"); string firstName = Console.ReadLine(); Console.WriteLine("Enter lastname"); string lastName = Console.ReadLine(); Console.WriteLine("Enter salary for this worker"); double payCheck = Convert.ToDouble(Console.ReadLine()); pawnShop.AddCasualEmployee(firstName, lastName,payCheck); }
/// <summary> /// Method that take from user name,description,productionYear,price,manufacturer,material and send to method in clas pawnShop /// </summary> /// <param name="pawnShop"></object> static void AddWatch(PawnShop pawnShop) { Console.Clear(); Console.WriteLine("Enter name"); string name = Console.ReadLine(); Console.WriteLine("Enter description"); string description = Console.ReadLine(); Console.WriteLine("Enter year of production"); int productionYear = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter price of watch"); double price = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter manufacturer"); string manufacturer = Console.ReadLine(); Console.WriteLine("Enter material (1 - gold, 2 - rubber, 3 - other)"); string material = Console.ReadLine(); pawnShop.AddWatch(name,description,productionYear,price,manufacturer,material); }
/// <summary> /// Method that take from user name,description,productionYear,price,manufacturer,type,condition and send to method in clas pawnShop /// </summary> /// <param name="pawnShop"></object> static void AddVehicle(PawnShop pawnShop) { Console.Clear(); Console.WriteLine("Enter name"); string name = Console.ReadLine(); Console.WriteLine("Enter description"); string description = Console.ReadLine(); Console.WriteLine("Enter year of production"); int productionYear = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter price of vehicle"); double price = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter manufacturer"); string manufacturer = Console.ReadLine(); Console.WriteLine("Enter type (1 - Sedan, 2 - SUV, 3 - Limousine, 4 - Truck, 5 - Pickup )"); string type = Console.ReadLine(); Console.WriteLine("Enter condition (1 - Mint, 2 - Repaired, 3 - Damaged)"); string condition = Console.ReadLine(); pawnShop.AddVehicle(name,description,productionYear,price,manufacturer,type,condition); }
static void Main(string[] args) { PawnShop ps = new PawnShop(); Cars c1 = new Cars("Car", "Modern. Striking. Sporty. The Audi A1 sets new benchmarks in its class", 50.000, "Audi A1", 2005, "Volkswagen Group UK Ltd", Cars.Condition.preserved); Cars c2 = new Cars("Car", "The BMW M3 is a high-performance version of the BMW 3-Series, developed by BMW's in-house motorsport division, BMW M3", 30.000, "BMW M3", 1985, "BMW M GmbH", Cars.Condition.perfectly); Watch w1 = new Watch("DUO watch","The DUO allows this border to be easily overcome. A dual one-hand watch, it shows both the local time and the time at one additional time zone, using just one hand in each case.", 398.00, "BOTADesign", "2005", Watch.Material.rubber); Watch w2 = new Watch("NOCA Carbon watch", "The watch face of the new NOVA Carbon comprises two main elements: an hour hand and a 12-hour scale. There are no subscales.", 890.00, "BOTADesign", "2014", Watch.Material.silver); Employee e1 = new Employee("Chris", "Smith"); Employee e2 = new Employee("John", "Doe"); ps.AddEmployees(e1); ps.AddInventoryItem(c1); PrintSearchResults(ps, "John"); Console.WriteLine("--------------------------"); PrintInventoryItems(ps); }
/// <summary> /// Method for calling methods for sorting inventory items in class pawnShop /// </summary> /// <param name="pawnShop"></object> static void SortInventoryItems(PawnShop pawnShop) { int option = 0; while (option != 99) { Console.Clear(); Console.BackgroundColor = ConsoleColor.DarkBlue; Console.WriteLine("<<<<<Welcome to pawn shop sort menu>>>>>\n"); Console.ResetColor(); Console.WriteLine("1 : Sort by name"); Console.WriteLine("2 : Sort by price"); Console.WriteLine("99 : Leave sort menu\n"); Console.WriteLine("Enter your choice"); int.TryParse(Console.ReadLine(), out option); switch (option) { case 1: pawnShop.SortbyName(); Console.WriteLine("InventoryItems sorted by name!"); option = 99; break; case 2: pawnShop.SortbyPrice(); Console.WriteLine("InventoryItems sorted by price!"); option = 99; break; case 99: break; default: break; } BackToMainMenuOption(); } }
/// <summary> /// Method for calling method for searching inventoryItems in class pawnShop /// </summary> /// <param name="pawnShop"></object> static void SearchInventoryItem(PawnShop pawnShop) { Console.Clear(); Console.WriteLine("Enter information for searching inventoryItem"); Console.WriteLine(pawnShop.SearchInventoryItem(Console.ReadLine())); BackToMainMenuOption(); }
/// <summary> /// Method for calling method for searching employee in class pawnShop /// </summary> /// <param name="pawnShop"></object> static void SearchEmployee(PawnShop pawnShop) { Console.Clear(); Console.WriteLine("Enter information for searching employee"); Console.WriteLine(pawnShop.SearchEmployee(Console.ReadLine())); BackToMainMenuOption(); }
static void Main(string[] args) { PawnShop pawnShop = new PawnShop(); int option = 0; while (option != 99) { FirstScreen(); Console.WriteLine("Enter your choice"); int.TryParse(Console.ReadLine(), out option); switch (option) { case 1: PrintInventoryItems(pawnShop); break; case 2: PrintEmployees(pawnShop); break; case 3: AddWatch(pawnShop); break; case 4: AddVehicle(pawnShop); break; case 5: AddCasualEmployee(pawnShop); break; case 6: AddExpertEmployee(pawnShop); break; case 7: SortInventoryItems(pawnShop); break; case 8: SortEmployees(pawnShop); break; case 9: SearchInventoryItem(pawnShop); break; case 10: SearchEmployee(pawnShop); break; case 99: Console.WriteLine("Leaving pawn shop"); break; default: break; } } }