//using CMSDAL.DTO.Block; //using CMSDAL.Query.Block; //using GB5Shared.DTO.Framework.Criteria; //using GB5Shared.DTO.Framework.Login; //using GB5Shared.QueryExecutor; //using GB5Shared.Resource.Response; //using GB5Shared.ResponseStandard; //using GB5Shared.Validation; //using Newtonsoft.Json; //using System; //using System.Collections.Generic; //using System.Threading.Tasks; //namespace CMSDAL.CustomCode.Block //{ // public class BlockDAL : IBlockDAL // { // private readonly IQueryExecutor _QueryExecutor; // private readonly IValidation _Validation; // public BlockDAL(IQueryExecutor QueryExecutor, IValidation Validation) // { // _QueryExecutor = QueryExecutor; // _Validation = Validation; // } // public async Task GetBlock(int BlockId, LoginDTO LoginDTO) // { // string json = ""; // try // { // string Sql = BlockQB.GET_BLOCK; // var Parameters = new { BlockId = BlockId }; // BlockDTO BlockDTO = await _QueryExecutor.QuerySingleAsync(LoginDTO, Sql, Parameters); // return JsonConvert.SerializeObject(BlockDTO); // } // catch (Exception) // { // throw; // } // finally // { // json = null; // } // } // public async Task GetSelectListBlock(int FirstNumber, int MaxResult, CriteriaDTO CriteriaDTO, LoginDTO LoginDTO, bool IsCount = false) // { // try // { // string Json = ""; // if (!IsCount) // { // string Sql = BlockQB.GET_SELECTLIST_BLOCK; // var Parameters = new // { // firstnumber = FirstNumber, // maxresult = MaxResult // }; // IEnumerable BlockDTO = // await _QueryExecutor.QueryAsync(LoginDTO, Sql, Parameters); // Json = JsonConvert.SerializeObject(BlockDTO); // } // else // { // int Count = 0; // Json = Count.ToString(); // } // return Json; // } // catch (Exception) // { // throw; // } // } // public async Task SaveBlock(BlockDTO BlockDTO, LoginDTO LoginDTO) // { // try // { // string Sql = BlockQB.SAVE_BLOCK; // return await _QueryExecutor.ExecuteAsync(LoginDTO, Sql, BlockDTO); // } // catch (Exception ex) // { // string Error = await _Validation.HandleException(ex, $"{ErrorResponse.SaveErrorMessage}"); // throw new Exception(Error); // } // } // public async Task UpdateBlock(BlockDTO BlockDTO, LoginDTO LoginDTO) // { // try // { // string Sql = BlockQB.UPDATE_BLOCK; // return await _QueryExecutor.ExecuteAsync(LoginDTO, Sql, BlockDTO); // } // catch (Exception ex) // { // string Error = await _Validation.HandleException(ex, $"{ErrorResponse.UpdateErrorMessage}"); // throw new Exception(Error); // } // } // public async Task DeleteBlock(int BlockId, LoginDTO LoginDTO) // { // try // { // string Sql = BlockQB.DELETE_BLOCK; // var Parameters = new // { // BlockId = BlockId // }; // int result = await _QueryExecutor.ExecuteAsync(LoginDTO, Sql, Parameters); // if (result > 0) // { // return $"{SuccessResponse.DeleteSuccessMessage}"; // } // else // { // return $"{ErrorResponse.DeleteNotFoundMessage}"; // } // } // catch (Exception ex) // { // string Error = await _Validation.HandleException(ex, $"{ErrorResponse.DeleteErrorMessage}"); // throw new Exception(Error); // } // } // }}