Esempio n. 1
0
 public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target)
 {
     if ((source != null) && (target != null))
     {
         target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
     }
 }
Esempio n. 2
0
        public static DB.SlaveGroup ToEntity(DT.SlaveGroup source)
        {
            if (source == null)
            {
                return(null);
            }
            var entity = new DB.SlaveGroup(); ToEntity(source, entity);

            return(entity);
        }
Esempio n. 3
0
        public static DA.SlaveGroup ToEntity(this DT.SlaveGroup source)
        {
            if (source == null)
            {
                return(null);
            }
            var result = new DA.SlaveGroup();

            source.CopyToEntity(result);
            return(result);
        }
Esempio n. 4
0
 public static void CopyToEntity(this DT.SlaveGroup source, DA.SlaveGroup target)
 {
     if ((source == null) || (target == null))
     {
         return;
     }
     target.ResourceId       = source.Id;
     target.Name             = source.Name;
     target.ParentResourceId = source.ParentResourceId;
     target.HbInterval       = source.HbInterval;
     target.OwnerUserId      = source.OwnerUserId;
 }
Esempio n. 5
0
        public Guid AddSlaveGroup(DT.SlaveGroup slaveGroupDto)
        {
            RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
            var pm = PersistenceManager;

            using (new PerformanceLogger("AddSlaveGroup")) {
                var slaveGroupDao = pm.SlaveGroupDao;
                return(pm.UseTransaction(() => {
                    if (slaveGroupDto.Id == Guid.Empty)
                    {
                        slaveGroupDto.Id = Guid.NewGuid();
                    }
                    var slaveGroup = slaveGroupDao.Save(slaveGroupDto.ToEntity());
                    pm.SubmitChanges();
                    return slaveGroup.ResourceId;
                }));
            }
        }
Esempio n. 6
0
        public void UpdateSlaveGroup(DT.SlaveGroup slaveGroupDto)
        {
            RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
            var pm = PersistenceManager;

            using (new PerformanceLogger("UpdateSlaveGroup")) {
                var slaveGroupDao = pm.SlaveGroupDao;
                pm.UseTransaction(() => {
                    var slaveGroup = slaveGroupDao.GetById(slaveGroupDto.Id);
                    if (slaveGroup != null)
                    {
                        slaveGroupDto.CopyToEntity(slaveGroup);
                    }
                    else
                    {
                        slaveGroupDao.Save(slaveGroupDto.ToEntity());
                    }
                    pm.SubmitChanges();
                });
            }
        }