Example #1
0
        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);
        }
Example #2
0
 /// <summary>
 /// adds watch.inventoryitem to the database
 /// </summary>
 /// <param name="watch"></param>
 public void AddWatch(Watch watch)
 {
     InventoryItem item = watch;
     db.InventoryItems.Add(item);
     db.SaveChanges();
 }
Example #3
0
        /// <summary>
        /// calls pawnshop add method and adds inventoryitem
        /// </summary>
        private static void AddItem()
        {
            Console.Clear();
            Console.WriteLine("press 1 to add item,press 2 to add car, press 3 to add watch");
            int select = 0;
            int.TryParse(Console.ReadLine(), out select);
            switch(select)
            {
                case 1://adds regular InventoryItem
                    Console.Clear();
                    Console.WriteLine("Add Name");
                    string name=Console.ReadLine();
                    Console.WriteLine("Add Description");
                    string description=Console.ReadLine();
                    Console.WriteLine("Add Price");
                    double price=double.Parse(Console.ReadLine());
                    InventoryItem item=new InventoryItem(name,description,price);
                    ps.AddInventoryItem(item);
                    break;
                case 2://adds Car InventoryItem
                    Console.Clear();
                    Console.WriteLine("Add Name");
                    string cName=Console.ReadLine();
                    Console.WriteLine("Add Type");
                    string type = Console.ReadLine();
                    Console.WriteLine("Add Age");
                    int age = int.Parse(Console.ReadLine());
                    Console.WriteLine("Add Manufacturer");
                    string manufacturer = Console.ReadLine();

                    Console.WriteLine("Add Description");
                    string cDescription=Console.ReadLine();
                    Console.WriteLine("Add Price");
                    double cPrice=double.Parse(Console.ReadLine());
                    Console.WriteLine("Add condition(0 for new, 1 to used, 2 for bad)");
                    int condition = int.Parse(Console.ReadLine());
                    Car Citem=new Car(cName,cDescription,cPrice,type,age,manufacturer,(Car.Condition)condition);
                    ps.AddCar(Citem);
                    break;
                case 3://adds Watch InventoryItem
                    Console.Clear();
                    Console.WriteLine("Add Name");
                    string wName=Console.ReadLine();
                    Console.WriteLine("Add Description");
                    string wDescription=Console.ReadLine();
                    Console.WriteLine("Add Price");
                    double wPrice=double.Parse(Console.ReadLine());
                    Console.WriteLine("Add Material(0 for gold,1 for silver 2 for rubber and 3 for other");
                    int material = int.Parse(Console.ReadLine());
                    Watch Witem=new Watch(wName,wDescription,wPrice,(Watch.Material)material);
                    ps.AddWatch(Witem);
                    break;
                default:
                    Console.WriteLine("Wrong input");
                    break;
            }
        }