internal static PreservationUserRole Convert(this BibDSModel.PreservationUserRole rol, int level = 0, int deeplevel = 5) { if (rol == null || level > deeplevel) { return(null); } return(new PreservationUserRole { //Archive = rol.Archive.Convert(level + 1, deeplevel), Archive = null, IdArchive = rol.IdArchive, IdPreservationRole = rol.IdPreservationRole, IdPreservationUser = rol.IdPreservationUser, IdPreservationUserRole = rol.IdPreservationUserRole, //PreservationRole = rol.PreservationRole.Convert(level + 1, deeplevel), //PreservationUser = rol.PreservationUser.Convert(level + 1, deeplevel), }); }
internal static BibDSModel.PreservationUserRole Convert(this PreservationUserRole rol, BibDSModel.BiblosDS2010Entities db, BibDSModel.PreservationUserRole original = null, int level = 0, int deeplevel = 5) { if (rol == null || level > deeplevel) { return(null); } var retval = (original == null) ? new BibDSModel.PreservationUserRole() : original; retval.Archive = rol.Archive.ConvertPreservation(db); retval.PreservationRole = rol.PreservationRole.Convert(db, retval.PreservationRole, level + 1, deeplevel); if (rol.PreservationUser != null && rol.PreservationUser.IdPreservationUser != Guid.Empty) { retval.IdPreservationUser = rol.PreservationUser.IdPreservationUser; } else if (rol.IdPreservationUser != Guid.Empty) { retval.IdPreservationUser = rol.IdPreservationUser; } if (rol.PreservationRole != null && rol.PreservationRole.IdPreservationRole != Guid.Empty) { retval.IdPreservationRole = rol.PreservationRole.IdPreservationRole; } else if (rol.IdPreservationRole != Guid.Empty) { retval.IdPreservationRole = rol.IdPreservationRole; } if (retval.IdPreservationUserRole == Guid.Empty) { retval.IdPreservationUserRole = rol.IdPreservationUserRole; } return(retval); }