Exemplo n.º 1
0
        static public void Start()
        {
            if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("EVO_DBMIGRATION_FLAG")))
            {
                return;
            }

            _Notices = new Dictionary <string, OpsNotice>();

            Task.Run(async() =>
            {
                while (true)
                {
                    try
                    {
                        using (var commonDB1 = DbContextFactory.CreateCommon1())
                        {
                            var dict = new Dictionary <string, OpsNotice>();
                            var now  = DateTime.UtcNow;
                            var list = await commonDB1.OpsNotices.ToListAsync();

                            list.ForEach(rec =>
                            {
                                if (!rec.release)
                                {
                                    return;
                                }

                                if ((now < rec.beginDate || rec.endDate < now))
                                {
                                    return;
                                }

                                dict[NoticeCoded(rec)] = rec;
                            });

                            _Notices = dict;
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    await Task.Delay(10000);
                }
            });
        }
Exemplo n.º 2
0
        static public void Start()
        {
            if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("EVO_DBMIGRATION_FLAG")))
            {
                return;
            }

            CheckItems = new List <CheckItem>();

            Task.Run(async() =>
            {
                while (true)
                {
                    try
                    {
                        var list = new List <CheckItem>();

                        using (var commonDB1 = DbContextFactory.CreateCommon1())
                        {
                            var all = await commonDB1.EnabledVersions.ToListAsync();

                            foreach (var r in all)
                            {
                                list.Add(new CheckItem
                                {
                                    checkTarget  = r.checkTarget,
                                    referenceSrc = r.referenceSrc,
                                    //version = new Version( r.major, r.minor, r.patch, r.build ),
                                    array = new int[] { r.major, r.minor, r.patch, r.build },
                                    value = Valued(r.referenceSrc, new int[] { r.major, r.minor, r.patch, r.build }),
                                });
                            }
                        }

                        CheckItems = list;
                    }
                    catch (Exception ex)
                    {
                    }

                    await Task.Delay(10000);
                }
            });
        }