public IQueryable <ClubCloud_Baansoort> SelectBaansoorten(string sortByExpression, int startRowIndex, int maximumRows, out int totalRowCount)//, bool retrieveTotalRowCount = true)
        {
            using (new SPMonitoredScope("Baansoorten SelectBaansoorten"))
            {
                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)
                    {
                        List <Parameter> collection = new List <Parameter>();


                        foreach (Parameter where in WhereParameters)
                        {
                            if (collection.Any(w => w.Name == where.Name))
                            {
                                int index = collection.FindIndex(p => p.Name == where.Name);
                                if (index >= 0)
                                {
                                    collection[index] = where;
                                }
                            }
                            else
                            {
                                collection.Add(where);
                            }
                        }

                        DataSourceSelectArguments selectArgs = new DataSourceSelectArguments {
                            MaximumRows = maximumRows, StartRowIndex = startRowIndex, RetrieveTotalRowCount = true, SortExpression = sortByExpression
                        };
                        ClubCloud_Baansoort_View queryresult = Client.GetBaansoortenByQuery(bondsnummer.ToString(), Settings.VerenigingId.Value, new DataSourceSelectArguments {
                            MaximumRows = maximumRows, StartRowIndex = startRowIndex, RetrieveTotalRowCount = true, SortExpression = sortByExpression
                        }, collection);

                        totalRowCount = queryresult.TotalRowCount;


                        if (totalRowCount > 0)
                        {
                            foreach (ClubCloud_Baansoort Baansoort in queryresult.ClubCloud_Baansoort)
                            {
                                Baansoort.ClubCloud_Baantype = Client.GetBaantypeForBaansoortById(Baansoort.Id, false, Settings);
                                Baansoort.ClubCloud_Baanblok = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Baanblok>(Client.GetBaanblokkenForBaansoortById(Baansoort.Id, false, Settings));
                            }
                        }
                        return(queryresult.ClubCloud_Baansoort.AsQueryable <ClubCloud_Baansoort>());
                    }
                }
            }

            totalRowCount = 0;
            return(null);
        }
Esempio n. 2
0
        public IQueryable <ClubCloud_Land> SelectLand()
        {
            using (new SPMonitoredScope("Addressen SelectLand"))
            {
                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)
                    {
                        List <ClubCloud_Land> result = null;

                        if (result == null)
                        {
                            result = Client.GetLanden(false, Settings);
                        }

                        //Default
                        result = result.OrderBy(r => r.Naam).ToList();
                        //result.Insert(0, new ClubCloud_Land { Naam = "Onbekend" });

                        return(result.AsQueryable <ClubCloud_Land>());
                    }
                }
            }

            return(null);
        }
