public bool DeleteLidmaatschap(ClubCloud_Lidmaatschap entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } return(DeleteLidmaatschapById(entity.Id, settings)); }
public ClubCloud_Lidmaatschap SelectLidmaatschap([QueryString] Guid?Id) //(string Id) { ClubCloud_Lidmaatschap entity = null; using (new SPMonitoredScope("Lidmaatschappen SelectLidmaatschap")) { if (SPContext.Current.Web.CurrentUser != null) { int bondsnummer; ClubCloud_Setting Settings = null; if (int.TryParse(SPContext.Current.Web.CurrentUser.UserId.NameId, out bondsnummer)) { Settings = Client.GetSettingById(bondsnummer); } if (Settings != null && Settings.VerenigingId != null) { Settings.ClubCloud_Vereniging = Client.GetVerenigingById(Settings.VerenigingId.Value, false, Settings); if (Settings.ClubCloud_Vereniging != null) { if (Id == null) { Guid queryId = Guid.Empty; foreach (Parameter where in WhereParameters) { if (where.Name == "Id") { if (Guid.TryParse(where.DefaultValue, out queryId)) { break; } } } Id = queryId; } if (Id == Guid.Empty) { } entity = Client.GetLidmaatschapById(Id.Value, false, Settings); if (entity != null || entity.Id != Guid.Empty) { entity.ClubCloud_Vereniging = Client.GetVerenigingForLidmaatschapById(Id.Value, false, Settings); entity.ClubCloud_Gebruiker = Client.GetGebruikerForLidmaatschapById(Id.Value, false, Settings); entity.ClubCloud_Lidmaatschapsoort = Client.GetLidmaatschapsoortForLidmaatschapById(Id.Value, false, Settings); } } } } } return(entity); }
public ClubCloud_Lidmaatschapsoort GetLidmaatschapsoortForLidmaatschapById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Lidmaatschap entity = null; ClubCloud_Lidmaatschapsoort result = null; using (new SPMonitoredScope("Lidmaatschappen GetLidmaatschapsoortForLidmaatschapById")) { try { entity = beheerModel.ClubCloud_Lidmaatschappen.Find(Id); if (entity != null && entity.ClubCloud_Lidmaatschapsoort == null) { beheerModel.Entry(entity).Reference(e => e.ClubCloud_Lidmaatschapsoort).Load(); } if (entity != null) { result = entity.ClubCloud_Lidmaatschapsoort; } if (result == null || refresh) { result = GetLidmaatschapsoortForLidmaatschapById(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_Lidmaatschapsoort()); }
public bool SetLidmaatschapsoortForLidmaatschapById(ClubCloud_Lidmaatschapsoort Lidmaatschapsoort, System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Lidmaatschap entity = null; bool succes = false; using (new SPMonitoredScope("Lidmaatschappen SetLidmaatschapsoortForLidmaatschapById")) { try { entity = beheerModel.ClubCloud_Lidmaatschappen.Find(Id); if (entity != null && entity.ClubCloud_Lidmaatschapsoort == null) { beheerModel.Entry(entity).Reference(e => e.ClubCloud_Lidmaatschapsoort).Load(); } if (entity != null) { entity.ClubCloud_Lidmaatschapsoort = Lidmaatschapsoort; } 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 bool DeleteLidmaatschap(ClubCloud_Lidmaatschap entity) { using (new SPMonitoredScope("Lidmaatschappen DeleteLidmaatschap")) { if (SPContext.Current.Web.CurrentUser != null) { int bondsnummer; ClubCloud_Setting Settings = null; if (int.TryParse(SPContext.Current.Web.CurrentUser.UserId.NameId, out bondsnummer)) { Settings = Client.GetSettingById(bondsnummer); } if (Settings != null && Settings.VerenigingId != null) { return(Client.DeleteLidmaatschap(entity, Settings)); } } } return(false); }
public ClubCloud_Lidmaatschap GetLidmaatschapById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Lidmaatschap result = null; using (new SPMonitoredScope("Lidmaatschappen GetLidmaatschapById")) { try { result = beheerModel.ClubCloud_Lidmaatschappen.Find(Id); if (result == null || refresh) { result = GetLidmaatschapById(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_Lidmaatschap()); }
public ClubCloud_Lidmaatschap SetLidmaatschap(ClubCloud_Lidmaatschap entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Lidmaatschap tobeupdated = null; using (new SPMonitoredScope("Lidmaatschappen SetLidmaatschap")) { try { entity = SetLidmaatschap(settings.Id.ToString(), entity, settings); if (entity != null) { beheerModel.ClubCloud_Lidmaatschappen.AddOrUpdate(entity); } beheerModel.SaveChanges(); tobeupdated = beheerModel.ClubCloud_Lidmaatschappen.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 void UpdateLidmaatschap(ClubCloud_Lidmaatschap entity) { using (new SPMonitoredScope("Lidmaatschappen UpdateLidmaatschap")) { if (SPContext.Current.Web.CurrentUser != null) { int bondsnummer; ClubCloud_Setting Settings = null; if (int.TryParse(SPContext.Current.Web.CurrentUser.UserId.NameId, out bondsnummer)) { Settings = Client.GetSettingById(bondsnummer); } if (Settings != null && Settings.VerenigingId != null) { entity.VerenigingId = Settings.VerenigingId.Value; Client.SetLidmaatschap(entity, Settings); this.OnDataSourceViewChanged(EventArgs.Empty); } } } }
public bool DeleteLidmaatschapById(System.Guid Id, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } bool succes = false; ClubCloud_Lidmaatschap tobedeleted = null; using (new SPMonitoredScope("Lidmaatschappen DeleteLidmaatschapById")) { try { tobedeleted = beheerModel.ClubCloud_Lidmaatschappen.Find(Id); if (tobedeleted != null) { beheerModel.ClubCloud_Lidmaatschappen.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); }