/// <summary>
        /// Loads all meta data
        /// </summary>
        private void LoadData()
        {
            try
            {
                try
                {
                    using (var db = new ApirsRepository <tblUnionChronostratigraphy>())
                    {
                        this.chronostratigraphy = new BindableCollection <tblUnionChronostratigraphy>(db.GetModel().ToList());

                        this.allLithostratigraphies = new BindableCollection <LithostratigraphyUnion>(db.GetCompleteLithostratigraphy().ToList());
                    }
                }
                catch (Exception ex)
                {
                    this.chronostratigraphy     = new BindableCollection <tblUnionChronostratigraphy>();
                    this.allLithostratigraphies = new BindableCollection <LithostratigraphyUnion>();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 2
0
        //Loading filtered data
        private void LoadData()
        {
            try
            {
                using (var db = new ApirsRepository <tblBasin>())
                {
                    try
                    {
                        Basins         = new BindableCollection <tblBasin>(db.GetModel().ToList());
                        this.allBasins = Basins;

                        if (Basins.Count == 0)
                        {
                            SelectedBasin = new tblBasin()
                            {
                                basUserIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId
                            };
                        }
                        else if (Basins.Count > 1)
                        {
                            SelectedBasin = Basins.First();
                        }
                        else
                        {
                            SelectedBasin = Basins.First();
                        }
                    }
                    catch
                    {
                        Basins         = new BindableCollection <tblBasin>();
                        this.allBasins = Basins;
                        SelectedBasin  = new tblBasin()
                        {
                            basUserIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId
                        };
                    }
                }
                using (var db = new ApirsRepository <LithostratigraphyUnion>())
                {
                    try
                    {
                        Lithostratigraphy = new BindableCollection <LithostratigraphyUnion>(db.GetCompleteLithostratigraphy().ToList());
                    }
                    catch
                    {
                        Lithostratigraphy = new BindableCollection <LithostratigraphyUnion>();
                    }
                }
            }
            catch
            {
                Basins        = new BindableCollection <tblBasin>();
                SelectedBasin = new tblBasin()
                {
                    basUserIdFk = (int)((ShellViewModel)IoC.Get <IShell>()).UserId
                };
            }
        }