Esempio n. 3
0
        public int InsertBaanSpeciaal(ClubCloud_BaanSpeciaal entity)
        {
            using (new SPMonitoredScope("BanenSpeciaal InsertBaanSpeciaal"))
            {
                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)
                        {
                            entity.AccommodatieId = Settings.ClubCloud_Vereniging.AccommodatieId.Value;
                        }
                        entity = Client.SetBaanSpeciaal(entity, Settings);
                        this.OnDataSourceViewChanged(EventArgs.Empty);
                    }
                }
            }

            return(1);
        }
        public void UpdateVereniging(ClubCloud_Vereniging entity)
        {
            using (new SPMonitoredScope("Verenigingen UpdateVereniging"))
            {
                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)
                        {
                            entity.AccommodatieId = Settings.ClubCloud_Vereniging.AccommodatieId.Value;
                        }
                        Client.SetVereniging(entity, Settings);
                        this.OnDataSourceViewChanged(EventArgs.Empty);
                    }
                }
            }
        }
        public ClubCloud_Gebruiker SelectGebruiker([QueryString] Guid?Id)  //(string Id)
        {
            ClubCloud_Gebruiker entity = null;

            using (new SPMonitoredScope("Gebruikers SelectGebruiker"))
            {
                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.GetGebruikerById(Id.Value, false, Settings);

                            if (entity != null || entity.Id != Guid.Empty)
                            {
                                entity.ClubCloud_Functionaris  = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Functionaris>(Client.GetFunctionarissenForGebruikerById(Id.Value, false, Settings));
                                entity.ClubCloud_Lidmaatschap  = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Lidmaatschap>(Client.GetLidmaatschappenForGebruikerById(Id.Value, false, Settings));
                                entity.ClubCloud_Address       = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Address>(Client.GetAddressenForGebruikerById(Id.Value, false, Settings));
                                entity.ClubCloud_Vereniging    = Client.GetVerenigingForGebruikerById(Id.Value, false, Settings);
                                entity.ClubCloud_Profiel       = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Profiel>(Client.GetProfielenForGebruikerById(Id.Value, false, Settings));
                                entity.ClubCloud_Nationaliteit = Client.GetNationaliteitForGebruikerById(Id.Value, false, Settings);
                            }
                        }
                    }
                }
            }

            return(entity);
        }
        public ClubCloud_Functionaris SelectFunctionaris([QueryString] Guid?Id)  //(string Id)
        {
            ClubCloud_Functionaris entity = null;

            using (new SPMonitoredScope("Functionarissen SelectFunctionaris"))
            {
                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.GetFunctionarisById(Id.Value, false, Settings);

                            if (entity != null || entity.Id != Guid.Empty)
                            {
                                entity.ClubCloud_Functie        = Client.GetFunctieForFunctionarisById(Id.Value, false, Settings);
                                entity.ClubCloud_Vereniging     = Client.GetVerenigingForFunctionarisById(Id.Value, false, Settings);
                                entity.ClubCloud_Gebruiker      = Client.GetGebruikerForFunctionarisById(Id.Value, false, Settings);
                                entity.ClubCloud_District       = Client.GetDistrictForFunctionarisById(Id.Value, false, Settings);
                                entity.ClubCloud_Bestuursorgaan = Client.GetBestuursorgaanForFunctionarisById(Id.Value, false, Settings);
                            }
                        }
                    }
                }
            }

            return(entity);
        }
Esempio n. 7
0
        public ClubCloud_Address SelectAddress([QueryString] Guid?Id)  //(string Id)
        {
            ClubCloud_Address entity = null;

            using (new SPMonitoredScope("Addressen SelectAddress"))
            {
                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.GetAddressById(Id.Value, false, Settings);

                            if (entity != null || entity.Id != Guid.Empty)
                            {
                                entity.ClubCloud_Vereniging   = Client.GetVerenigingForAddressById(Id.Value, false, Settings);
                                entity.ClubCloud_Gebruiker    = Client.GetGebruikerForAddressById(Id.Value, false, Settings);
                                entity.ClubCloud_Regio        = Client.GetRegioForAddressById(Id.Value, false, Settings);
                                entity.ClubCloud_Accommodatie = Client.GetAccommodatieForAddressById(Id.Value, false, Settings);
                                entity.ClubCloud_Land         = Client.GetLandForAddressById(Id.Value, false, Settings);
                            }
                        }
                    }
                }
            }

            return(entity);
        }
Esempio n. 8
0
        public ClubCloud_Baanblok SelectBaanblok([QueryString] Guid?Id)  //(string Id)
        {
            ClubCloud_Baanblok entity = null;

            using (new SPMonitoredScope("Baanblokken SelectBaanblok"))
            {
                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.GetBaanblokById(Id.Value, false, Settings);

                            if (entity != null || entity.Id != Guid.Empty)
                            {
                                entity.ClubCloud_Baan         = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Baan>(Client.GetBanenForBaanblokById(Id.Value, false, Settings));
                                entity.ClubCloud_Accommodatie = Client.GetAccommodatieForBaanblokById(Id.Value, false, Settings);
                                entity.ClubCloud_Baantype     = Client.GetBaantypeForBaanblokById(Id.Value, false, Settings);
                                entity.ClubCloud_Baansoort    = Client.GetBaansoortForBaanblokById(Id.Value, false, Settings);
                            }
                        }
                    }
                }
            }

            return(entity);
        }
