public bool DeleteBouwaard(ClubCloud_Bouwaard entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } return(DeleteBouwaardById(entity.Id, settings)); }
public ClubCloud_Bouwaard GetBouwaardById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Bouwaard result = null; using (new SPMonitoredScope("Bouwaarden GetBouwaardById")) { try { result = beheerModel.ClubCloud_Bouwaarden.Find(Id); if (result == null || refresh) { result = GetBouwaardById(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_Bouwaard()); }
public ClubCloud_Bouwaard SetBouwaard(ClubCloud_Bouwaard entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Bouwaard tobeupdated = null; using (new SPMonitoredScope("Bouwaarden SetBouwaard")) { try { entity = SetBouwaard(settings.Id.ToString(), entity, settings); if (entity != null) { beheerModel.ClubCloud_Bouwaarden.AddOrUpdate(entity); } beheerModel.SaveChanges(); tobeupdated = beheerModel.ClubCloud_Bouwaarden.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 DeleteBouwaardById(System.Guid Id, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } bool succes = false; ClubCloud_Bouwaard tobedeleted = null; using (new SPMonitoredScope("Bouwaarden DeleteBouwaardById")) { try { tobedeleted = beheerModel.ClubCloud_Bouwaarden.Find(Id); if (tobedeleted != null) { beheerModel.ClubCloud_Bouwaarden.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); }