private ApiResponse <PagedListResponse <TransactionViewModel> > Search(SearchTransactionViewModel model) { var apiResp = new ApiResponse <PagedListResponse <TransactionViewModel> > { Type = ResponseType.Fail, Data = new PagedListResponse <TransactionViewModel>() }; var request = new FilteredPagedListRequest <SearchTransactionCriteria> { FilterCriteria = new SearchTransactionCriteria { UserId = GetUserId().Value, CustomerId = model.CustomerId, TypeId = model.TypeId, IsDebt = model.IsDebt, SortType = model.GetSortType() }, IncludeRecordsTotal = model.IncludeRecordsTotal, Limit = model.Limit, Offset = model.Offset }; _transactionBusiness.OwnerId = GetUserId().Value; var resp = _transactionBusiness.Search(request); apiResp.Data.Items = resp.Items.Select(p => new TransactionViewModel { Id = p.Id, Customer = new CustomerViewModel { Id = p.Customer.Id, Title = p.Customer.Title, AuthorizedPersonName = p.Customer.AuthorizedPersonName }, Type = new ParameterViewModel { Id = p.Type.Id, ParameterTypeId = p.Type.ParameterTypeId, Name = p.Type.Name }, Amount = p.Amount, Description = p.Description, AttachmentName = p.AttachmentName, IsDebt = p.IsDebt, CreatedAt = p.CreatedAt, ModifiedAt = p.ModifiedAt, Date = p.Date });; apiResp.Data.RecordsTotal = resp.RecordsTotal; apiResp.Type = ResponseType.Success; return(apiResp); }
public JsonResult GetLedgerVoucherBykeywordorList(string searchValue) { var tupleList = transactionsManager.CreateLedgerVoucherBykeyword(user.InstituteId, user.FinancialYearId, searchValue); var response = new SearchTransactionViewModel() { transactionSearchLedgers = tupleList.transactionLedger, transactionAmount = tupleList.totalTransactionAmount }; var jsonResult = Json(response, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public JsonResult GetLedgerVoucherList(TransactionListRequestModel requestModel) { requestModel.ToInstituteId = user.InstituteId != 300010 ? user.InstituteId : requestModel.ForInstituteId; var tupleList = transactionsManager.CreateLedgerVoucherList(user.DepartmentID, requestModel); var response = new SearchTransactionViewModel() { transactionSearchLedgers = tupleList.transactionLedger, transactionAmount = tupleList.totalTransactionAmount }; var jsonResult = Json(response, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public IActionResult Get([FromQuery] SearchTransactionViewModel model) { if (!ModelState.IsValid) { return(BadRequest(GetModelStateErrorResponse(ModelState))); } var resp = Search(model); if (resp.Type != ResponseType.Success) { return(BadRequest(resp)); } return(Ok(resp)); }
public SearchTransaction() { InitializeComponent(); ViewModel = new SearchTransactionViewModel(); }