public JsonNetResult VacationBunch(BaseSearchParameters parameters) { var query = new SearchVacations(parameters); var results = Query(query); return Json(new { Items = results, Skipped = parameters.Skip, TotalResults = query.Stats.TotalResults }); }
public JsonNetResult EmployeeFileBatch(BaseSearchParameters parameters) { var query = new SearchEmployeeFiles(parameters); var results = Query(query); return Json(new { Items = results, Skipped = parameters.Skip, TotalResults = query.Stats.TotalResults }); }
public JsonNetResult AbsenceBunch(int year, BaseSearchParameters parameters) { //TODO: return abscence data var query = new SearchAbsences(parameters) { From = new DateTime(year, 1, 1), To = new DateTime(year, 12, 31) }; var results = Query(query); return Json(new { Items = results, Skipped = parameters.Skip, TotalResults = query.Stats.TotalResults }); }
public JsonNetResult VacationBunch(BaseSearchParameters parameters) { var query = new SearchVacations(parameters); var results = Query(query); return(Json(new { Items = results, Skipped = parameters.Skip, TotalResults = query.Stats.TotalResults })); }
public JsonNetResult EmployeeFileBatch(BaseSearchParameters parameters) { var query = new SearchEmployeeFiles(parameters); var results = Query(query); return(Json(new { Items = results, Skipped = parameters.Skip, TotalResults = query.Stats.TotalResults })); }
/// <summary> /// Constructs WHERE clause in given sql statement based on provided <see cref="BaseSearchParameters"/> /// </summary> /// <param name="sql">The sql statement before appending WHERE clause</param> /// <param name="parameters"><see cref="BaseSearchParameters"/> to append to WHERE clause</param> /// <returns>Updated sql query with additional WHERE clause</returns> public virtual string BuildWhereClause(string sql, BaseSearchParameters parameters) { StringBuilder sb = new StringBuilder(sql); sb.Append(" WHERE "); if (!(string.IsNullOrWhiteSpace(parameters.Id))) { sb.Append("[Id] = @Id"); } return(sb.ToString()); }
/// <summary> /// Implements <see cref="IDataRepository{TResource}.Find(BaseSearchParameters)"/> /// </summary> public async Task <IEnumerable <TResource> > Find(BaseSearchParameters parameters) { using (var connection = new SqlConnection(_connectionConfiguration.GetConnectionString())) { try { var results = await connection.QueryAsync <TResource>(_tableConfiguration.BuildWhereClause(_tableConfiguration.Find, parameters), parameters); return(results); } catch { throw; } } }
public JsonNetResult AbsenceBunch(int year, BaseSearchParameters parameters) { //TODO: return abscence data var query = new SearchAbsences(parameters) { From = new DateTime(year, 1, 1), To = new DateTime(year, 12, 31) }; var results = Query(query); return(Json(new { Items = results, Skipped = parameters.Skip, TotalResults = query.Stats.TotalResults })); }
/// <summary> /// override of <see cref="BaseTableConfiguration.BuildWhereClause(string, BaseSearchParameters)"/> /// </summary> /// <remarks>calls base method to get WHERE and optionally add <see cref="BaseResource.Id"/> as parameter /// also adds optional <see cref="UserResource.Email"/></remarks> public override string BuildWhereClause(string sql, BaseSearchParameters parameters) { if (!(parameters is UserSearchParameters userSearchParameters)) { throw new ArgumentException("Invalid parameter search type"); } StringBuilder sb = new StringBuilder(sql); sb.Append(" WHERE "); if (!(string.IsNullOrWhiteSpace(userSearchParameters.Email))) { sb.Append("[Email] = @Email"); } return(sb.ToString()); }
public SearchAbsences(BaseSearchParameters parameters) { Parameters = parameters; }
public SearchVacations(BaseSearchParameters parameters) { Parameters = parameters; }
public SearchEmployeeFiles(BaseSearchParameters parameters) { Parameters = parameters; }
/// <summary> /// No search parameters are needed at the moment /// </summary> public override string BuildWhereClause(string sql, BaseSearchParameters parameters) => sql;