public bool DeleteFoto(ClubCloud_Foto entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } return(DeleteFotoById(entity.Id, settings)); }
public async Task <Models.Foto> GetFotoAsync(Guid verenigingId, Guid gebruikerId) { Foto foto = new Foto(); ClubCloud_Foto ccfoto = await client.GetFotoByIdAsync("00000000", verenigingId, gebruikerId, false); foto = new Foto { ContentData = ccfoto.ContentData, ContentLength = ccfoto.ContentLength, ContentType = ccfoto.ContentType, FotoId = ccfoto.FotoId, Id = ccfoto.Id }; return(foto); }
//public ClubCloud_Foto GetFotoByNummer(string bondsnummer, Guid verenigingId, string nummer, bool refresh = false) //{ // ClubCloud_Foto foto = null; // if (SPContext.Current != null && SPContext.Current.Web != null) // { // ClubCloudServiceClient client = new ClubCloudServiceClient(SPServiceContext.Current); // foto = client.GetFotoByNummer(bondsnummer, verenigingId, nummer, refresh); // } // return foto; //} public ClubCloud_Foto GetFotoById(string bondsnummer, Guid verenigingId, Guid gebruikerId, bool refresh = false) { ClubCloud_Foto foto = null; if (SPContext.Current != null && SPContext.Current.Web != null) { ClubCloudServiceClient client = new ClubCloudServiceClient(SPServiceContext.Current); foto = client.GetFotoForGebruikerById(bondsnummer, gebruikerId, refresh, new ClubCloud_Setting { Id = int.Parse(bondsnummer), VerenigingId = verenigingId, GebruikerId = gebruikerId }); } return(foto); }
public ClubCloud_Foto GetFotoById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Foto result = null; using (new SPMonitoredScope("Fotos GetFotoById")) { try { result = beheerModel.ClubCloud_Fotos.Find(Id); if (result == null || refresh) { result = GetFotoById(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_Foto()); }
public ClubCloud_Foto SetFoto(ClubCloud_Foto entity, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } ClubCloud_Foto tobeupdated = null; using (new SPMonitoredScope("Fotos SetFoto")) { try { entity = SetFoto(settings.Id.ToString(), entity, settings); if (entity != null) { beheerModel.ClubCloud_Fotos.AddOrUpdate(entity); } beheerModel.SaveChanges(); tobeupdated = beheerModel.ClubCloud_Fotos.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 DeleteFotoById(System.Guid Id, ClubCloud_Setting settings = null) { if (settings != null) { ValidateSettings(ref settings); } bool succes = false; ClubCloud_Foto tobedeleted = null; using (new SPMonitoredScope("Fotos DeleteFotoById")) { try { tobedeleted = beheerModel.ClubCloud_Fotos.Find(Id); if (tobedeleted != null) { beheerModel.ClubCloud_Fotos.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); }
internal override void SetPageData() { if (Settings != null)//&& Settings.mijnknltb_allow) { ClubCloud_Gebruiker gebruiker = null; try { gebruiker = Client.GetGebruikerByNummer(userId, Settings.VerenigingId.Value, userId, false); } catch { } if (gebruiker != null) { try { gebruiker.ClubCloud_Vereniging = Client.GetVerenigingById(gebruiker.VerenigingId.Value, false, Settings); //gebruiker.ClubCloud_Lidmaatschap = Client.GetLidaamschapByGebruikerId(userId, gebruiker.VerenigingId.Value); gebruiker.ClubCloud_Address = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Address>(Client.GetAddressByGebruikerId(userId, gebruiker.VerenigingId.Value, gebruiker.Id, false)); } catch { } try { fvw_persoon.DataSource = new List <ClubCloud_Gebruiker> { gebruiker }; fvw_persoon.DataBind(); } catch (Exception ex) { lbl_result.Text += ex.Message + Environment.NewLine; } try { fvw_contact.DataSource = new List <ClubCloud_Gebruiker> { gebruiker }; fvw_contact.DataBind(); } catch (Exception ex) { lbl_result.Text += ex.Message + Environment.NewLine; } try { ClubCloud_Address first = gebruiker.ClubCloud_Address.First(); //if (string.IsNullOrWhiteSpace(first.Naam)) first.Naam = "Bezoekadres"; fvw_adres.DataSource = new List <ClubCloud_Address> { first }; fvw_adres.DataBind(); } catch (Exception ex) { lbl_result.Text += ex.Message + Environment.NewLine; } //TODO second fvw_post /* * try * { * ClubCloud_Address last = gebruiker.ClubCloud_Address.Last(); * if (string.IsNullOrWhiteSpace(last.Naam)) last.Naam = "Postadres"; * fvw_adres.DataSource = new List<ClubCloud_Address> { last }; * fvw_adres.DataBind(); * } * catch (Exception ex) * { * lbl_result.Text += ex.Message + Environment.NewLine; * } */ try { ClubCloud_Foto foto = Client.GetFotoForGebruikerById(gebruiker.Bondsnummer, gebruiker.Id, false, Settings); fvw_afbeelding.DataSource = new List <ClubCloud_Foto> { foto };; fvw_afbeelding.DataBind(); if (fvw_afbeelding.CurrentMode == FormViewMode.ReadOnly) { Image profielfoto = (Image)fvw_afbeelding.FindControl("profielfoto"); if (profielfoto != null) { string base64String = Convert.ToBase64String(foto.ContentData, 0, foto.ContentData.Length); profielfoto.ImageUrl = "data:image/png;base64," + base64String; } } } catch (Exception ex) { lbl_result.Text += ex.Message + Environment.NewLine; } Label knltbid = (Label)fvw_persoon.FindControl("knltbid"); knltbid.Text = Settings.Id.ToString(); } } else { pnl_authorize.Visible = true; } }