Пример #1
0
 /// <summary>
 /// Nieuw Device
 /// </summary>
 /// <param name="databaseConnection"></param>
 /// <param name="model"></param>
 /// <param name="group"></param>
 /// <param name="number"></param>
 /// <param name="name"></param>
 /// <param name="description"></param>
 public Device(Model model, Group group, int number, string name, string description)
     : base(new Vendjuuren.SQL.Table(TableName))
 {
     Model = model;
       Group = group;
       Number = number;
       Name = name;
       DefaultPower = Power.Off;
       Power = Power.Off;
 }
Пример #2
0
        public void AddDemoData()
        {
            Brand kakuBrand = new Brand();
              kakuBrand.GetByName("KlikaanKlikuit");
              if (kakuBrand.ID == Guid.Empty)
              {
            kakuBrand = new Brand(BrandType.Radiographically, "KlikaanKlikuit", "");
            kakuBrand.Save();
              }

              Brand marmitekBrand = new Brand();
              marmitekBrand.GetByName("Marmitek");
              if (marmitekBrand.ID == Guid.Empty)
              {
            marmitekBrand = new Brand(BrandType.X10, "Marmitek", "");
            marmitekBrand.Save();
              }

              Model switchModel = new Model();
              switchModel.GetByBrandAndType(kakuBrand, "Schakelaar");
              if (switchModel.ID == Guid.Empty)
              {
            switchModel = new Model(kakuBrand, "Schakelaar", false, false);
            switchModel.Save();
              }

              Model dimmModel = new Model();
              dimmModel.GetByBrandAndType(kakuBrand, "Dimmer");
              if (dimmModel.ID == Guid.Empty)
              {
            dimmModel = new Model(kakuBrand, "Dimmer", true, false);
            dimmModel.Save();
              }

              Model lwm1Model = new Model();
              lwm1Model.GetByBrandAndType(kakuBrand, "LWM1");
              if (lwm1Model.ID == Guid.Empty)
              {
            lwm1Model = new Model(marmitekBrand, "LWM1", true, true);
            lwm1Model.Save();
              }

              Letter letterC = Letter.C;
              Group groupC = new Group();
              groupC.GetByLetter(letterC);

              if (groupC.ID == Guid.Empty)
              {
            groupC = new Group(letterC, string.Empty);
            groupC.Save();
              }

              Letter letterE = Letter.E;
              Group groupE = new Group();
              groupE.GetByLetter(letterE);

              if (groupE.ID == Guid.Empty)
              {
            groupE = new Group(letterE, string.Empty);
            groupE.Save();
              }

              Device vaasTvDevice = AddDevice(switchModel, groupC, 1, "VaasTV", "Verlichting in vaas bij TV");
              Device kerstDevice = AddDevice(switchModel, groupC, 2, "Kerst", "Kerstboom en overige kerstverlichting");
              Device gangDevice = AddDevice(switchModel, groupC, 4, "Gang", "Gang beneden");
              Device tuinDevice = AddDevice(switchModel, groupC, 5, "Tuin", "Achtertuin");
              Device drankkastDevice = AddDevice(switchModel, groupC, 6, "Drankkast", "Witte leds in drankkast");
              Device openhaardDevice = AddDevice(switchModel, groupC, 7, "Openhaard", "Openhaard in huiskamer");
              Device dressiorDevice = AddDevice(dimmModel, groupC, 8, "Dressoir", "2 Lampjes op dressior");
              Device aircoSlaapkamerDevice = AddDevice(switchModel, groupC, 9, "AircoSlaapkamer", "Airco in de kledingkast slaapkamer");

              Device eettafelDevice = AddDevice(lwm1Model, groupE, 2, "Eettafel", "Lamp boven de eettafel");
              Device fotoHoekDevice = AddDevice(lwm1Model, groupE, 1, "Fotohoek", "Lamp bij de fotohoek");

              Program kerstProgram = AddProgram(ProgramScheduleMode.Time, ProgramScheduleMode.Time, true, "Kerst",
              "Speciaal voor kerstverlichting in de decembermaand",
              Convert.ToDateTime("06-12"), Convert.ToDateTime("06-01"),
              Convert.ToDateTime("18:00"), Convert.ToDateTime("23:30"));
              kerstProgram.AddDevice(kerstDevice);

              Program verlichtingQ1Program = AddProgram(ProgramScheduleMode.Sun, ProgramScheduleMode.Time, true, "VerlichtingQ1",
              "Verlichting huiskamer 1e kwartaal",
              Convert.ToDateTime("01-01"), Convert.ToDateTime("31-03"),
              Convert.ToDateTime("17:00"), Convert.ToDateTime("23:30"));
              verlichtingQ1Program.AddDevice(vaasTvDevice);
              verlichtingQ1Program.AddDevice(tuinDevice);
              verlichtingQ1Program.AddDevice(drankkastDevice);
              verlichtingQ1Program.AddDevice(openhaardDevice);
              verlichtingQ1Program.AddDevice(dressiorDevice);

              Program verlichtingQ2Program = AddProgram(ProgramScheduleMode.Sun, ProgramScheduleMode.Time, true, "VerlichtingQ2",
             "Verlichting huiskamer 2e kwartaal",
             Convert.ToDateTime("01-04"), Convert.ToDateTime("30-06"),
             Convert.ToDateTime("19:00"), Convert.ToDateTime("23:30"));
              verlichtingQ2Program.AddDevice(vaasTvDevice);
              verlichtingQ2Program.AddDevice(tuinDevice);
              verlichtingQ2Program.AddDevice(drankkastDevice);
              verlichtingQ2Program.AddDevice(openhaardDevice);
              verlichtingQ2Program.AddDevice(dressiorDevice);
              verlichtingQ2Program.AddDevice(aircoSlaapkamerDevice);

              Program verlichtingQ3Program = AddProgram(ProgramScheduleMode.Sun, ProgramScheduleMode.Time, true, "VerlichtingQ3",
             "Verlichting huiskamer 3e kwartaal",
             Convert.ToDateTime("01-07"), Convert.ToDateTime("30-09"),
             Convert.ToDateTime("21:00"), Convert.ToDateTime("0:00"));
              verlichtingQ3Program.AddDevice(vaasTvDevice);
              verlichtingQ3Program.AddDevice(tuinDevice);
              verlichtingQ3Program.AddDevice(drankkastDevice);
              verlichtingQ3Program.AddDevice(openhaardDevice);
              verlichtingQ3Program.AddDevice(dressiorDevice);
              verlichtingQ2Program.AddDevice(aircoSlaapkamerDevice);

              Program verlichtingQ4Program = AddProgram(ProgramScheduleMode.Sun, ProgramScheduleMode.Time, true, "VerlichtingQ4",
             "Verlichting huiskamer 4e kwartaal",
             Convert.ToDateTime("01-10"), Convert.ToDateTime("31-12"),
             Convert.ToDateTime("18:00"), Convert.ToDateTime("23:30"));
              verlichtingQ4Program.AddDevice(vaasTvDevice);
              verlichtingQ4Program.AddDevice(tuinDevice);
              verlichtingQ4Program.AddDevice(drankkastDevice);
              verlichtingQ4Program.AddDevice(openhaardDevice);
              verlichtingQ4Program.AddDevice(dressiorDevice);

              Program randomProgramTuin = AddProgram(ProgramScheduleMode.Random, ProgramScheduleMode.Random, false, "RandomTuin",
             "Random verlichting tuin",
             Convert.ToDateTime("01-01"), Convert.ToDateTime("31-12"),
             null, null);
              randomProgramTuin.AddDevice(tuinDevice);

              Program randomProgramHuiskamer = AddProgram(ProgramScheduleMode.Random, ProgramScheduleMode.Random, false, "RandomHuiskamer",
             "Random verlichting huiskamer",
             Convert.ToDateTime("01-01"), Convert.ToDateTime("31-12"),
             null, null);
              randomProgramHuiskamer.AddDevice(drankkastDevice);
              randomProgramHuiskamer.AddDevice(openhaardDevice);
              randomProgramHuiskamer.AddDevice(dressiorDevice);

              Program randomProgramGang = AddProgram(ProgramScheduleMode.Random, ProgramScheduleMode.Random, false, "RandomGang",
             "Random verlichting gang",
             Convert.ToDateTime("01-01"), Convert.ToDateTime("31-12"),
             null, null);
              randomProgramGang.AddDevice(gangDevice);
        }
Пример #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="group"></param>
 /// <param name="number"></param>
 public void GetByLetterNumber(Group group, int number)
 {
     SELECT select = new SELECT(Table);
       select.AddWhere(new Column(GroupIDColumnName), Operator.Equals, group.ID, Vendjuuren.SQL.Boolean.AND);
       select.AddWhere(new Column(NumberColumnName), Operator.Equals, number, Vendjuuren.SQL.Boolean.AND);
       base.GetByStatement(select);
 }
Пример #4
0
        public Device AddDevice(Model model, Group group, int number, string name, string description)
        {
            Device device = new Device();
              device.GetByLetterNumber(group, number);

              if (device.ID == Guid.Empty)
              {
            device = new Device(model, group, number, name, description);
            device.Save();
              }

              return (device);
        }