Пример #1
0
        public void FillBase()
        {
            foreach (string item in File.ReadLines(Path))
            {
                if (item == "" || item.ToLower() == "deleted")
                {
                }
                else
                {
                    string[] itemAttributes = item.Split(',');

                    StockItem.CheckMiss holder = StockItem.CheckMiss.In_Place;
                    if (itemAttributes[6] == "Checked_out")
                    {
                        holder = StockItem.CheckMiss.Checked_Out;
                    }
                    if (itemAttributes[6] == "Missing")
                    {
                        holder = StockItem.CheckMiss.Missing;
                    }

                    try// passes Stock Item
                    {
                        Int32.Parse(itemAttributes[3]);
                        StockList.Add(new StockItem(Int32.Parse(itemAttributes[0]), itemAttributes[1], itemAttributes[2], Int32.Parse(itemAttributes[3]), itemAttributes[4], itemAttributes[5], holder));
                    }
                    catch//if Caught its a Bolt
                    {
                        string[] Seperate_Bolt_Entities = itemAttributes[2].Split(':');

                        StockItem.BoltType BT = StockItem.BoltType.ButtonHeads;
                        if (Seperate_Bolt_Entities[0] == "SocketHeads")
                        {
                            BT = StockItem.BoltType.SocketHeads;
                        }
                        if (Seperate_Bolt_Entities[0] == "CountersunkHead")
                        {
                            BT = StockItem.BoltType.CountersunkHead;
                        }
                        if (Seperate_Bolt_Entities[0] == "NormalHeads")
                        {
                            BT = StockItem.BoltType.NormalHeads;
                        }

                        StockItem.BoltAmount BA = StockItem.BoltAmount.High;
                        if (itemAttributes[3] == "Low")
                        {
                            BA = StockItem.BoltAmount.Low;
                        }
                        if (itemAttributes[3] == "None")
                        {
                            BA = StockItem.BoltAmount.None;
                        }

                        StockList.Add(new StockItem(Int32.Parse(itemAttributes[0]), itemAttributes[1], Seperate_Bolt_Entities[1], Int32.Parse(Seperate_Bolt_Entities[2]), BT, BA, itemAttributes[4], itemAttributes[5], holder));
                    }
                }
            }
        }
Пример #2
0
        public void NewEntity(int R, string S, string SZ, int L, StockItem.BoltType BT, StockItem.BoltAmount BA, string LOC, string BN, StockItem.CheckMiss C)
        {
            StockItem item = new StockItem(R, S, SZ, L, BT, BA, LOC, BN, C);

            StockList.Add(item);
            string toSave = Environment.NewLine + $"{R},{S},{$"{BT.ToString()}: {SZ}: {L}"},{BA},{LOC},{BN},{C}";

            if (!File.Exists(Path))
            {
                Console.WriteLine("The file cannot be found");
            }
            else
            {
                using (StreamWriter sw = File.AppendText(Path))
                {
                    sw.WriteLine(toSave);
                }
            }
        }
Пример #3
0
        public void Additem_Bolt()
        {
            int nextROS = 0;

            try
            {
                nextROS = StockList.Last().RosID + 1;
            }
            catch
            {
            }

            Console.Write("Please enter an supplier:");
            string Sup = Verifier(false).ToLower();

            Console.Write("Please enter an Size:");
            string Size = Verifier(false).ToLower();

            Console.WriteLine("please enter the Length of the bolt");
            int Length = Int32.Parse(Verifier(true));

            Console.Write("Please enter stock amount: (1) ButtonHeads 2) SocketHeads 3) Countersunk 4) NormalHeads");
            StockItem.BoltType BoltT = StockItem.BoltType.ButtonHeads;
            switch (Int_Verify(3))
            {
            case 1:
                break;

            case 2:
                BoltT = StockItem.BoltType.SocketHeads;
                break;

            case 3:
                BoltT = StockItem.BoltType.CountersunkHead;
                break;

            case 4:
                BoltT = StockItem.BoltType.NormalHeads;
                break;

            default:
                Console.WriteLine("Chose an incorrect number its defaulted to Checked Out");
                break;
            }

            Console.Write("Please enter stock amount: (1) High 2) Low) 3) None");
            StockItem.BoltAmount BoltA = StockItem.BoltAmount.High;
            switch (Int_Verify(3))
            {
            case 1:
                break;

            case 2:
                BoltA = StockItem.BoltAmount.Low;
                break;

            case 3:
                BoltA = StockItem.BoltAmount.None;
                break;

            default:
                Console.WriteLine("Chose an incorrect number its defaulted to Checked Out");
                break;
            }

            Console.Write("Please enter the location:");
            string LOC = Verifier(false).ToLower();

            Console.Write("Please enter the box name:");
            string BN = Verifier(false).ToLower();

            Console.Write("Please enter the State of this item (1) Checked Out 2)In_Place 3) Missing)");
            StockItem.CheckMiss State = StockItem.CheckMiss.Checked_Out;
            switch (Int_Verify(3))
            {
            case 1:
                break;

            case 2:
                State = StockItem.CheckMiss.In_Place;
                break;

            case 3:
                State = StockItem.CheckMiss.Missing;
                break;

            default:
                Console.WriteLine("Chose an incorrect number its defaulted to Checked Out");
                break;
            }

            NewEntity(nextROS, Sup, Size, Length, BoltT, BoltA, LOC, BN, State);
            while (true)
            {
                Console.WriteLine("Would you like to enter another item: Y/N");
                string redo = Verifier(false);
                if (redo.ToUpper() == "Y")
                {
                    Additem_StockItem();
                }
                if (redo.ToUpper() == "N")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Please enter a valid response");
                }
            }
        }