public RR.MotorEndoResult GetAllEndorsements(RR.MotorEndoRequest req)
 {
     try
     {
         BLO.MotorEndoRequest details = _mapper.Map <RR.MotorEndoRequest, BLO.MotorEndoRequest>(req);
         var result = _motorEndorsementRepository.GetAllEndorsements(details);
         return(_mapper.Map <BLO.MotorEndoResult, RR.MotorEndoResult>(result));
     }
     catch (Exception ex)
     {
         return(new RR.MotorEndoResult()
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Esempio n. 2
0
        private void ListEndorsements(DataServiceManager service, OAuthTokenResponse userInfo)
        {
            if (userInfo == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (ddlMotorPolicies.SelectedIndex > 0)
            {
                var motorEndoRequest = new BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEndoRequest();
                motorEndoRequest.Agency        = userInfo.Agency;
                motorEndoRequest.AgentCode     = userInfo.AgentCode;
                motorEndoRequest.InsuranceType = Constants.Motor;
                motorEndoRequest.DocumentNo    = ddlMotorPolicies.SelectedItem.Text.Trim();

                var listEndoResponse = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                         <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEndoResult>,
                                                         BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEndoRequest>
                                           (BKIC.SellingPoint.DTO.Constants.MotorEndorsementURI.GetAllEndorsements, motorEndoRequest);

                if (listEndoResponse.StatusCode == 200 && listEndoResponse.Result.IsTransactionDone)
                {
                    gvMotorEndorsement.DataSource = listEndoResponse.Result.MotorEndorsements;
                    gvMotorEndorsement.DataBind();

                    if (listEndoResponse.Result.MotorEndorsements.Count > 0)
                    {
                        _MotorEndorsementID = listEndoResponse.Result.MotorEndorsements[listEndoResponse.Result.MotorEndorsements.Count - 1].MotorEndorsementID;
                    }
                    else
                    {
                        _MotorEndorsementID = 0;
                    }
                }
            }
        }