Exemplo n.º 1
0
        public void delete(int id)
        {
            ecomanagementContext = new EcoManagementEntities();
            Workstation workstation = (from w in ecomanagementContext.Workstations
                                       where w.ID == id
                                       select w).First();

            workstation.IsActive = false;
            ecomanagementContext.SaveChanges();
        }
Exemplo n.º 2
0
        public void addWhitelist(int whitelistID, int workstationID)
        {
            ecomanagementContext = new EcoManagementEntities();
            Workstation workstation = (from w in ecomanagementContext.Workstations
                                       where w.ID == workstationID
                                       select w).First();

            workstation.WhitelistID = whitelistID;
            ecomanagementContext.SaveChanges();
        }
Exemplo n.º 3
0
        public void add(string reason, DateTime start, DateTime end, int createdBy, int workstationID)
        {
            ecomanagementContext = new EcoManagementEntities();
            var whitelist = CreateWhitelist(0, start, end, reason, createdBy, true);

            ecomanagementContext.Whitelists.AddObject(whitelist);
            ecomanagementContext.SaveChanges();

            Workstation workstation = new Workstation();

            workstation.addWhitelist(whitelist.ID, workstationID);
        }
Exemplo n.º 4
0
        public void edit(int id, string name, string MACAddress, int classroomID, int admin, int OSID)
        {
            ecomanagementContext = new EcoManagementEntities();
            Workstation workstation = new Workstation();


            workstation.ID          = id;
            workstation.Name        = name;
            workstation.MAC_Address = MACAddress;
            workstation.ClassroomID = classroomID;
            workstation.Admin       = 0;
            workstation.IsActive    = true;
            workstation.WhitelistID = null;
            workstation.OSID        = OSID;

            ecomanagementContext.Workstations.AddObject(workstation);
            ecomanagementContext.ObjectStateManager.ChangeObjectState(workstation, System.Data.EntityState.Modified);
            ecomanagementContext.SaveChanges();
        }
Exemplo n.º 5
0
        public void edit(int id, string reason, DateTime start, DateTime end, int createdBy, int workstationID)
        {
            ecomanagementContext = new EcoManagementEntities();
            Whitelist whitelist = new Whitelist();

            whitelist.ID        = id;
            whitelist.Reason    = reason;
            whitelist.Start     = start;
            whitelist.End       = end;
            whitelist.CreatedBy = createdBy;
            whitelist.IsActive  = true;

            ecomanagementContext.Whitelists.AddObject(whitelist);
            ecomanagementContext.ObjectStateManager.ChangeObjectState(whitelist, System.Data.EntityState.Modified);
            ecomanagementContext.SaveChanges();

            Workstation workstation = new Workstation();

            workstation.editWhitelist(whitelist.ID, workstationID);
        }