DevDevOpeAccountConfigService.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Newtonsoft.Json;
  2. using Ropin.Inspection.Model.Entities;
  3. using Ropin.Inspection.Model;
  4. using Ropin.Inspection.Model.ViewModel.DEV;
  5. using Ropin.Inspection.Service.DEV.Interface;
  6. using Ropin.Inspection.Service.Interface;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Security.Claims;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using LinqKit;
  14. using Ropin.Inspection.Common;
  15. using AutoMapper;
  16. using Ropin.Inspection.Common.Accessor.Interface;
  17. using Ropin.Inspection.Repository.DEV.Interface;
  18. using Ropin.Inspection.Repository;
  19. using Ropin.Inspection.Model.ViewModel;
  20. namespace Ropin.Inspection.Service.DEV
  21. {
  22. public class DevDevOpeAccountConfigService : IDevDevOpeAccountConfigService
  23. {
  24. private readonly Idev_DevOpeAccountConfigRepository _repository;
  25. private readonly IMapper _mapper;
  26. private readonly IClaimsAccessor _claims;
  27. private readonly InspectionDbContext _sqlDBContext;
  28. private readonly ITdevDevStoreRepository _devStoreRepository;
  29. public DevDevOpeAccountConfigService(IClaimsAccessor claims, InspectionDbContext sqlDBContext, Idev_DevOpeAccountConfigRepository repository, IMapper mapper, ITdevDevStoreRepository devStoreRepository)
  30. {
  31. _repository = repository;
  32. _mapper = mapper;
  33. _claims = claims;
  34. _sqlDBContext = sqlDBContext;
  35. _devStoreRepository = devStoreRepository;
  36. }
  37. public async Task<DEV_DevOpeAccountConfigModel> GetDevOpeAccountConfigModelAsync(string devStoreCode)
  38. {
  39. var content = _repository.GetAll().Where(t=>t.C_DevStoreCode== devStoreCode).OrderByDescending(t=>t.D_CreateOn).FirstOrDefault();
  40. if (content!=null)
  41. {
  42. return _mapper.Map<TDEV_DevOpeAccountConfig, DEV_DevOpeAccountConfigModel>(content);
  43. }
  44. else
  45. {
  46. return null;
  47. }
  48. }
  49. public Task CreateOneAsync(DEV_DevOpeAccountConfigModel viewModel)
  50. {
  51. throw new NotImplementedException();
  52. }
  53. public Task DeleteAsync(Guid id)
  54. {
  55. throw new NotImplementedException();
  56. }
  57. public async Task<DEV_DevOpeAccountConfigModel> GetEntityByID(string id)
  58. {
  59. var record = await _repository.GetByConditionAsync(t => t.C_ID==id);
  60. if (record != null)
  61. {
  62. var recordDto = _mapper.Map<TDEV_DevOpeAccountConfig, DEV_DevOpeAccountConfigModel>(record.FirstOrDefault());
  63. return recordDto;
  64. }
  65. return null;
  66. }
  67. public async Task<DEV_DevOpeAccountConfigModel> GetByIdAsync(Guid id)
  68. {
  69. throw new NotImplementedException();
  70. }
  71. public Task<bool> IsExistAsync(Guid id)
  72. {
  73. throw new NotImplementedException();
  74. }
  75. public Task<int> UpdateOneAsync(DEV_DevOpeAccountConfigModel viewModel, params string[] fields)
  76. {
  77. throw new NotImplementedException();
  78. }
  79. }
  80. }