Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="q"></param>
 /// <param name="orderBy"></param>
 /// <param name="pageSize"></param>
 /// <param name="pageToken"></param>
 /// <param name="log"></param>
 /// <returns></returns>
 internal IDbQuery QuerySelectCommunities(
     string q, string orderBy, int?pageSize = null, string pageToken = null,
     IBdoLog log = null)
 {
     return(this.UseQuery("GetCommunityWithCode", p =>
                          DbFluent.SelectQuery(Table <DbCommunity>("community"))
                          .From(
                              DbFluent.TableAsJoin(DbQueryJoinKind.Left, Table("RegionalDirectorate"),
                                                   JoinCondition("Community_RegionalDirectorate")))
                          .WithFields(Tuple("SelectCommunity"))
                          .Filter(
                              q,
                              DbApiFluent.CreateFilterDefinition(
                                  DbApiFluent.CreateFilterClause("startDate", Field <DbCommunity>(p => p.CreationDate), DataOperators.GreaterOrEqual),
                                  DbApiFluent.CreateFilterClause("endDate", Field <DbCommunity>(p => p.LastModificationDate), DataOperators.LesserOrEqual),
                                  DbApiFluent.CreateFilterClause("code", Field <DbCommunity>(p => p.Code), DataOperators.Equal)),
                              log)
                          .Sort(
                              orderBy,
                              DbApiFluent.CreateSortDefinition(
                                  DbApiFluent.CreateSortClause("startDate", Field <DbCommunity>(p => p.CreationDate)),
                                  DbApiFluent.CreateSortClause("endDate", Field <DbCommunity>(p => p.LastModificationDate)),
                                  DbApiFluent.CreateSortClause("code", Field <DbCommunity>(p => p.Code))),
                              log)));
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="q"></param>
 /// <param name="orderBy"></param>
 /// <param name="pageSize"></param>
 /// <param name="pageToken"></param>
 /// <param name="log"></param>
 /// <returns></returns>
 internal IDbQuery ListEmployees1(
     string q, string orderBy, int?pageSize = null, string pageToken = null,
     IBdoLog log = null)
 => DbFluent.SelectQuery("GetMyTables", DbFluent.Table())
 .WithLimit(100)
 .AsDistinct()
 .WithFields(
     DbFluent.FieldAsAll(DbFluent.Table("table")),
     DbFluent.Field("Field1", DbFluent.Table("table")),
     DbFluent.Field("Field2", DbFluent.Table("table")))
 .From(
     DbFluent.Table(nameof(DbRegionalDirectorate).Substring(2), "schema1").WithAlias("table"),
     DbFluent.TableAsJoin(
         DbQueryJoinKind.Left,
         DbFluent.Table("DbTable1".Substring(2), "schema2").WithAlias("table1"),
         DbFluent.And(
             DbFluent.Eq(
                 DbFluent.Field("table1key", DbFluent.Table("table1")),
                 DbFluent.Field(nameof(DbRegionalDirectorate.Code), DbFluent.Table("table"))),
             DbFluent.Eq(
                 DbFluent.Field("table2key", DbFluent.Table("table2")),
                 DbFluent.Field(nameof(DbRegionalDirectorate.LabelEN), DbFluent.Table("table"))))),
     DbFluent.TableAsJoin(
         DbQueryJoinKind.Left,
         DbFluent.Table("DbTable1".Substring(2), "schema2").WithAlias("table2"),
         DbFluent.Eq(
             DbFluent.Field("table1key", DbFluent.Table("table2")),
             DbFluent.Field("Field1", DbFluent.Table("table"))))
     )
 .Filter(
     q,
     DbApiFluent.CreateFilterDefinition(
         DbApiFluent.CreateFilterClause("startDate", DbFluent.Field("CreationDate", DbFluent.Table("table")), DataOperators.GreaterOrEqual),
         DbApiFluent.CreateFilterClause("endDate", DbFluent.Field("LastModificationDate", DbFluent.Table("table")), DataOperators.LesserOrEqual),
         DbApiFluent.CreateFilterClause("code", DbFluent.Field("Code", DbFluent.Table("table")), DataOperators.Equal)),
     log)
 .Sort(
     orderBy,
     DbApiFluent.CreateSortDefinition(
         DbApiFluent.CreateSortClause("startDate", DbFluent.Field("CreationDate", DbFluent.Table("table"))),
         DbApiFluent.CreateSortClause("endDate", DbFluent.Field("LastModificationDate", DbFluent.Table("table"))),
         DbApiFluent.CreateSortClause("code", DbFluent.Field("Code", DbFluent.Table("table")))),
     log);