public void SaveTweets(PostTwitter postTwitter)
        {
            contextDB = new ContextDB();

            try
            {
                using (CrawlerDB crawlerDB = new CrawlerDB())
                {
                    contextDB.ConfigureContext(crawlerDB);

                    if (postTwitter != null)
                    {
                        crawlerDB.PostTwitters.Add(postTwitter);
                        crawlerDB.SaveChangesAsync();
                    }
                }
            }

            catch (Exception exception)
            {
                throw exception;
            }

            finally
            {
                contextDB = null;
            }
        }
        public IEnumerable<PostTwitter> GetAll()
        {
            contextDB = new ContextDB();

            try
            {
                using (var crawlerDB = new CrawlerDB())
                {
                    contextDB.ConfigureContext(crawlerDB);
                    var tweets =
                        crawlerDB.PostTwitters.Include(p => p.Categoria)
                            .Include(p => p.Estado)
                            .AsNoTracking()
                            .OrderBy(e => e.Estado.Nome)
                            .ToList();

                    return tweets;
                }
            }

            catch (Exception exception)
            {
                throw exception;
            }

            finally
            {
                contextDB = null;
            }
            
        }
        public List<int> GetTotalByDate(string categoria, DateTime dataInicio, DateTime dataFim, string estado)
        {
            contextDB = new ContextDB();

            try
            {
                using (CrawlerDB crawlerDB = new CrawlerDB())
                {
                    contextDB.ConfigureContext(crawlerDB);

                    return
                        crawlerDB.PostTwitters.Include(c => c.Categoria)
                            .Include(e => e.Estado)
                            .AsNoTracking()
                            .AsEnumerable()
                            .Where(
                                p =>
                                    p.Categoria.Nome == categoria && p.Estado.Nome == estado && p.Data >= dataInicio &&
                                    p.Data <= dataFim)
                            .GroupBy(p => new {p.Data, p.Estado.Sigla, p.Categoria.Nome})
                            .OrderBy(p => p.Key.Data)
                            .Distinct()
                            .Select(p => p.Count())
                            .ToList();
                }

            }
            catch (Exception exception)
            {
                throw exception;
            }

            finally
            {
                contextDB = null;
            }
        }
 public MessageService(IContextDB contextDB)
 {
     _contextDB = contextDB;
 }
Exemple #5
0
 public ClienteService(IContextDB contextDB, IMemoryCache memoryCache)
 {
     _contextDB   = contextDB;
     _memoryCache = memoryCache;
 }
 public EmployeeRepositorio(IContextDB unitOfWork) : base(unitOfWork)
 {
 }
 public DocumentTypeRepositorio(IContextDB unitOfWork) : base(unitOfWork)
 {
 }
 public AreaRepositorio(IContextDB unitOfWork) : base(unitOfWork)
 {
 }
 public ProviderRepositorio(IContextDB unitOfWork) : base(unitOfWork)
 {
 }
Exemple #10
0
 public ClientRepositorio(IContextDB unitOfWork) : base(unitOfWork)
 {
 }
        public static void ServiceTest()
        {
            ContextCreator creator = new ContextCreator(conStr);
            context = creator.CreateContext();
            persones = context.CreateRepository<Person>();
            relationships = context.CreateRepository<Relationship>();

            using (ServiceHostForRIS host = new ServiceHostForRIS(typeof(RISI.RelativesInfoService), creator))
            {
                host.Open();
                Console.WriteLine("Service ready...");
                Console.WriteLine("Start TestGetPersonInfo");
                Console.WriteLine("XML");
                dataFormat = "xml";
                TestGetPersonInfo();
                Console.WriteLine("JSON");
                dataFormat = "json";
                TestGetPersonInfo();
                Console.WriteLine();
                Console.WriteLine("Start TestGetRelativesList");
                Console.WriteLine("XML");
                dataFormat = "xml";
                TestGetRelativesList();
                Console.WriteLine("JSON");
                dataFormat = "json";
                TestGetRelativesList();
                Console.WriteLine();
                Console.WriteLine("Start TestAddRelative");
                TestAddRelative();
                Console.WriteLine();
                Console.WriteLine("Start TestUpdateRelative");
                TestUpdateRelative();
                Console.WriteLine();
                Console.WriteLine("Start TestUpdateRelationshipState");
                TestUpdateRelationshipState();
                Console.WriteLine();
                Console.WriteLine("Start TestDeleteRelative");
                TestDeleteRelative();
                host.Close();
            };
        }
Exemple #12
0
 public PaisService(IContextDB contextDB)
 {
     _contextDB = contextDB;
 }
Exemple #13
0
 public LogRepository(IContextDB context)
 {
     _db = context;
 }