Esempio n. 1
0
        public async Task <IList <RFA> > Query(RFAFilter filter)
        {
            var status = new DataTable();

            status.Columns.Add("Val", typeof(int));

            if (filter.Status?.Any() ?? false)
            {
                foreach (var s in filter.Status)
                {
                    status.Rows.Add(s);
                }
            }

            var param = new DynamicParameters();

            param.Add("@ID", filter.ID);
            param.Add("@RequestID", filter.RequestID);
            param.Add("@Customer", filter.Customer);
            param.Add("@RaisedBy", filter.RaisedBy);
            param.Add("@CreatedOn", filter.CreatedOn);
            param.Add("@DueOn", filter.DueOn);
            param.Add("@Status", status.AsTableValuedParameter("dbo.SmallIntType"));

            var mapper = new RFAMapper();

            return((await SqlMapper.QueryAsync <RFA>(_unitOfWork.Connection,
                                                     "SelectRFA",
                                                     new []
            {
                typeof(RFA),
                typeof(Model.Request)
            },
                                                     obj =>
            {
                return mapper.Map(obj[0] as RFA,
                                  request: obj[1] as Model.Request);
            },
                                                     param,
                                                     splitOn: "ID,Request",
                                                     commandType: CommandType.StoredProcedure,
                                                     transaction: _unitOfWork.Transaction)).Distinct().ToList());
        }
Esempio n. 2
0
 public Task <IList <RFA> > ListOfRFA(RFAFilter filter)
 {
     return(Execute(new ListOfRFACommand(filter)));
 }
Esempio n. 3
0
 public ListOfRFACommand(RFAFilter filter)
 {
     _filter = filter;
 }