public List <UrlLock> GetWriteLocks()
        {
            List <UrlLock> ret = new List <UrlLock>();
            Expression     e   = new Expression("Id", Operators.GreaterThan, 0);

            e.PrependAnd(new Expression("LockType", Operators.Equals, LockType.Write.ToString()));
            DataTable result = _Database.Select(LOCKS_TABLE, null, null, null, e, null);

            if (result != null && result.Rows.Count > 0)
            {
                foreach (DataRow row in result.Rows)
                {
                    ret.Add(UrlLock.FromDataRow(row));
                }
            }
            return(ret);
        }
Exemple #2
0
 private T DataTableToObject <T>(DataTable result) where T : class
 {
     if (result == null || result.Rows.Count < 1)
     {
         return(null);
     }
     if (typeof(T) == typeof(ApiKey))
     {
         return(ApiKey.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(UserMaster))
     {
         return(UserMaster.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(Permission))
     {
         return(Permission.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(UrlLock))
     {
         return(UrlLock.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(Container))
     {
         return(Container.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(ObjectMetadata))
     {
         return(ObjectMetadata.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(ContainerKeyValuePair))
     {
         return(ContainerKeyValuePair.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(ObjectKeyValuePair))
     {
         return(ObjectKeyValuePair.FromDataRow(result.Rows[0]) as T);
     }
     else if (typeof(T) == typeof(AuditLogEntry))
     {
         return(AuditLogEntry.FromDataRow(result.Rows[0]) as T);
     }
     throw new ArgumentException("Unknown object type: " + typeof(T).Name);
 }