public void AddDevice(string device = "", string name = "", string fabricator = "")
 {
     DatabaseMapping databaseMapping = null;
     switch (device)
     {
         case "clock":
             Clock clock = new Clock(name);
             _deviceContext.Clocks.Add(clock);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 1, Clock = clock };
             break;
         case "microwave":
             MicrowaveFabricatorInfo mi = microwaveFabricatorInfo[fabricator];
             Microwave microwave = new Microwave(name, mi.Volume, mi.Lamp);
             _deviceContext.Microwaves.Add(microwave);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 2, Microwave = microwave };
             break;
         case "oven":
             OvenFabricatorInfo oi = ovenFabricatorInfo[fabricator];
             Oven oven = new Oven(name, oi.Volume, oi.Lamp);
             _deviceContext.Ovens.Add(oven);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 3, Oven = oven };
             break;
         case "fridge":
             FridgeFabricatorInfo fi = fridgeFabricatorInfo[fabricator];
             Fridge fridge = new Fridge(name, fi.Coldstore, fi.Freezer);
             _deviceContext.Fridges.Add(fridge);
             databaseMapping = new DatabaseMapping { DeviceTypeId = 4, Fridge = fridge };
             break;
         default: return;
     }
     _deviceContext.DatabaseMappings.Add(databaseMapping);
     _deviceContext.SaveChanges();
 }
Пример #2
0
        public ComponentList()
        {
            Lamp L = new Lamp();
            Lamp L2 = new Lamp();
            L2.DeviceName = "Лампа";
            Lamp L3 = new Lamp();
            L3.DeviceName = "Лампа";
            L.DeviceName = "Лампа";
            Conditioner C = new Conditioner("Кондиционер", false, 40, 0, 0, EnumSeasons.summer);
            C.DeviceName = "Кондиционер";
            HeatingBoiler H = new HeatingBoiler("Котел",false,100,0,0,EnumSeasons.summer);
            H.DeviceName = "Котел";
            KitchenVentilation K = new KitchenVentilation();
            K.DeviceName = "Кухонная вытяжка";
            CookingSurfase CS = new CookingSurfase("Варочная поверхность", false,new Burner(), new Burner(), new Burner(), new Burner());
            Oven O = new Oven();
            O.DeviceName = "Духовка";

            AllComponents = new Dictionary<int, Device>();
            AllComponents.Add(1, L);
            AllComponents.Add(2, C);
            AllComponents.Add(3, H);
            AllComponents.Add(4, K);
               AllComponents.Add(5, CS);
            AllComponents.Add(6, O);
            AllComponents.Add(7, L2);
            AllComponents.Add(8, L3);
        }
Пример #3
0
 public Stove(string name, bool state, Burner topLeftBurner, Burner topRightBurner, Burner buttomLeftBurner,
     Burner buttomRightBurner, Oven oven)
     : base(name, state)
 {
     this.topLeftBurner = topLeftBurner;
     this.topRightBurner = topRightBurner;
     this.buttomLeftBurner = buttomLeftBurner;
     this.buttomRightBurner = buttomRightBurner;
     this.oven = oven;
 }
Пример #4
0
 public Device AddComponent(string typeDevice)
 {
     int temp = AllComponents.Keys.Max();
     int key=++temp;
     Device d = null;
     switch(typeDevice)
     {
         case"Lamp":
             Lamp l = new Lamp();
             l.DeviceName = "Лампа";
             AllComponents.Add(key, l);
             d = l;
             break;
         case "Conditioner":
             Conditioner c = new Conditioner();
             c.DeviceName = "Кондиционер";
             AllComponents.Add(key,c);
             d = c;
             break;
         case"KitchenVentilation":
             KitchenVentilation k = new KitchenVentilation();
             k.DeviceName = "Кухонная вытяжка";
             AllComponents.Add(key, k);
             d= k;
             break;
         case "Oven":
             Oven o = new Oven();
             o.DeviceName = "Духовка";
             AllComponents.Add(key, o);
             d= o;
             break;
         case "CookingSurface":
             CookingSurfase cs = new CookingSurfase("Варочная поверхность", false, new Burner(), new Burner(), new Burner(), new Burner());
             AllComponents.Add(key,cs );
             d= cs;
             break;
         case "HeatingBoiler":
             HeatingBoiler h = new HeatingBoiler();
             h.DeviceName = "Котел";
             AllComponents.Add(key,h );
              d= h;
              break;
     }
     return d;
 }
