Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Globalization;
- using System.Linq;
- using BussinesFacade.DataBase;
- using BussinesFacade.Interfaces;
- using BussinesFacade.Models;
- namespace BussinesFacade.Properties
- {
- public class PlsService : IMavtService
- {
- private readonly IExecutor _oracleExecutor;
- public PlsService(IExecutor oracleExecutor)
- {
- _oracleExecutor = oracleExecutor;
- }
- public List<ComputerModel.Computer> GetComputers()
- {
- var query =
- @"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
- from external.egais_es_pos_list b, subject_address a, subject s
- where b.fsrar_id=a.egais_id and a.subj_id=s.ID
- 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
- order by s.Name";
- var computersData = _oracleExecutor.ExecuteQuery(query);
- if (computersData == null)
- return null;
- return (from comp in computersData.AsEnumerable()
- select new ComputerModel.Computer
- {
- Org = comp.Field<string>("Org"),
- Kpp = comp.Field<string>("Kpp"),
- City = comp.Field<string>("City"),
- Address = comp.Field<string>("Adr"),
- IP = comp.Field<string>("Ip"),
- FNdate = comp.Field<DateTime?>("Fn"),
- UTMGostDate = comp.Field<DateTime?>("Gost"),
- UTMPkiDate = comp.Field<DateTime?>("Pki")
- }).ToList();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement