using System; using System.Linq; using System.Threading.Tasks; using CRMDAL.DTO.Solution; using CRMDAL.Query.Solution; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using Newtonsoft.Json; namespace CRMDAL.CustomCode.Solution { public class SolutionDAL : ISolutionDAL { private readonly IQueryExecutor _QueryExecutor; public SolutionDAL( IQueryExecutor QueryExecutor) { _QueryExecutor = QueryExecutor; } public async Task GetSelectListSolution( int FirstNumber, int MaxResult, CriteriaDTO CriteriaDTO, LoginDTO LoginDTO, bool isCount = false) { try { string json = ""; if (!isCount) { string SQL = SolutionQB.GET_SOLUTION_SELECTLIST; var parameters = new { firstnumber = FirstNumber, maxresult = MaxResult }; var Result = (await _QueryExecutor.QueryAsync( LoginDTO, SQL, parameters)).ToList(); json = JsonConvert.SerializeObject(Result); } else { int count = 0; json = count.ToString(); } return json; } catch (Exception) { throw; } } } }