public QueryJobOrderCommand(JobOrderOptions options) { _options = options; }
public async Task <IEnumerable <Model.JobOrder> > QueryJobOrder(JobOrderOptions options) { return(await Execute(new QueryJobOrderCommand(options))); }
public async Task <IEnumerable <Model.JobOrder> > Select( JobOrderOptions options) { var statusTable = new DataTable(); statusTable.Columns.Add("Val", typeof(int)); if (options.Status?.Any() ?? false) { foreach (var status in options.Status) { statusTable.Rows.Add(status); } } var typeTable = new DataTable(); typeTable.Columns.Add("Val", typeof(int)); if (options.Type?.Any() ?? false) { foreach (var type in options.Type) { typeTable.Rows.Add(type); } } var assignedToTable = new DataTable(); assignedToTable.Columns.Add("Val", typeof(Guid)); if (options.AssignedTo?.Any() ?? false) { foreach (var assignedTo in options.AssignedTo) { assignedToTable.Rows.Add(assignedTo); } } var mapper = new JobOrderMapper(); var param = new DynamicParameters(); param.Add("@ID", options.ID); param.Add("@CustomerName", options.Customer); param.Add("@Premise", options.Premise); param.Add("@From", options.From); param.Add("@To", options.To); param.Add("@Type", typeTable.AsTableValuedParameter("dbo.SmallIntType")); param.Add("@Status", statusTable.AsTableValuedParameter("dbo.SmallIntType")); param.Add("@AssignedTo", assignedToTable.AsTableValuedParameter("dbo.UniqueIdentifierType")); return((await SqlMapper.QueryAsync(_unitOfWork.Connection, "SelectJobOrder", new[] { typeof(Model.JobOrder), typeof(JobOrderLineItem), typeof(Customer), typeof(Officer), typeof(Premise), typeof(Person), typeof(ContactInfo) }, obj => { return mapper.Map(obj[0] as Model.JobOrder, obj[1] as JobOrderLineItem, obj[4] as Premise, obj[2] as Customer, obj[5] as Person, obj[6] as ContactInfo, officer: obj[3] as Officer); }, param, splitOn: "ID,LineItemID,CustomerID,OfficerID,PremiseID,PersonID,ContactInfoID", commandType: CommandType.StoredProcedure, transaction: _unitOfWork.Transaction)).Distinct()); }
public async Task <IList <JobOrder> > Search(JobOrderOptions options) { return(await _apiClient.JobOrderSdk.Query(options)); }