프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Dapper / Repository / ExcelDataRepository.cs @ d6a800c2

이력 | 보기 | 이력해설 | 다운로드 (1.37 KB)

1 8eca8767 taeseongkim
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using Dapper;
7
using ID2.Manager.Data.Models;
8
9
namespace ID2.Manager.Dapper.Repository
10
{
11
    public class ExcelDataRepository : BaseRepository
12
    {
13
        public ExcelDataRepository(string connectionStr) : base(connectionStr) { }
14
        
15
        public IEnumerable<ExcelData> GetExcelData(string FileName,string WorksheetName)
16
        {
17
            try
18
            {
19
                string query = $@"select * from dbo.ImportExcel where [FILE_NAME] = @FileName and WORKSHEET_NAME = @WorksheetName";
20
                var dynamicParameters = new DynamicParameters();
21
                dynamicParameters.Add("@FileName", FileName);
22
                dynamicParameters.Add("@WorksheetName", WorksheetName);
23
24
                return Query<ExcelData>(query, dynamicParameters);
25
            }
26
            catch (Exception ex)
27
            {
28
                throw ex;
29
            }
30
        }
31
32
        public IEnumerable<ExcelDataInfo> GetExcelDataInfo()
33
        {
34
            try
35
            {
36
                string query = $@"select [FILE_NAME],WORKSHEET_NAME from dbo.ImportExcel group by [FILE_NAME],WORKSHEET_NAME";
37
38
                return Query<ExcelDataInfo>(query);
39
            }
40
            catch (Exception ex)
41
            {
42
                throw ex;
43
            }
44
        }
45
    }
46
}
클립보드 이미지 추가 (최대 크기: 500 MB)