Пример #1
0
        private static void DeleteShinglesContainingCompany()
        {
            var ctx = new Db();
            var arr = ctx.Shingles.Where(x => x.kind == ShingleKind.newShingle).Take(1000).ToList();

            while (arr.Count > 0)
            {
                foreach (var sh in arr)
                {
                    if (ShingleLogic.ContainsCompanyName(sh, ctx))
                    {
                        ShingleLogic.SetShingleContainCompany(sh, ctx);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.Write(sh.ID);
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine(" " + sh.text);
                    }
                    else
                    {
                        var sh2 = ctx.Shingles.Find(sh.ID);
                        if (sh2 == null)
                        {
                            continue;
                        }
                        if (sh2.ID < 2667191)
                        {
                            sh2.kind = ShingleKind.interesting;
                        }
                        else
                        {
                            ShingleLogic.SetShingleKind(sh2, ctx);
                        }
                    }
                    ctx.SaveChanges();
                    ctx.Dispose();
                    ctx = new Db();
                }
                arr = ctx.Shingles.Where(x => x.kind == ShingleKind.newShingle).Take(1000).ToList();
            }
        }
Пример #2
0
        private static void ProcessShingles()
        {
            var ctx = new Db();

            Shingle s;

            while ((s = ctx.Shingles.FirstOrDefault(x => x.kind == ShingleKind.newShingle)) != null)
            {
                ShingleLogic.SetShingleKind(s, ctx);
                //Console.ForegroundColor = (ConsoleColor)s.kind;

                switch (s.kind)
                {
                case ShingleKind.common: Console.ForegroundColor = ConsoleColor.White; break;

                case ShingleKind.ticker: Console.ForegroundColor = ConsoleColor.Yellow; break;

                case ShingleKind.CEO: Console.ForegroundColor = ConsoleColor.Cyan; break;

                case ShingleKind.companyName: Console.ForegroundColor = ConsoleColor.Green; break;

                case ShingleKind.currencyPair: Console.ForegroundColor = ConsoleColor.Red; break;

                case ShingleKind.containCommon: Console.ForegroundColor = ConsoleColor.DarkYellow; break;

                case ShingleKind.containTicker: Console.ForegroundColor = ConsoleColor.DarkYellow; break;

                case ShingleKind.upperCase: Console.ForegroundColor = ConsoleColor.Magenta; break;
                }
                Console.Write(s.kind + " " + s.ID);
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.WriteLine(" " + s.text);
                ctx.SaveChanges();
                ctx.Dispose();
                ctx = new Db();
            }
        }