Example #1
0
 protected void OnTransformed(Matrix4x4?transformation)
 {
     Transformed?.Invoke(this, transformation);
 }
        public static void WorkWithUserDataMain()
        {
            lock (locker)
            {
                MainMenu();

                while (true)
                {
                    string      str    = Console.ReadLine();
                    Transformed tr     = new Transformed(Parsing);
                    int         result = tr.Invoke(str);
                    if (result == 0)
                    {
                        "Неправильный выбор меню: выбор меню лежит в дипозоне от 1 до 9".WriteExpr();
                    }
                    else
                    {
                        Console.Clear();
                        if (result < 7)
                        {
                            string name = null;
                            int    day  = 0;
                            bool   stop = true;
                            "Введите название основного  средства".WriteExpr();
                            name = Console.ReadLine();

                            do
                            {
                                "Введите срок эксплуатации в количестве дней".WriteExpr();
                                string str1 = Console.ReadLine();
                                int    res  = tr.Invoke(str1);
                                if (res == 0)
                                {
                                    "Ошибка ввода: срок эксплутации может быть только целочисленным значением".WriteExpr();
                                }
                                else
                                {
                                    day  = res;
                                    stop = false;
                                }
                            }while (stop == true);

                            switch (result)
                            {
                            case 1:
                                ClassLibrary1.Computers Asset1 = new ClassLibrary1.Computers();
                                ClassLibrary1.Computers comp   = Asset1.NewAsset(name, day, ClassLibrary1.LogicOperation.CurrentDate);
                                ClassLibrary1.LogicOperation.AddList(comp);
                                break;

                            case 2:
                                ClassLibrary1.MachineTools Asset2 = new ClassLibrary1.MachineTools();
                                ClassLibrary1.MachineTools mash   = Asset2.NewAsset(name, day, ClassLibrary1.LogicOperation.CurrentDate);
                                ClassLibrary1.LogicOperation.AddList(mash);
                                break;

                            case 3:
                                ClassLibrary1.Furnitures Asset3 = new ClassLibrary1.Furnitures();
                                ClassLibrary1.Furnitures furn   = Asset3.NewAsset(name, day, ClassLibrary1.LogicOperation.CurrentDate);
                                ClassLibrary1.LogicOperation.AddList(furn);
                                break;

                            case 4:
                                ClassLibrary1.Appliances Asset4    = new ClassLibrary1.Appliances();
                                ClassLibrary1.Appliances appliance = Asset4.NewAsset(name, day, ClassLibrary1.LogicOperation.CurrentDate);
                                ClassLibrary1.LogicOperation.AddList(appliance);
                                break;

                            case 5:
                                ClassLibrary1.Autotrucks Asset5 = new ClassLibrary1.Autotrucks();
                                ClassLibrary1.Autotrucks auto   = Asset5.NewAsset(name, day, ClassLibrary1.LogicOperation.CurrentDate);
                                ClassLibrary1.LogicOperation.AddList(auto);
                                break;

                            case 6:
                                ClassLibrary1.Cars Asset6 = new ClassLibrary1.Cars();
                                ClassLibrary1.Cars car    = Asset6.NewAsset(name, day, ClassLibrary1.LogicOperation.CurrentDate);
                                ClassLibrary1.LogicOperation.AddList(car);
                                break;
                            }
                            "Данные по основнму средству записаны. Для продолжения нажмите Enter".WriteExpr();
                            Console.ReadKey();
                            Console.Clear();
                            MainMenu();
                        }
                        else if (result == 7)
                        {
                            Console.Clear();
                            ClassLibrary1.LogicOperation.CountWearout();
                            ClassLibrary1.LogicOperation.ListAssets();
                            "Для продолжения нажмите Enter".WriteExpr();
                            Console.ReadKey();
                            Console.Clear();
                            MainMenu();
                        }
                        else if (result == 8)
                        {
                            Console.Clear();
                            ClassLibrary1.LogicOperation.OrderAsset();
                            "Для продолжения нажмите Enter".WriteExpr();
                            Console.ReadKey();
                            Console.Clear();
                            MainMenu();
                        }
                    }
                }
            }
        }