public List <Commune> Gets(string critereVille, int limit) { IQuery query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where ( Expression.Property("table").EqualTo(Expression.String("commune")) .And(Function.Upper(Expression.Property("libelle")).Like(Expression.String($"{critereVille.ToUpper()}%"))) ) .OrderBy(Ordering.Property("libelle").Ascending()) .Limit(Expression.Int(limit)); var rows = query.Execute(); if (rows.Count() == 0) { List <Commune> communes = new List <Commune> { new Commune() { Num = 1, Libelle = LIBELLE_TEST, CodePostal = CP_TEST, PayCode = PAYCODE_TEST } }; return(communes); } rows = query.Execute(); return(rows.Select(r => r.GetDictionary(0).ToMutable().ToCommune()).ToList()); }
public List <FuturAcquereur> Gets() { IQuery query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("futuracquereur"))); var rows = query.Execute(); return(rows.Select(r => r.GetDictionary(0).ToMutable().ToFuturAcquereur()).ToList()); }
public List <Lot> Gets(long?pgrNum) { IQuery query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("lot")).And(Expression.Property("pgrNum").EqualTo(Expression.Long(pgrNum ?? 0)))); var rows = query.Execute(); return(rows.Select(r => r.GetDictionary(0).ToMutable().ToLot()).OrderBy(l => l.Code).OrderBy(l => Regex.IsMatch(l.Code, @"^\d+$") ? Convert.ToInt32(l.Code):0).ToList()); }
public List <Option> Gets() { IQuery query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("option")) .And(Expression.Property("actif").EqualTo(Expression.Boolean(true)))); var rows = query.Execute(); return(rows.Select(r => r.GetDictionary(0).ToMutable().ToOption()).ToList()); }
private void Connect() { Uri target = new Uri($"{_serverInfo.UrlServer}"); ReplicatorConfiguration replicationConfig = new ReplicatorConfiguration(_dataBaseGetter.Get(), target); replicationConfig.Continuous = true; replicationConfig.ReplicatorType = ReplicatorType.PushAndPull; replicationConfig.Authenticator = new BasicAuthenticator(_serverInfo.Login, _serverInfo.Password); _replicator = new Replicator(replicationConfig); _replicator.Start(); _token = _replicator.AddChangeListener(_replicator_StatusChanged); }
public bool Save(ISaveable aSauver) { string docId = $"{aSauver.Table}_{Guid.NewGuid()}"; ITechnicalKey technicalKey = aSauver as ITechnicalKey; IDateable dateable = aSauver as IDateable; if (technicalKey == null || dateable == null) { return(false); } MutableDocument document = null; if (string.IsNullOrEmpty(technicalKey.Id)) { technicalKey.Id = docId; dateable.DateCreation = DateTime.Now; } else { if (dateable.DateCreation == DateTime.MinValue) { dateable.DateCreation = DateTime.Now; } dateable.DateModif = DateTime.Now; document = _dataBaseGiver.Get().GetDocument(technicalKey.Id).ToMutable(); } MutableDictionaryObject dico = aSauver.DocumentInitialize(); document = dico.ToDocument(docId, document); _dataBaseGiver.Get().Save(document); return(true); }
public List <Constructeur> Gets(string critere, int limit) { IQuery query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where ( Expression.Property("table").EqualTo(Expression.String("constructeur")) .And(Function.Upper(Expression.Property("nom")).Like(Expression.String($"{critere.ToUpper()}%"))) .And(Expression.Property("actif").EqualTo(Expression.Int(1))) ) .OrderBy(Ordering.Property("nom").Ascending()) .Limit(Expression.Int(limit)); var rows = query.Execute(); return(rows.Select(r => r.GetDictionary(0).ToMutable().ToConstructeur()).ToList()); }
public string Resume() { IQuery query = Query.Select(SelectResult.Expression(Expression.Property("payCode"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo("pays")); var rows = query.Execute(); query = Query.Select(SelectResult.Expression(Expression.Property("finCode"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo("typefinancement")); var rowsFin = query.Execute(); query = Query.Select(SelectResult.Expression(Expression.Property("sfaCode"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo("situationfamille")); var rowsSit = query.Execute(); query = Query.Select(SelectResult.Expression(Expression.Property("Num"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo("commune")); var rowsCom = query.Execute(); query = Query.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo("futuracquereur")); var rowsAq = query.Execute(); return($"{clic++} : Pays={rows.Count}, Financement={rowsFin.Count}, Situation Familiale={rowsSit.Count}, Commune={rowsCom.Count}, Futur Acq={rowsAq.Count}"); }
public List <Information> Gets() { List <Information> informations = new List <Information>(); IQuery query = QueryBuilder.Select(SelectResult.Expression(Expression.Property("payCode"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("pays"))); var rows = query.Execute(); query = QueryBuilder.Select(SelectResult.Expression(Expression.Property("finCode"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("typefinancement"))); var rowsFin = query.Execute(); query = QueryBuilder.Select(SelectResult.Expression(Expression.Property("sfaCode"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("situationfamille"))); var rowsSit = query.Execute(); query = QueryBuilder.Select(SelectResult.Expression(Expression.Property("Num"))) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("commune"))); var rowsCom = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("futuracquereur"))); var rowsAq = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("programme"))); var rowsProg = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("lot"))); var rowsLot = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("vendeur"))); var rowsVdr = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("constructeur"))); var rowsCtr = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("civilite"))); var rowsCiv = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("reservation"))); var rowsRes = query.Execute(); query = QueryBuilder.Select(SelectResult.All()) .From(DataSource.Database(_dataBaseGetter.Get())) .Where(Expression.Property("table").EqualTo(Expression.String("option"))); var rowsOpt = query.Execute(); informations.Add(new Information() { Info = "Civilités", Quantite = rowsCiv.Count() }); informations.Add(new Information() { Info = "Communes", Quantite = rowsCom.Count() }); informations.Add(new Information() { Info = "Constructeurs", Quantite = rowsCtr.Count() }); informations.Add(new Information() { Info = "Futurs Acquéreurs", Quantite = rowsAq.Count() }); informations.Add(new Information() { Info = "Lots", Quantite = rowsLot.Count() }); informations.Add(new Information() { Info = "Options", Quantite = rowsOpt.Count() }); informations.Add(new Information() { Info = "Pays", Quantite = rows.Count() }); informations.Add(new Information() { Info = "Programmes", Quantite = rowsProg.Count() }); informations.Add(new Information() { Info = "Réservations", Quantite = rowsRes.Count() }); informations.Add(new Information() { Info = "Situations Familiales", Quantite = rowsSit.Count() }); informations.Add(new Information() { Info = "Types de financements", Quantite = rowsFin.Count() }); informations.Add(new Information() { Info = "Vendeurs", Quantite = rowsVdr.Count() }); return(informations); }
private void Connect() { try { if (_serverInfo == null) { _serverInfo = _serverDal.Get(); } if (_serverInfo == null) { return; } Uri target = new Uri($"ws://{_serverInfo.UrlServer}"); IEndpoint endpoint = new URLEndpoint(target); ReplicatorConfiguration replicationConfig = new ReplicatorConfiguration(_dataBaseGetter.Get(), endpoint) { Continuous = true, ReplicatorType = ReplicatorType.PushAndPull, Authenticator = new BasicAuthenticator(_serverInfo.Login, _serverInfo.Password) }; _replicator = new Replicator(replicationConfig); if (CrossConnectivity.IsSupported && CrossConnectivity.Current.IsConnected) { _replicator.Start(); } _token = _replicator.AddChangeListener(_replicator_StatusChanged); } catch (Exception e) { #if DEBUG #endif } }