public static async Task <RopDataSaved[]> DataSaved()
        {
            var listTasks = new List <Task <IRopLoader> >();

            using (var rep = new RepositoryLiteDb <RopDataSaved>())
            {
                var data = rep.RetrieveData();
                if (data != null)
                {
                    var arrData = data.ToArray();

                    return(arrData);
                }
            }
            return(null);
        }
Beispiel #2
0
        public static async Task <Judet[]> Judete()
        {
            if (judFinderCache != null)
            {
                return(judFinderCache.judete);
            }
            using (var rep = new RepositoryLiteDb <Judet>())
            {
                var exists = rep.ExistsData();
                if (!exists)
                {
                    Console.WriteLine("save judete to local");
                    var sl  = new SirutaLoader();
                    var jud = (await sl.InitJudete()).ToArray();
                    var ms  = await rep.StoreDataAsNew(jud);
                }

                Console.WriteLine("get data from local");
                return(rep.RetrieveData().ToArray());
            }
        }
Beispiel #3
0
        public async Task <RopDocument[]> GetData()
        {
            var type = this.GetType().FullName;

            using (var rep = new RepositoryLiteDb <RopDocument>(type))
            {
                var exists = rep.ExistsData();
                if (!exists)
                {
                    var rd = await FillDate();

                    var notId = rd.FirstOrDefault(it => string.IsNullOrWhiteSpace(it.ID));
                    if (notId != null)
                    {
                        throw new ArgumentException("not id for" + notId.Name + "-- " + notId.PathDocument);
                    }
                    await rep.StoreDataAsNew(rd);
                }

                var data = rep.RetrieveData();
                return(data.ToArray());
            }
        }