Exemple #1
0
        public HttpResponseMessage ClaimReverseFeed(RequestClaimReverseFeedDto requestClaimReverseFeedDto)
        {
            var claimId  = _iClaimReverseHelper.GetClaimIdByClaimNumber(requestClaimReverseFeedDto.CLAIMNUMBER);
            var response = new ResponseReverseFeed();

            if (claimId > 0)
            {
                var claimReverseFeed = new ClaimReverseFeedDto
                {
                    ACCIDENTDATE         = requestClaimReverseFeedDto.ACCIDENTDATE,
                    APPROVEDAMOUNT       = requestClaimReverseFeedDto.APPROVEDAMOUNT,
                    ASSESSEDAMOUNT       = requestClaimReverseFeedDto.ASSESSEDAMOUNT,
                    CHEQUEORPAYMENTNO    = requestClaimReverseFeedDto.CHEQUEORPAYMENTNO,
                    CLAIMESTIMATEDAMOUNT = requestClaimReverseFeedDto.CLAIMESTIMATEDAMOUNT,
                    CLAIMINTIMATIONDATE  = requestClaimReverseFeedDto.CLAIMINTIMATIONDATE,
                    ClaimId        = claimId,
                    COMPANY        = requestClaimReverseFeedDto.COMPANY,
                    CUSTOMERNAME   = requestClaimReverseFeedDto.CUSTOMERNAME,
                    FEEDID         = requestClaimReverseFeedDto.FEEDID,
                    FILESUBDATE    = requestClaimReverseFeedDto.FILESUBDATE,
                    INVOICENUMBER  = requestClaimReverseFeedDto.INVOICENUMBER,
                    PAIDAMOUNT     = requestClaimReverseFeedDto.PAIDAMOUNT,
                    PAYEEPARTYCODE = requestClaimReverseFeedDto.PAYEEPARTYCODE,
                    PAYEEPARTYNAME = requestClaimReverseFeedDto.PAYEEPARTYNAME,
                    PAYEETYPE      = requestClaimReverseFeedDto.PAYEETYPE,
                    PAYMENTDATE    = requestClaimReverseFeedDto.PAYMENTDATE,
                    PAYMENTMODE    = requestClaimReverseFeedDto.PAYMENTMODE,
                    RECORDTYPE     = requestClaimReverseFeedDto.RECORDTYPE
                };
                var responseReverseFeed = _iClaimReverseHelper.InsertClaimReverseFeed(claimReverseFeed);
                response.IsSuccess   = responseReverseFeed.IsSuccess;
                response.ResponseMsg = responseReverseFeed.Message;
            }
            else
            {
                response.IsSuccess   = false;
                response.ResponseMsg = "Claim Number not exist";
            }

            //    response = new ResponseReverseFeed { ResponseMsg = "Claim Number not exist", IsSuccess = false };
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public ReverseResponse InsertClaimReverseFeed(ClaimReverseFeedDto requestClaimReverseFeedDto)
        {
            try
            {
                var reverseFeedObj = _unitOfWork.ClaimReverseFeedRepository.GetFirst(clr => clr.ClaimId == requestClaimReverseFeedDto.ClaimId && clr.InvoiceNumber.Trim() == requestClaimReverseFeedDto.INVOICENUMBER.Trim());
                if (reverseFeedObj == null)
                {
                    var reverseNew = new Data.ClaimReverseFeed
                    {
                        ApprovedAmount       = requestClaimReverseFeedDto.APPROVEDAMOUNT,
                        AssessedAmount       = requestClaimReverseFeedDto.ASSESSEDAMOUNT,
                        ChequePayementNumber = requestClaimReverseFeedDto.CHEQUEORPAYMENTNO,
                        ClaimEstimatedAmount = requestClaimReverseFeedDto.CLAIMESTIMATEDAMOUNT,
                        ClaimId = requestClaimReverseFeedDto.ClaimId,

                        Company      = requestClaimReverseFeedDto.COMPANY,
                        CustomerName = requestClaimReverseFeedDto.CUSTOMERNAME,
                        FeedId       = Convert.ToString(requestClaimReverseFeedDto.FEEDID),

                        InvoiceNumber  = requestClaimReverseFeedDto.INVOICENUMBER,
                        PaidAmount     = requestClaimReverseFeedDto.PAIDAMOUNT,
                        PayeePartyCode = requestClaimReverseFeedDto.PAYEEPARTYCODE,
                        PayeePartyName = requestClaimReverseFeedDto.PAYEEPARTYNAME,
                        PayeeType      = requestClaimReverseFeedDto.PAYEETYPE,

                        PaymentMode = requestClaimReverseFeedDto.PAYMENTMODE,
                        RecordType  = requestClaimReverseFeedDto.RECORDTYPE
                    };

                    if (requestClaimReverseFeedDto.ACCIDENTDATE.ToShortDateString() != DateTime.MinValue.ToShortDateString())
                    {
                        reverseNew.AccidentDate = requestClaimReverseFeedDto.ACCIDENTDATE;
                    }
                    if (requestClaimReverseFeedDto.CLAIMINTIMATIONDATE.ToShortDateString() != DateTime.MinValue.ToShortDateString())
                    {
                        reverseNew.ClaimIntimationDate = requestClaimReverseFeedDto.ACCIDENTDATE;
                    }

                    if (requestClaimReverseFeedDto.FILESUBDATE.ToShortDateString() != DateTime.MinValue.ToShortDateString())
                    {
                        reverseNew.FileSubDate = requestClaimReverseFeedDto.FILESUBDATE;
                    }

                    if (requestClaimReverseFeedDto.PAYMENTDATE.ToShortDateString() != DateTime.MinValue.ToShortDateString())
                    {
                        reverseNew.PaymentDate = requestClaimReverseFeedDto.PAYMENTDATE;
                    }

                    _unitOfWork.ClaimReverseFeedRepository.Insert(reverseNew);

                    var claimObj = _unitOfWork.ClaimRepository.GetByID(requestClaimReverseFeedDto.ClaimId);
                    if (claimObj != null)
                    {
                        claimObj.StatusId   = 1;
                        claimObj.UpdateDate = DateTime.Now;
                        _unitOfWork.ClaimRepository.Update(claimObj);
                    }

                    _unitOfWork.Save();
                    return(new ReverseResponse
                    {
                        IsSuccess = true,
                        Message = "Successfull"
                    });
                }
                else
                {
                    return(new ReverseResponse
                    {
                        IsSuccess = false,
                        Message = "Duplicate reverse feed for claim"
                    });
                }
            }
            catch (Exception ex)
            {
                return(new ReverseResponse
                {
                    IsSuccess = false,
                    Message = ex.InnerException.Message.ToString()
                });
            }
        }