예제 #1
0
 public bool DeviceTypeAdd(DeviceType type)
 {
     try
     {
         iotSharedEntityContext <DeviceType> cont = new iotSharedEntityContext <DeviceType>();
         cont.Add(type);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #2
0
        /**************************** Get ****************************/

        public List <Site> GetSitesInDomain(int DomainId)
        {
            try
            {
                iotSharedEntityContext <Site> cont = new iotSharedEntityContext <Site>();
                List <Site> sites = cont.GetAll().Where(s => s.Domain.Id == DomainId).ToList();
                return(sites);
            }
            catch (Exception e)
            {
                nlogger.ErrorException(e.Message, e);
                return(new List <Site>());
            }
        }
예제 #3
0
 public bool PropertyResultParamAdd(DeviceParameter param)
 {
     try
     {
         iotSharedEntityContext <DeviceParameter> cont = new iotSharedEntityContext <DeviceParameter>();
         cont.Add(param);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #4
0
 public bool ActionRequiredParamAdd(ActionParameter param)
 {
     try
     {
         iotSharedEntityContext <ActionParameter> cont = new iotSharedEntityContext <ActionParameter>();
         cont.Add(param);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #5
0
 public bool PropertyAdd(DeviceProperty prop)
 {
     try
     {
         iotSharedEntityContext <DeviceProperty> cont = new iotSharedEntityContext <DeviceProperty>();
         cont.Add(prop);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #6
0
 public bool LocationAdd(Location loc)
 {
     try
     {
         iotSharedEntityContext <Location> cont = new iotSharedEntityContext <Location>();
         cont.Add(loc);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #7
0
 public bool AddSiteToDomain(Site site)
 {
     try
     {
         iotSharedEntityContext <Site> cont = new iotSharedEntityContext <Site>();
         cont.Add(site);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #8
0
 public bool AddActionToDeviceAtSiteInDomain(DeviceAction action)
 {
     try
     {
         iotSharedEntityContext <DeviceAction> cont = new iotSharedEntityContext <DeviceAction>();
         cont.Add(action);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #9
0
 public bool DeviceCredentialsRemove(DeviceCredentials creds)
 {
     try
     {
         iotSharedEntityContext <DeviceCredentials> propCont = new iotSharedEntityContext <DeviceCredentials>();
         propCont.Delete(creds);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #10
0
 public bool EndpointRemove(EndpointInfo endp)
 {
     try
     {
         iotSharedEntityContext <EndpointInfo> propCont = new iotSharedEntityContext <EndpointInfo>();
         propCont.Delete(endp);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #11
0
 public bool ReqParamRemove(ActionParameter actparam)
 {
     try
     {
         iotSharedEntityContext <ActionParameter> propCont = new iotSharedEntityContext <ActionParameter>();
         propCont.Delete(actparam);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #12
0
 public bool LocationRemove(Location location)
 {
     try
     {
         iotSharedEntityContext <Location> propCont = new iotSharedEntityContext <Location>();
         propCont.Delete(location);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #13
0
 public bool PropertyRemove(DeviceProperty property)
 {
     try
     {
         iotSharedEntityContext <DeviceProperty> propCont = new iotSharedEntityContext <DeviceProperty>();
         propCont.Delete(property);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #14
0
 public bool SiteRemove(Site Site)
 {
     try
     {
         iotSharedEntityContext <Site> propCont = new iotSharedEntityContext <Site>();
         propCont.Delete(Site);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #15
0
 public bool DeviceTypeUpdate(DeviceType type)
 {
     try
     {
         iotSharedEntityContext <DeviceType> propCont = new iotSharedEntityContext <DeviceType>();
         propCont.UpdateWithHistory(type);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #16
0
        /*********************** Delete ***********************/


        public bool DomainRemove(iotDomain domain)
        {
            try
            {
                iotSharedEntityContext <iotDomain> propCont = new iotSharedEntityContext <iotDomain>();
                propCont.Delete(domain);
                return(true);
            }
            catch (Exception e)
            {
                nlogger.ErrorException(e.Message, e);
                return(false);
            }
        }
예제 #17
0
 public bool LocationUpdate(Location Location)
 {
     try
     {
         iotSharedEntityContext <Location> propCont = new iotSharedEntityContext <Location>();
         propCont.UpdateWithHistory(Location);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #18
0
 public bool ReqParamUpdate(ActionParameter param)
 {
     try
     {
         iotSharedEntityContext <ActionParameter> propCont = new iotSharedEntityContext <ActionParameter>();
         propCont.UpdateWithHistory(param);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #19
0
 public bool SiteUpdate(Site site)
 {
     try
     {
         iotSharedEntityContext <Site> propCont = new iotSharedEntityContext <Site>();
         propCont.UpdateWithHistory(site);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #20
0
 public bool PropertyUpdate(DeviceProperty Property)
 {
     try
     {
         iotSharedEntityContext <DeviceProperty> propCont = new iotSharedEntityContext <DeviceProperty>();
         propCont.UpdateWithHistory(Property);
         return(true);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #21
0
        /*********************** Update ***********************/


        public bool DomainUpdate(iotDomain domain)
        {
            try
            {
                iotSharedEntityContext <iotDomain> cont = new iotSharedEntityContext <iotDomain>();
                iotDomain updated = cont.GetById(domain.Id); //db.GetById(domain.DomainName);
                cont.UpdateWithHistory(domain);              //db.UpdateById(domain, domain.DomainName);
                return(true);
            }
            catch (Exception e)
            {
                nlogger.ErrorException(e.Message, e);
                return(false);
            }
        }
예제 #22
0
 public bool DeviceUpdate(Device device)
 {
     try
     {
         iotSharedEntityContext <Device> propCont = new iotSharedEntityContext <Device>();
         propCont.UpdateWithHistory(device);
         return(true);
         // Task updateTask = Task.Factory.StartNew(() => { DeviceUpdateEventService.SendDeviceUpdate(device); }); //Dispatch update notify
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(false);
     }
 }
예제 #23
0
 public List <Device> GetAllDevices()
 {
     try
     {
         iotSharedEntityContext <Device> propCont = new iotSharedEntityContext <Device>();
         List <Device> stored = propCont.GetAll().ToList();
         if (stored != null)
         {
             return(stored);
         }
         return(null);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
예제 #24
0
 public DeviceParameter DeviceParameterWithId(int ParamId)
 {
     try
     {
         iotSharedEntityContext <DeviceParameter> devCont = new iotSharedEntityContext <DeviceParameter>();
         DeviceParameter dev = devCont.GetById(ParamId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new DeviceParameter());
     }
 }
예제 #25
0
 public EndpointInfo EndpointWithId(int EndpId)
 {
     try
     {
         iotSharedEntityContext <EndpointInfo> devCont = new iotSharedEntityContext <EndpointInfo>();
         EndpointInfo dev = devCont.GetById(EndpId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new EndpointInfo());
     }
 }
예제 #26
0
 public DeviceCredentials DeviceCredentialWithId(int CredId)
 {
     try
     {
         iotSharedEntityContext <DeviceCredentials> devCont = new iotSharedEntityContext <DeviceCredentials>();
         DeviceCredentials dev = devCont.GetById(CredId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new DeviceCredentials());
     }
 }
예제 #27
0
 public ActionParameter ActionParamWithId(int ActionId)
 {
     try
     {
         iotSharedEntityContext <ActionParameter> devCont = new iotSharedEntityContext <ActionParameter>();
         ActionParameter dev = devCont.GetById(ActionId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new ActionParameter());
     }
 }
예제 #28
0
 public DeviceType DeviceTypeWithId(int TypeId)
 {
     try
     {
         iotSharedEntityContext <DeviceType> devCont = new iotSharedEntityContext <DeviceType>();
         DeviceType dev = devCont.GetById(TypeId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new DeviceType());
     }
 }
예제 #29
0
 public Location LocationWithId(int LocationId)
 {
     try
     {
         iotSharedEntityContext <Location> devCont = new iotSharedEntityContext <Location>();
         Location dev = devCont.GetById(LocationId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new Location());
     }
 }
예제 #30
0
 public iotDomain DomainWithId(int DomainId)
 {
     try
     {
         iotSharedEntityContext <iotDomain> devCont = new iotSharedEntityContext <iotDomain>();
         iotDomain dev = devCont.GetById(DomainId);
         if (dev != null)
         {
             return(dev);
         }
         return(null);
     }
     catch (Exception e)
     {
         nlogger.ErrorException(e.Message, e);
         return(new iotDomain());
     }
 }