Esempio n. 9
0
        public bool DeleteFunctie(ClubCloud_Functie entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteFunctieById(entity.Id, settings));
        }
Esempio n. 10
0
        public bool DeleteBestuursorgaan(ClubCloud_Bestuursorgaan entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteBestuursorgaanById(entity.Id, settings));
        }
Esempio n. 11
0
        public bool DeleteSponsor(ClubCloud_Sponsor entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteSponsorById(entity.Id, settings));
        }
        public bool DeleteLidmaatschap(ClubCloud_Lidmaatschap entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteLidmaatschapById(entity.Id, settings));
        }
Esempio n. 13
0
        public bool DeleteDistrict(ClubCloud_District entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteDistrictById(entity.Id, settings));
        }
        public bool DeleteBaantype(ClubCloud_Baantype entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteBaantypeById(entity.Id, settings));
        }
Esempio n. 15
0
        public bool DeleteRegio(ClubCloud_Regio entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteRegioById(entity.Id, settings));
        }
Esempio n. 16
0
        public bool DeleteAfhang(ClubCloud_Afhang entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteAfhangById(entity.Id, settings));
        }
        public bool DeleteLand(ClubCloud_Land entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteLandById(entity.Id, settings));
        }
Esempio n. 18
0
        public bool DeleteAddress(ClubCloud_Address entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteAddressById(entity.Id, settings));
        }
