Exemple #1
0
        public async Task <ChecklistHistory> GetLatestChecklist(Scheme scheme)
        {
            var mapper = new ChecklistMapper();

            var param = new DynamicParameters();

            param.Add("@Scheme", scheme);

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetLatestChecklist",
                                               new[]
            {
                typeof(ChecklistHistory),
                typeof(ChecklistCategory),
                typeof(ChecklistItem)
            },
                                               obj =>
            {
                var history = obj[0] as ChecklistHistory;
                var category = obj[1] as ChecklistCategory;
                var item = obj[2] as ChecklistItem;

                return mapper.Map(history, category, item);
            },
                                               param,
                                               splitOn: "ID,CategoryID,ItemID",
                                               commandType: System.Data.CommandType.StoredProcedure))?.FirstOrDefault());
        }
Exemple #2
0
        public async Task <IEnumerable <ChecklistHistory> > GetChecklistHistoryByScheme(int id)
        {
            var mapper = new ChecklistMapper();

            var param = new DynamicParameters();

            param.Add("@ID", id);

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetChecklistHistoryByScheme",
                                               new[]
            {
                typeof(ChecklistHistory),
                typeof(ChecklistCategory),
                typeof(ChecklistItem)
            },
                                               obj =>
            {
                var history = obj[0] as ChecklistHistory;
                var category = obj[1] as ChecklistCategory;
                var item = obj[2] as ChecklistItem;

                return mapper.Map(history, category, item);
            },
                                               param,
                                               splitOn: "ID,CategoryID,ItemID",
                                               commandType: System.Data.CommandType.StoredProcedure)).Distinct());
        }
Exemple #3
0
        public async Task <ChecklistHistory> GetChecklistHistoryByID(long id)
        {
            var mapper = new ChecklistMapper();

            var param = new DynamicParameters();

            param.Add("@ID", id);

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetChecklistHistoryByID",
                                               new[]
            {
                typeof(ChecklistHistory),
                typeof(ChecklistCategory),
                typeof(ChecklistItem)
            },
                                               obj =>
            {
                var history = obj[0] as ChecklistHistory;
                var category = obj[1] as ChecklistCategory;
                var item = obj[2] as ChecklistItem;

                return mapper.Map(history, category, item);
            },
                                               param,
                                               splitOn: "ID,CategoryID,ItemID",
                                               commandType: CommandType.StoredProcedure,
                                               transaction: _unitOfWork.Transaction))?.FirstOrDefault());
        }