Ejemplo n.º 1
0
 public static void ToEntity(DT.HiveExperiment source, HiveExperiment target)
 {
     if ((source != null) && (target != null))
     {
         target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
     }
 }
Ejemplo n.º 2
0
        public static HiveExperiment ToEntity(DT.HiveExperiment source)
        {
            if (source == null)
            {
                return(null);
            }
            var entity = new HiveExperiment(); ToEntity(source, entity);

            return(entity);
        }
Ejemplo n.º 3
0
 public static DT.HiveExperiment ToDto(HiveExperiment source)
 {
     if (source == null)
     {
         return(null);
     }
     return(new DT.HiveExperiment {
         Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed
     });
 }
Ejemplo n.º 4
0
 public Permission GetPermissionForExperiment(Guid experimentId, Guid userId)
 {
     using (var db = CreateContext()) {
         HiveExperiment hiveExperiment = db.HiveExperiments.SingleOrDefault(x => x.HiveExperimentId == experimentId);
         if (hiveExperiment == null)
         {
             return(Permission.NotAllowed);
         }
         if (hiveExperiment.OwnerUserId == userId)
         {
             return(Permission.Full);
         }
         HiveExperimentPermission permission = db.HiveExperimentPermissions.SingleOrDefault(p => p.HiveExperimentId == experimentId && p.GrantedUserId == userId);
         return(permission != null ? permission.Permission : Permission.NotAllowed);
     }
 }
Ejemplo n.º 5
0
 public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) {
   if ((source != null) && (target != null)) {
     target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
   }
 }
Ejemplo n.º 6
0
 public static HiveExperiment ToEntity(DT.HiveExperiment source) {
   if (source == null) return null;
   var entity = new HiveExperiment(); ToEntity(source, entity);
   return entity;
 }
Ejemplo n.º 7
0
 public static DT.HiveExperiment ToDto(HiveExperiment source) {
   if (source == null) return null;
   return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
 }