static void Main()
    {
        //create object of WareHouse
        WareHouse n = new WareHouse();

        //Create object of Menu
        Menu m = new Menu();
        int  Option;

        //do-while loop for menu
        do
        {
            Option = m.Show();
            switch (Option)
            {
            //Add Warehouse
            case 1:
            {
                n.Add();
                //n.SetMangerName();
                break;
            }

            //Display Warehouse Details
            case 2:
            {
                n.Display();
                break;
            }

            //Update Warehouse Details
            case 3:
            {
                n.Update();
                break;
            }

            //Delete Warehouse
            case 4:
            {
                n.Delete();
                break;
            }

            case 5:
            {
                n.Exit();
                break;
            }

            default:
                break;
            }

            System.Console.ReadKey();
        } while (Option != 6);
    }
Esempio n. 2
0
        public static WareHouse AddBox(WareHouse facility)
        {
            Console.WriteLine("Do you want to add the box to a specific location?\n(1): Yes\n(2): No\n");
            bool addToLocation = int.TryParse(Console.ReadLine(), out int input);

            int[] location = new int[2];
            if (addToLocation && input == 1)
            {
                location = GetLocation();
            }
            else if (addToLocation && input < 1 || input > 2)
            {
                Console.WriteLine("Incorrect input");
                return(facility);
            }
            else if (!addToLocation)
            {
                Console.WriteLine("Incorrect input");
                return(facility);
            }

            Console.WriteLine("Choose the shape of the packet: \n(1): Cube\n(2): CubeOid\n(3): Blob\n(4): Sphere");
            bool     menuInput = int.TryParse(Console.ReadLine(), out int shapeInput);
            BoxSpecs box       = new BoxSpecs();

            switch (shapeInput)
            {
            case 1:
            {
                box = BoxCreator("Cube");
                break;
            }

            case 2:
            {
                box = BoxCreator("CubeOid");
                break;
            }

            case 3:
            {
                box = BoxCreator("Blob");
                break;
            }

            case 4:
            {
                box = BoxCreator("Sphere");
                break;
            }

            default:
                Console.WriteLine("Incorrec input");
                return(facility);
            }
            if (box.Weight == 0 || box.XLength == 0)
            {
                Console.WriteLine("Couldnt add box due to error in user input");
            }
            else
            {
                int boxId = facility.Add(box, location[0], location[1]);

                if (boxId == -1)
                {
                    Console.WriteLine("Box could not be added, storage space is full or contains fragile box");
                }
                else
                {
                    Console.WriteLine("Box was added succesfully. Box Id: {0}", boxId);
                }
            }
            Console.ReadKey();
            return(facility);
        }