Esempio n. 1
0
        public override IQueryable <ILocation> GetAll(Expression <Func <ILocation, bool> > whereExpression)
        {
            Context = new SysInventoryLinqSqlContextDataContext(ConnectionString);
            var query = whereExpression != null?Context.GetTable <Location>().Where(whereExpression) : Context.GetTable <Location>();

            return(query.OrderBy(x => x.Name));
        }
Esempio n. 2
0
 public override long Count(Expression <Func <ILocation, bool> > whereExpression)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext(ConnectionString))
         return(whereExpression != null
             ? Context.GetTable <Location>().LongCount(whereExpression)
             : Context.GetTable <Location>().LongCount());
 }
Esempio n. 3
0
 public override ILocation GetSingle <TKey>(TKey pkValue)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext(ConnectionString))
     {
         var id = Guid.Parse(pkValue.ToString());
         return(Context.GetTable <Location>().First(x => x.Id == id));
     }
 }
Esempio n. 4
0
 public override void Delete(ILocation entity)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext())
     {
         Context.GetTable <Location>().DeleteOnSubmit(Context.GetTable <Location>().First(x => x.Id == entity.Id));
         Context.SubmitChanges();
     }
 }
Esempio n. 5
0
 public override void Delete(ILogEntry entity)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext())
     {
         Context.Logs.DeleteOnSubmit(Context.Logs.First(l => l.LogId == entity.Id));
         Context.SubmitChanges();
     }
 }
Esempio n. 6
0
 public override void Add(ILocation entity)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext())
     {
         entity.Id = Guid.NewGuid();
         Context.GetTable <Location>().InsertOnSubmit((Location)entity);
         Context.SubmitChanges();
     }
 }
Esempio n. 7
0
 public override void Update(ILocation entity)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext())
     {
         var found = Context.GetTable <Location>().First(e => e.Id == entity.Id);
         found.ParentId = entity.ParentId;
         found.PoDId    = entity.PoDId;
         found.Name     = entity.Name;
         Context.SubmitChanges();
     }
 }
Esempio n. 8
0
 public override IQueryable <ILocation> GetAll()
 {
     Context = new SysInventoryLinqSqlContextDataContext(ConnectionString);
     return(Context.GetTable <Location>().OrderBy(x => x.Name));
 }
Esempio n. 9
0
 public override long Count()
 {
     using (Context = new SysInventoryLinqSqlContextDataContext(ConnectionString))
         return(Context.GetTable <Location>().LongCount());
 }
Esempio n. 10
0
 public override void Add(ILogEntry entity)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext())
         Context.LogMessageAdd(entity.PoD, entity.Hostname, entity.Severity, entity.Message);
 }
Esempio n. 11
0
 public override void Update(ILogEntry entity)
 {
     using (Context = new SysInventoryLinqSqlContextDataContext())
         Context.LogClear(entity.Id);
 }
Esempio n. 12
0
 public override IQueryable <ILogEntry> GetAll(Expression <Func <ILogEntry, bool> > whereExpression)
 {
     Context = new SysInventoryLinqSqlContextDataContext(ConnectionString);
     return(whereExpression != null?Context.GetTable <LogEntry>().Where(whereExpression) : Context.GetTable <LogEntry>());
 }
Esempio n. 13
0
 public override IQueryable <ILogEntry> GetAll()
 {
     Context = new SysInventoryLinqSqlContextDataContext(ConnectionString);
     return(Context.GetTable <LogEntry>());
 }