Пример #5
0
        public void Handle()
        {
            eq.Add("вытяжка", new KitchenHood("вытяжка", false, EnumeRegimeMinMax.Min));
            eq.Add("котел", new Heating("котел", false, 0, EnumClimatRegime.summer, 0, 40));
            eq.Add("кондиционер", new Split("кондиционер", false, 0, EnumClimatRegime.summer, 0, 40));
            eq.Add("лампа", new Light("лампа", false));
            Oven o1 = new Oven("духовка", false, EnumRegimeOven.regimNul, 0);
            Burner b1 = new Burner("верхняя левая комфорка", false,EnumeRegimeMinMax.Min);
            Burner b2 = new Burner("верхняя правая комфорка", false,EnumeRegimeMinMax.Min);
            Burner b3 = new Burner("нижняя левая комфорка", false, EnumeRegimeMinMax.Min);
            Burner b4 = new Burner("нижняя правая комфорка", false, EnumeRegimeMinMax.Min);
            eq.Add("плита", new Stove("плита", false, b1, b2, b3, b4, o1));

                while(true)
                {
                ShowHeaderMainMenu();
                Console.WriteLine("\n" + "Введите команду" + "\n");
                string command = Console.ReadLine();
                string[] c1 = command.Split(' ');
                ShowMainMenu(c1[0]);
                }
        }
Пример #6
0
 public ElectricStove(Electroring[] rings, Oven ovenn, bool onOff)
     : base(onOff)
 {
     this.rings = rings;
     this.ovenn = ovenn;
 }
Пример #7
0
        private void CreateComponent2(string comp)
        {
            while(true)
            {
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine("введите '1' чтобы создать компонент");
            Console.WriteLine("введите '0' что бы вернуться");
            Console.ForegroundColor = ConsoleColor.DarkCyan;
            char a = Console.ReadKey().KeyChar;
            switch (a)
            {
                case '1':
                    switch (comp)
                    {
                        case "лампа":
                            Light light = new Light();
                            menuConfiguration.CreateaComponent(light);
                            key = light.Name;
                            eq.Add(key, light);
                            Console.Clear();
                            Console.WriteLine("\n Создано устройство:\n" + "\n" + light.ToString());
                            break;
                        case "кондиционер":
                            Split split = new Split();
                            menuConfiguration.CreateaComponent(split);
                            menuConfiguration.MenuForCreateTemperatureControl(split);
                            key = split.Name;
                            eq.Add(key, split);
                            Console.Clear();
                            string onOff;
                            if (split.State)
                            {
                                onOff = "включен";
                            }
                            else
                            {
                                onOff = "выключен";
                            }
                            Console.WriteLine("\n Создано устройство:\n" + "\n" + split.Name +
                                " в состоянии: " + onOff + "\n минимальная температура: " + split.MinTemperatire +
            "\n максимальная темпертура: " + split.MaxTemperature);
                            break;
                        case "котел":
                            Heating heating = new Heating();
                            menuConfiguration.CreateaComponent(heating);
                            menuConfiguration.MenuForCreateTemperatureControl(heating);
                            key = heating.Name;
                            eq.Add(key, heating);
                            Console.Clear();
                            if (heating.State)
                            {
                                onOff = "включен";
                            }
                            else
                            {
                                onOff = "выключен";
                            }
                            Console.WriteLine("\n Создано устройство:\n" + "\n" + heating.Name +
                                " в состоянии: " + onOff + "\n минимальная температура: " + heating.MinTemperatire +
            "\n максимальная темпертура: " + heating.MaxTemperature);
                            break;
                        case "плита":
                            Oven O = new Oven();
                            Burner B1 = new Burner();
                            Burner B2 = new Burner();
                            Burner B3 = new Burner();
                            Burner B4 = new Burner();
                            Stove stove = new Stove("плита", false, B1, B2, B3, B4, O);
                            menuConfiguration.CreateaComponent(stove);
                            key = stove.Name;
                            eq.Add(key, stove);
                            Console.Clear();
                            if (stove.State)
                            {
                                onOff = "включен";
                            }
                            else
                            {
                                onOff = "выключен";
                            }
                            Console.WriteLine("\n Создано устройство:\n" + "\n" + stove.Name + " в состоянии: " + onOff);
                            break;
                        case "вытяжка":
                            KitchenHood kitchenHood = new KitchenHood();
                            menuConfiguration.CreateaComponent(kitchenHood);
                            key = kitchenHood.Name;
                            eq.Add(key, kitchenHood);
                            Console.Clear();
                            if (kitchenHood.State)
                            {
                                onOff = "включен";
                            }
                            else
                            {
                                onOff = "выключен";
                            }
                            Console.WriteLine("\n Создано устройство:\n" + "\n" + kitchenHood.Name +
                                " в состоянии: " + onOff);
                            break;
                        case "вернуться":

                            break;
                     }
                    break;
                case '0':
                    return;
                }
            }
        }
 public void AddOven(string name, string fabricator)
 {
     if (!ovenInfo.ContainsKey(fabricator))
     {
         return;
     }
     OvenInfo oi = ovenInfo[fabricator];
     Oven oven = new Oven(name, oi.Volume, oi.Lamp);
     oven.OperationDone += (sender) =>
     {
         //throw new ApplicationException("Печка отработала!!!");
     };
     AddDevice(oven);
 }