This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using MedsProcessor.Common.Models; | |
using static MedsProcessor.Common.Constants; | |
namespace MedsProcessor.Downloader | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
class Program | |
{ | |
static void Main() => new Program().Run().Wait(); | |
async Task Run() | |
{ | |
Console.WriteLine("Before Using"); | |
await Async.Using(new Test(), t => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "981ebd64-1685-4a11-905e-699dfd2b2adc", | |
"name": "My Visual Studio extensions", | |
"description": "A collection of my Visual Studio extensions", | |
"version": "1.0", | |
"extensions": [ | |
{ | |
"name": ".NET Compiler Platform SDK", | |
"vsixId": "3a012d4e-6057-4e7c-8123-6d4be1d4723c" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using MedsProcessor.Common.Models; | |
using MedsProcessor.Downloader; | |
using MedsProcessor.Parser; | |
using MedsProcessor.Scraper; | |
using Microsoft.AspNetCore.Mvc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MedsProcessor.Common.Extensions | |
{ | |
public static class EnumExtensions | |
{ | |
public static T2 Parse<T1, T2>(string input) => | |
(T2) System.Enum.Parse(typeof(T1), input); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ParseHzzoExcelDocuments(IEnumerable<HzzoMedsDownloadDto> filteredMeds, DrugListType listType, bool isListStartingWith2014) | |
{ | |
HzzoMedsDownloadDto latestMed = null; | |
int latestRow = 0; | |
int latestCol = 0; | |
try | |
{ | |
Parallel.ForEach(filteredMeds, med => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ISheet OpenWorkbookSheetWithNpoi(FileStream stream, HzzoMedsDownloadDto med, HzzoMedsDownloadDto latestMed) | |
{ | |
ISheet drugListSheet = null; | |
try | |
{ | |
if (med.FileName.ToLowerInvariant().EndsWith(".xls")) | |
{ | |
var hssfWorkbook = new HSSFWorkbook(stream); | |
drugListSheet = hssfWorkbook.GetSheetAt(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MedsProcessor.Parser | |
{ | |
public enum DrugListType | |
{ | |
Undefined = 0, | |
Primary = 1, | |
Supplementary = 2 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DrugImportDto | |
{ | |
public int RowId { get; set; } | |
public DrugListType ListType { get; set; } | |
public DateTime ValidFrom { get; set; } | |
public string AtkCode { get; set; } | |
public DrugApplicationTypeLimitation ApplicationTypeLimitation { get; set; } | |
public string GenericName { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static readonly DateTime filterDtStartWith2014 = new DateTime(2014, 1, 3); | |
void ParseSupplementaryListsUpTo2014_01(ISet<HzzoMedsDownloadDto> meds) => | |
ParseHzzoExcelDocuments(meds.Where(x => | |
x.ValidFrom <= filterDtStartWith2014 && | |
( | |
x.FileName.ToLowerInvariant().Contains("dopunska") || | |
x.FileName.ToLowerInvariant().Contains("dll") | |
)), DrugListType.Supplementary, false); |