Esempio n. 19
0
        public bool DeleteNationaliteit(ClubCloud_Nationaliteit entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteNationaliteitById(entity.Id, settings));
        }
        public bool DeleteProfiel(ClubCloud_Profiel entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            return(DeleteProfielById(entity.Id, settings));
        }
        public ClubCloud_Baanschema SelectBaanschema([QueryString] Guid?Id)  //(string Id)
        {
            ClubCloud_Baanschema entity = null;

            using (new SPMonitoredScope("Baanschemas SelectBaanschema"))
            {
                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.GetBaanschemaById(Id.Value, false, Settings);

                            if (entity != null || entity.Id != Guid.Empty)
                            {
                                entity.ClubCloud_Baan       = Client.GetBaanForBaanschemaById(Id.Value, false, Settings);
                                entity.ClubCloud_Vereniging = Client.GetVerenigingForBaanschemaById(Id.Value, false, Settings);
                            }
                        }
                    }
                }
            }

            return(entity);
        }
        public ClubCloud_Vereniging GetVerenigingForSettingById(int Id, bool refresh = false, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            ClubCloud_Setting    entity = null;
            ClubCloud_Vereniging result = null;

            using (new SPMonitoredScope("Settings GetVerenigingForSettingById"))
            {
                try
                {
                    entity = beheerModel.ClubCloud_Settings.Find(Id);
                    if (entity != null && entity.ClubCloud_Vereniging == null)
                    {
                        beheerModel.Entry(entity).Reference(e => e.ClubCloud_Vereniging).Load();
                    }

                    if (entity != null)
                    {
                        result = entity.ClubCloud_Vereniging;
                    }

                    if (result == null || refresh)
                    {
                        result = GetVerenigingForSettingById(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_Vereniging());
        }
Esempio n. 23
0
        public List <ClubCloud_Address> GetAddressen(bool refresh = false, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            List <ClubCloud_Address> result = null;

            using (new SPMonitoredScope("Addressen GetAddressen"))
            {
                try
                {
                    result = beheerModel.ClubCloud_Addressen.ToList <ClubCloud_Address>();

                    if (result == null || result.Count == 0 || refresh)
                    {
                        result = GetAddressen(settings.Id.ToString(), refresh, settings);
                    }

                    if (result != null)
                    {
                        return(result);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(Logger.Category.Unexpected, ex.Source, ex.Message);
                }
                finally
                {
                    if (result != null)
                    {
                        foreach (object item in result)
                        {
                            if (item != null)
                            {
                                try { beheerModel.ObjectContext.Detach(item); } catch {}
                            }
                        }
                    }
                }
            }

            return(new List <ClubCloud_Address>());
        }
Esempio n. 24
0
        public IQueryable <DictionaryEntry> SelectActief()
        {
            using (new SPMonitoredScope("Functies SelectActief"))
            {
                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)
                    {
                        List <DictionaryEntry> result = new List <DictionaryEntry>();
                        Array values = Enum.GetValues(typeof(ActiefSoort));
                        Array.Sort(values);
                        foreach (int value in values)
                        {
                            result.Add(new DictionaryEntry(value, (ActiefSoort)value));
                        }
                        return(result.AsQueryable <DictionaryEntry>());
                    }

                    /*
                     * if(Settings != null && Settings.VerenigingId != null)
                     * {
                     *      Hashtable ht = new Hashtable();
                     *      ht.Add(string.Empty,"Onbekend");
                     *      Array values = Enum.GetValues(typeof(ActiefSoort));
                     *      Array.Sort(values);
                     *      foreach (int value in values)
                     *      {
                     *              string name = ((ActiefSoort)value).ToString();
                     *              ht.Add(name,name);
                     *      }
                     *      return ht;
                     * }
                     */
                }
            }

            return(null);
        }
        public bool SetVerenigingForSettingById(ClubCloud_Vereniging Vereniging, int Id, bool refresh = false, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            ClubCloud_Setting entity = null;
            bool succes = false;

            using (new SPMonitoredScope("Settings SetVerenigingForSettingById"))
            {
                try
                {
                    entity = beheerModel.ClubCloud_Settings.Find(Id);

                    if (entity != null && entity.ClubCloud_Vereniging == null)
                    {
                        beheerModel.Entry(entity).Reference(e => e.ClubCloud_Vereniging).Load();
                    }

                    if (entity != null)
                    {
                        entity.ClubCloud_Vereniging = Vereniging;
                    }

                    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);
        }
Esempio n. 26
0
        public bool DeleteFunctie(ClubCloud_Functie entity)
        {
            using (new SPMonitoredScope("Functies DeleteFunctie"))
            {
                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.DeleteFunctie(entity, Settings));
                    }
                }
            }
            return(false);
        }
Esempio n. 27
0
        public void UpdateFunctie(ClubCloud_Functie entity)
        {
            using (new SPMonitoredScope("Functies UpdateFunctie"))
            {
                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)
                    {
                        Client.SetFunctie(entity, Settings);
                        this.OnDataSourceViewChanged(EventArgs.Empty);
                    }
                }
            }
        }
Esempio n. 28
0
        public ClubCloud_Address SetAddress(ClubCloud_Address entity, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            ClubCloud_Address tobeupdated = null;

            using (new SPMonitoredScope("Addressen SetAddress"))
            {
                try
                {
                    entity = SetAddress(settings.Id.ToString(), entity, settings);

                    if (entity != null)
                    {
                        beheerModel.ClubCloud_Addressen.AddOrUpdate(entity);
                    }

                    beheerModel.SaveChanges();

                    tobeupdated = beheerModel.ClubCloud_Addressen.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 ClubCloud_Land GetLandById(System.Guid Id, bool refresh = false, ClubCloud_Setting settings = null)
        {
            if (settings != null)
            {
                ValidateSettings(ref settings);
            }

            ClubCloud_Land result = null;

            using (new SPMonitoredScope("Landen GetLandById"))
            {
                try
                {
                    result = beheerModel.ClubCloud_Landen.Find(Id);

                    if (result == null || refresh)
                    {
                        result = GetLandById(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_Land());
        }
        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);
                    }
                }
            }
        }