public bool DeleteProfiel(ClubCloud_Profiel entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } return(DeleteProfielById(entity.Id, settings)); }
public ClubCloud_Gebruiker GetGebruikerForProfielById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Profiel entity = null; ClubCloud_Gebruiker result = null; using (new SPMonitoredScope("Profielen GetGebruikerForProfielById")) { try { entity = beheerModel.ClubCloud_Profielen.Find(Id); if (entity != null && entity.ClubCloud_Gebruiker == null) { beheerModel.Entry(entity).Reference(e => e.ClubCloud_Gebruiker).Load(); } if (entity != null) { result = entity.ClubCloud_Gebruiker; } if (result == null || refresh) { result = GetGebruikerForProfielById(settings.Id.ToString(), Id, refresh, settings); } if (result != null) { return(result); } } catch (Exception ex) { Logger.WriteLog(Logger.Category.Unexpected, ex.Source, ex.Message); } finally { if (entity != null) { try { beheerModel.ObjectContext.Detach(entity); } catch {} } if (result != null) { try { beheerModel.ObjectContext.Detach(result); } catch {} } } } return(new ClubCloud_Gebruiker()); }
public bool SetGebruikerForProfielById(ClubCloud_Gebruiker Gebruiker, System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Profiel entity = null; bool succes = false; using (new SPMonitoredScope("Profielen SetGebruikerForProfielById")) { try { entity = beheerModel.ClubCloud_Profielen.Find(Id); if (entity != null && entity.ClubCloud_Gebruiker == null) { beheerModel.Entry(entity).Reference(e => e.ClubCloud_Gebruiker).Load(); } if (entity != null) { entity.ClubCloud_Gebruiker = Gebruiker; } beheerModel.SaveChanges(); succes = true; } catch (Exception ex) { Logger.WriteLog(Logger.Category.Unexpected, ex.Source, ex.Message); } finally { if (entity != null) { try { beheerModel.ObjectContext.Detach(entity); } catch {} } } } return(succes); }
public ClubCloud_Profiel GetProfielById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Profiel result = null; using (new SPMonitoredScope("Profielen GetProfielById")) { try { result = beheerModel.ClubCloud_Profielen.Find(Id); if (result == null || refresh) { result = GetProfielById(settings.Id.ToString(), Id, refresh, settings); } if (result != null) { return(result); } } catch (Exception ex) { Logger.WriteLog(Logger.Category.Unexpected, ex.Source, ex.Message); } finally { if (result != null) { try { beheerModel.ObjectContext.Detach(result); } catch {} } } } return(new ClubCloud_Profiel()); }
public ClubCloud_Profiel SetProfiel(ClubCloud_Profiel entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Profiel tobeupdated = null; using (new SPMonitoredScope("Profielen SetProfiel")) { try { entity = SetProfiel(settings.Id.ToString(), entity, settings); if (entity != null) { beheerModel.ClubCloud_Profielen.AddOrUpdate(entity); } beheerModel.SaveChanges(); tobeupdated = beheerModel.ClubCloud_Profielen.Find(entity.Id); return(tobeupdated); } catch (Exception ex) { Logger.WriteLog(Logger.Category.Unexpected, ex.Source, ex.Message); } finally { if (tobeupdated != null) { try { beheerModel.ObjectContext.Detach(tobeupdated); } catch {} } } } return(null); }
public bool DeleteProfielById(System.Guid Id, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } bool succes = false; ClubCloud_Profiel tobedeleted = null; using (new SPMonitoredScope("Profielen DeleteProfielById")) { try { tobedeleted = beheerModel.ClubCloud_Profielen.Find(Id); if (tobedeleted != null) { beheerModel.ClubCloud_Profielen.Remove(tobedeleted); beheerModel.SaveChanges(); } succes = true; } catch (Exception ex) { Logger.WriteLog(Logger.Category.Unexpected, ex.Source, ex.Message); } finally { if (tobedeleted != null) { try { beheerModel.ObjectContext.Detach(tobedeleted); } catch {} } } } return(succes); }