42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Kreta.DataAccessManual.Interfaces;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Kreta.EESZTInterface.Processors
|
|
{
|
|
public class TAJProcessor
|
|
{
|
|
private readonly List<string> tajSzamok = new List<string>();
|
|
|
|
public void AddFileContent(byte[] bytes)
|
|
{
|
|
var tempTajSzamok = Encoding.ASCII.GetString(bytes).Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim("\",".ToCharArray())).ToList();
|
|
if (tempTajSzamok[0].Contains("TAJ"))
|
|
{
|
|
tempTajSzamok.RemoveAt(0);
|
|
}
|
|
tajSzamok.AddRange(tempTajSzamok);
|
|
}
|
|
|
|
public (int fertozott, int marNemFertozott) UpdateDB(IDalHandler h, int tanevId)
|
|
{
|
|
var tajszamokJson = JsonConvert.SerializeObject(tajSzamok.Distinct().ToArray());
|
|
var felhasznaloDal = h.Felhasznalo();
|
|
var ds = felhasznaloDal.UpdateFelhasznalokCovidAdatok(tanevId, tajszamokJson);
|
|
|
|
if ((ds.Tables.Count < 1)
|
|
|| (ds.Tables[0].Rows.Count < 1))
|
|
{
|
|
return (-1, -1);
|
|
}
|
|
var fertozott = ds.Tables[0].Rows[0].Field<int>("Fertozott");
|
|
var marNemFertozott = ds.Tables[0].Rows[0].Field<int>("MarNemFertozott");
|
|
|
|
return (fertozott, marNemFertozott);
|
|
}
|
|
}
|
|
}
|