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; } }
public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) { if (source == null) { return(null); } var entity = new DB.SlaveGroup(); ToEntity(source, entity); return(entity); }
public static DA.SlaveGroup ToEntity(this DT.SlaveGroup source) { if (source == null) { return(null); } var result = new DA.SlaveGroup(); source.CopyToEntity(result); return(result); }
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; }
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; })); } }
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(); }); } }