public JsonResult ReadCheques() { var cheques = _transporterChequeService.GetAllTransporterCheque().Where(t => t.Status < 4).Select(c => { var transporterChequeDetail = c.TransporterChequeDetails.FirstOrDefault(); return(transporterChequeDetail != null ? new { chequeNo = c.CheckNo, Transporter = transporterChequeDetail.TransporterPaymentRequest.TransportOrder.Transporter.Name, c.Amount, PreparedBy = c.UserProfile.FirstName + " " + c.UserProfile.LastName, ApprovedBy = c.AppovedBy != null ? _userProfileService.FindById((int)c.AppovedBy).FirstName + " " + _userProfileService.FindById((int)c.AppovedBy).LastName : "", DateApproved = c.AppovedDate.Date.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()), transporterChequeId = c.TransporterChequeId, State = c.Status, Status = c.BusinessProcess.CurrentState.BaseStateTemplate.Name, ButtonStatus = c.BusinessProcess.CurrentState.BaseStateTemplate.Name, c.BankName } : null); }); return(Json(cheques, JsonRequestBehavior.AllowGet)); }
private TransporterChequeViewModel BindTransporterChequeViewModel(TransporterCheque transporterCheque) { TransporterChequeViewModel transporterChequeViewModel = null; if (transporterCheque != null) { var transporterChequeDetailObj = transporterCheque.TransporterChequeDetails.FirstOrDefault(); if (transporterChequeDetailObj != null) { var transporterObj = transporterChequeDetailObj.TransporterPaymentRequest.TransportOrder.Transporter; transporterChequeViewModel = new TransporterChequeViewModel { TransporterChequeId = transporterCheque.TransporterChequeId, CheckNo = transporterCheque.CheckNo, PaymentVoucherNo = transporterCheque.PaymentVoucherNo, BankName = transporterCheque.BankName, PaymentDate = transporterCheque.PaymentDate, Amount = transporterCheque.Amount, TransporterId = transporterObj.TransporterID, Transporter = _transporterService.FindById(transporterObj.TransporterID).Name, PreparedBy = _userProfileService.FindById( (int)transporterCheque.PreparedBy).FirstName + " " + _userProfileService.FindById( (int)transporterCheque.PreparedBy).LastName, AppovedBy = transporterCheque.AppovedBy != null ? _userProfileService.FindById( (int)transporterCheque.AppovedBy). FirstName + " " + _userProfileService.FindById( (int)transporterCheque.AppovedBy). LastName : string.Empty, AppovedDate = transporterCheque.AppovedDate, Status = (int)transporterCheque.Status }; } } return(transporterChequeViewModel); }