internal static PreservationRole Convert(this BibDSModel.PreservationRole rol, int level = 0, int deeplevel = 5) { if (rol == null || level > deeplevel) { return(null); } var roles = new PreservationRole { KeyCode = rol.KeyCode, AlertEnabled = rol.AlertEnable, Enabled = rol.Enable, IdPreservationRole = rol.IdPreservationRole, Name = rol.Name, UserRoles = new BindingList <PreservationUserRole>(), }; foreach (var usrRole in rol.PreservationUserRole) { roles.UserRoles.Add(usrRole.Convert(level + 1, deeplevel)); } return(roles); }
internal static BibDSModel.PreservationRole Convert(this PreservationRole rol, BibDSModel.BiblosDS2010Entities db, BibDSModel.PreservationRole original = null, int level = 0, int deeplevel = 5) { if (rol == null || level > deeplevel) { return(null); } var retval = (original == null) ? new BibDSModel.PreservationRole() : original; retval.KeyCode = (short)rol.KeyCode; retval.AlertEnable = rol.AlertEnabled; retval.Enable = rol.Enabled; retval.Name = rol.Name; if (rol.IdPreservationRole != Guid.Empty) { retval.IdPreservationRole = rol.IdPreservationRole; } return(retval); }