Пример #1
0
        // editting an entry
        private void Edit(int IDLoc)
        {
            bool      Cancelled = false;
            StockItem Original;

            Console.WriteLine("Here is the info you can edit");
            if (StockList[IDLoc].Item == StockItem.ItemType.Stock)
            {
                Console.WriteLine($"1) Manufacturer: {StockList[IDLoc].Manufacturer}\n2) Part Number: {StockList[IDLoc].ManufacturerID}\n3) Stock: {StockList[IDLoc].Stock}\n4) Location: {StockList[IDLoc].Location}\n5) Box Name: {StockList[IDLoc].BoxName}\n6) to Cancel\n7) to Delete");
                Original = new StockItem(StockList[IDLoc].RosID, StockList[IDLoc].Manufacturer, StockList[IDLoc].ManufacturerID, StockList[IDLoc].Stock, StockList[IDLoc].Location, StockList[IDLoc].BoxName, StockList[IDLoc].Whereis);
                switch (Int_Verify(7))
                {
                case 1:
                    Console.WriteLine("What is the new Manufacturer?");
                    StockList[IDLoc].Manufacturer = Verifier(false);
                    break;

                case 2:
                    Console.WriteLine("What is the new Part Number?");
                    StockList[IDLoc].ManufacturerID = Verifier(false);
                    break;

                case 3:
                    Console.WriteLine("What is the new stock amount?");
                    StockList[IDLoc].Stock = Int32.Parse(Verifier(true));
                    break;

                case 4:
                    Console.WriteLine("What is the new Location?");
                    StockList[IDLoc].Location = Verifier(false);
                    break;

                case 5:
                    Console.WriteLine("What is the new box name?");
                    StockList[IDLoc].BoxName = Verifier(false);
                    break;

                case 6:
                    Cancelled = true;
                    break;

                case 7:
                    Delete(IDLoc);
                    break;
                }
            }
            else
            {
                Console.WriteLine($"1) Supplier: {StockList[IDLoc].Supplier}\n2) Bolt Type: {StockList[IDLoc].Bolt_Type}\n3) Size: {StockList[IDLoc].Size}\n4) Length: {StockList[IDLoc].Length}\n5) Stock: {StockList[IDLoc].Bolt_Amount}\n 6) Location: {StockList[IDLoc].Location} 7) Box Name: {StockList[IDLoc].BoxName} 8) To Cancel \n9) To Delete");
                Original = new StockItem(StockList[IDLoc].RosID, StockList[IDLoc].Supplier, StockList[IDLoc].Size, StockList[IDLoc].Length, StockList[IDLoc].Bolt_Type, StockList[IDLoc].Bolt_Amount, StockList[IDLoc].Location, StockList[IDLoc].BoxName, StockList[IDLoc].Whereis);
                switch (Int_Verify(9))
                {
                case 1:
                    Console.WriteLine("What is the new Supplier?");
                    StockList[IDLoc].Supplier = Verifier(false);
                    break;

                case 2:
                    Console.WriteLine("What is the new Bolt Type?");

                    break;

                case 3:
                    Console.WriteLine("What is the new Size?");
                    StockList[IDLoc].Size = Verifier(false);
                    break;

                case 4:
                    Console.WriteLine("What is the new Length?");
                    StockList[IDLoc].Length = Int32.Parse(Verifier(true));
                    break;

                case 5:
                    Console.WriteLine("What is the new Stock?");
                    //StockList[IDLoc].BoxName = Verifier(false);
                    break;

                case 6:
                    Console.WriteLine("What is the new Location?");
                    StockList[IDLoc].Location = Verifier(false);
                    break;

                case 7:
                    Console.WriteLine("What is the new BoxName?");
                    StockList[IDLoc].BoxName = Verifier(false);
                    break;

                case 8:
                    Cancelled = true;
                    break;

                case 9:
                    Delete(IDLoc);
                    break;
                }
            }
            if (!Cancelled)
            {
                Resave(IDLoc, Original);
            }
        }