Exemplo n.º 1
0
        public bool Save(ISaveable aSauver)
        {
            string docId = $"{aSauver.Table}_{Guid.NewGuid()}";

            ITechnicalKey technicalKey = aSauver as ITechnicalKey;

            if (technicalKey == null)
            {
                return(false);
            }

            MutableDocument document = null;

            if (string.IsNullOrEmpty(technicalKey.Id))
            {
                technicalKey.Id = docId;
            }
            else
            {
                document = _dbConfigurationGetter.Get().GetDocument(technicalKey.Id).ToMutable();
            }

            MutableDictionaryObject dico = aSauver.DocumentInitialize();

            document = dico.ToDocument(docId, document);

            _dbConfigurationGetter.Get().Save(document);

            return(true);
        }
Exemplo n.º 2
0
        public void Delete(DefaultVendeur defaultVendeur)
        {
            Document document = _dbConfigurationGetter.Get().GetDocument(defaultVendeur.Id);

            if (document != null)
            {
                _dbConfigurationGetter.Get().Delete(document);
            }
        }
Exemplo n.º 3
0
        public List <SynchroEx> Gets()
        {
            IQuery query = QueryBuilder.Select(SelectResult.All())
                           .From(DataSource.Database(_dbConfigurationGetter.Get()))
                           .Where(Expression.Property("table").EqualTo(Expression.String("synchroex")))
                           .OrderBy(Ordering.Property("dateException").Descending())
                           .Limit(Expression.Int(150));

            var rows = query.Execute();

            return(rows.Select(r => r.GetDictionary(0).ToMutable().ToSynchroEx()).ToList());
        }
Exemplo n.º 4
0
        public Server Get()
        {
            IQuery query = QueryBuilder.Select(SelectResult.All())
                           .From(DataSource.Database(_dbConfigurationGetter.Get()))
                           .Where(Expression.Property("table").EqualTo(Expression.String("server")));


            var rows = query.Execute().ToList();

            if (rows.Count() == 0)
            {
                return(null);
            }

            return(rows.Select(r => r.GetDictionary(0).ToMutable().ToServer()).FirstOrDefault());
        }