public bool DeleteTransporterCheque(TransporterCheque transporterCheque) { if (transporterCheque == null) { return(false); } _unitOfWork.TransporterChequeRepository.Delete(transporterCheque); _unitOfWork.Save(); return(true); }
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); }
public bool EditTransporterCheque(TransporterCheque transporterCheque) { _unitOfWork.TransporterChequeRepository.Edit(transporterCheque); _unitOfWork.Save(); return(true); }
public ActionResult EditCollectiveChequeInfo(Models.TransporterChequeViewModel transporterChequeViewModel, int transporterID) { var paymentRequestList = (IEnumerable <Cats.Models.TransporterPaymentRequest>)_transporterPaymentRequestService .Get(t => t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo == 3, null, "BusinessProcess") .OrderByDescending(t => t.TransporterPaymentRequestID); //var transporterChequeObj = _transporterChequeService.Get(t => t.TransporterChequeId == transporterChequeViewModel.TransporterChequeId).FirstOrDefault(); if (paymentRequestList.Any()) { var transporterChequeDetails = new List <TransporterChequeDetail>(); foreach (var paymentRequest in paymentRequestList) { var transporterChequeDetail = new TransporterChequeDetail { TransporterPaymentRequestID = paymentRequest.TransporterPaymentRequestID }; transporterChequeDetails.Add(transporterChequeDetail); } var user = UserAccountHelper.GetUser(User.Identity.Name); var transporterChequeObj = new TransporterCheque() { CheckNo = transporterChequeViewModel.CheckNo, PaymentVoucherNo = transporterChequeViewModel.PaymentVoucherNo, BankName = transporterChequeViewModel.BankName, Amount = transporterChequeViewModel.Amount, PreparedBy = user.UserProfileID, Status = 1, TransporterChequeDetails = transporterChequeDetails }; int BP_PR = _applicationSettingService.getTransporterChequeWorkflow(); if (BP_PR != 0) { BusinessProcessState createdstate = new BusinessProcessState { DatePerformed = DateTime.Now, PerformedBy = "System", Comment = "Created workflow for Transporter Cheque" }; //_PaymentRequestservice.Create(request); BusinessProcess bp = _businessProcessService.CreateBusinessProcess(BP_PR, transporterChequeObj.TransporterChequeId, "ValidatedPaymentRequest", createdstate); transporterChequeObj.BusinessProcessID = bp.BusinessProcessID; transporterChequeObj.IssueDate = DateTime.Now; _transporterChequeService.AddTransporterCheque(transporterChequeObj); foreach (var paymentRequest in paymentRequestList) { var currFlowTemplate = paymentRequest.BusinessProcess.CurrentState.BaseStateTemplate.InitialStateFlowTemplates.FirstOrDefault(); if (currFlowTemplate != null) { var state = new BusinessProcessState() { StateID = currFlowTemplate.FinalStateID, PerformedBy = user.FullName, Comment = "Finance: Batch generated cheque for the payment request", DatePerformed = DateTime.Now, ParentBusinessProcessID = paymentRequest.BusinessProcess.CurrentState.ParentBusinessProcessID }; var item = _businessProcessService.FindById(state.ParentBusinessProcessID); _businessProcessStateService.Add(state); item.CurrentStateID = state.BusinessProcessStateID; _businessProcessService.Update(item); } } } } return(RedirectToAction("Cheques", "Cheque", new { Area = "Finance", transporterID })); }