Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Globalization;
  5. using System.Linq;
  6. using BussinesFacade.DataBase;
  7. using BussinesFacade.Interfaces;
  8. using BussinesFacade.Models;
  9.  
  10. namespace BussinesFacade.Properties
  11. {
  12. public class PlsService : IMavtService
  13. {
  14. private readonly IExecutor _oracleExecutor;
  15.  
  16. public PlsService(IExecutor oracleExecutor)
  17. {
  18. _oracleExecutor = oracleExecutor;
  19. }
  20.  
  21. public List<ComputerModel.Computer> GetComputers()
  22. {
  23. var query =
  24. @"select s.Name as Org, Kpp, a.Inhabit_place as City, a.Avenue ||',' ||a.House_No as Adr, substr(ip, instr(ip, ',',-1)+2) as Ip,utm_gost_date as gost, utm_pki_date as Pki, fn_date as Fn
  25. from external.egais_es_pos_list b, subject_address a, subject s
  26. where b.fsrar_id=a.egais_id and a.subj_id=s.ID
  27. group by s.Name, kpp, a.Inhabit_place, a.Avenue ||',' ||a.House_No, substr(ip, instr(ip, ',',-1)+2), utm_gost_date, utm_gost_date, utm_pki_date, fn_date
  28. order by s.Name";
  29.  
  30. var computersData = _oracleExecutor.ExecuteQuery(query);
  31.  
  32. if (computersData == null)
  33. return null;
  34.  
  35. return (from comp in computersData.AsEnumerable()
  36. select new ComputerModel.Computer
  37. {
  38. Org = comp.Field<string>("Org"),
  39. Kpp = comp.Field<string>("Kpp"),
  40. City = comp.Field<string>("City"),
  41. Address = comp.Field<string>("Adr"),
  42. IP = comp.Field<string>("Ip"),
  43. FNdate = comp.Field<DateTime?>("Fn"),
  44. UTMGostDate = comp.Field<DateTime?>("Gost"),
  45. UTMPkiDate = comp.Field<DateTime?>("Pki")
  46. }).ToList();
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement