コード例 #1
0
 public RR.AgencyDomesticPolicyResponse GetDomesticAgencyPolicy(RR.AgencyDomesticRequest request)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BLO.AgencyDomesticRequest        domestic = _mapper.Map <RR.AgencyDomesticRequest, BLO.AgencyDomesticRequest>(request);
             BLO.AgencyDomesticPolicyResponse result   = _domesticHelpRepo.GetDomesticAgencyPolicy(domestic);
             return(_mapper.Map <BLO.AgencyDomesticPolicyResponse, RR.AgencyDomesticPolicyResponse>(result));
         }
         else
         {
             var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
             return(new RR.AgencyDomesticPolicyResponse()
             {
                 IsTransactionDone = false,
                 TransactionErrorMessage = message
             });
         }
     }
     catch (Exception ex)
     {
         return(new RR.AgencyDomesticPolicyResponse()
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
コード例 #2
0
        protected void Changed_MotorPolicy(object sender, EventArgs e)
        {
            try
            {
                master.IsSessionAvailable();
                var userInfo = CommonMethods.GetUserDetails();
                var service  = CommonMethods.GetLogedInService();

                var request = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyDomesticRequest
                {
                    AgentBranch = userInfo.AgentBranch,
                    AgentCode   = userInfo.AgentCode,
                    Agency      = userInfo.Agency
                };

                //List the previous endorsements for the policy.
                ListEndorsements(service, userInfo);

                //Get saved policy details by document(policy) number.
                var url = BKIC.SellingPoint.DTO.Constants.MotorURI.GetSavedQuoteDocumentNo
                          .Replace("{documentNo}", ddlMotorPolicies.SelectedItem.Text.Trim())
                          .Replace("{agentCode}", request.AgentCode)
                          .Replace("{isendorsement}", "true")
                          .Replace("{endorsementid}", "0");

                var motorDetails = service.GetData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                    <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorSavedQuotationResponse> >(url);

                //Update policy details on current page for dispaly the details.
                if (motorDetails.StatusCode == 200 && motorDetails.Result.IsTransactionDone)
                {
                    var response = motorDetails.Result.MotorPolicyDetails;

                    txtOldClientCode.Text     = response.InsuredCode;
                    txtEffectiveFromDate.Text = response.PolicyCommencementDate.CovertToLocalFormat();
                    txtEffectiveToDate.Text   = response.ExpiryDate.CovertToLocalFormat();
                    paidPremium.Value         = Convert.ToString(response.PremiumAfterDiscount);
                    subClass.Value            = response.Subclass;
                    SubClass                   = response.Subclass;
                    MainClass                  = response.Mainclass;
                    expireDate.Value           = response.ExpiryDate.CovertToLocalFormat();
                    txtInsuredName.Text        = response.InsuredName;
                    txtChassesNumber.Text      = response.ChassisNo;
                    txtRegistrationNumber.Text = response.RegistrationNumber;
                }
                Page_CustomValidate();
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }
コード例 #3
0
        private void UpdatePolicyDetails(string DocumentNo, string RenewalCount, bool SearchByDocument)
        {
            ClearControls();

            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var request = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyDomesticRequest
            {
                AgentBranch = userInfo.AgentBranch,
                AgentCode   = userInfo.AgentCode,
                Agency      = userInfo.Agency
            };

            //var policyRenewalCount = ddlMotorPolicies.SelectedItem.Value.Substring(0, ddlMotorPolicies.SelectedValue.IndexOf("-", 0));

            //Get saved policy details by document(policy) number.
            var url = BKIC.SellingPoint.DTO.Constants.MotorURI.GetSavedQuoteDocumentNo
                      .Replace("{documentNo}", DocumentNo)
                      .Replace("{agentCode}", request.AgentCode)
                      .Replace("{isendorsement}", "true")
                      .Replace("{endorsementid}", "0")
                      .Replace("{renewalCount}", RenewalCount);


            var motorDetails = service.GetData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorSavedQuotationResponse> >(url);

            //Update policy details on current page for dispaly the details.
            if (motorDetails.StatusCode == 200 && motorDetails.Result.IsTransactionDone)
            {
                var response = motorDetails.Result.MotorPolicyDetails;

                txtOldClientCode.Text     = response.InsuredCode;
                txtOldInsuredName.Text    = response.InsuredName;
                txtEffectiveFromDate.Text = DateTime.Now.CovertToLocalFormat();//response.PolicyCommencementDate.CovertToLocalFormat();
                txtEffectiveToDate.Text   = response.ExpiryDate.CovertToLocalFormat();
                paidPremium.Value         = Convert.ToString(response.PremiumAfterDiscount);
                subClass.Value            = response.Subclass;
                SubClass                         = response.Subclass;
                MainClass                        = response.Mainclass;
                expireDate.Value                 = response.ExpiryDate.CovertToLocalFormat();
                ddlMake.SelectedIndex            = ddlMake.Items.IndexOf(ddlMake.Items.FindByText(response.VehicleMake));
                ddlManufactureYear.SelectedIndex = ddlManufactureYear.Items.IndexOf(ddlManufactureYear.Items.FindByText(response.YearOfMake.ToString()));
                SetVehicleMake(service, response);
                GetBodyType();
                ddlBodyType.SelectedIndex = ddlBodyType.Items.IndexOf(ddlBodyType.Items.FindByText(response.vehicleBodyType));
                ddlEnginecc.SelectedIndex = ddlEnginecc.Items.IndexOf(ddlEnginecc.Items.FindByValue(response.EngineCC.ToString()));
                txtRegistration.Text      = response.RegistrationNumber;
                txtChassis.Text           = response.ChassisNo;
                IsCancelled(response.IsCancelled);
                if (SearchByDocument)
                {
                    ddlMotorPolicies.Items.Clear();
                    txtCPRSearch.Text = response.CPR;
                    ddlMotorPolicies.Items.Insert(0, new ListItem("--Please Select--", "none"));
                    ddlMotorPolicies.Items.Insert(1, new ListItem(txtMotorEndorsementSearch.Text.Trim(), RenewalCount + "-" + txtMotorEndorsementSearch.Text.Trim()));
                    ddlMotorPolicies.DataBind();
                    ddlMotorPolicies.SelectedIndex = 1;
                }
                //List the previous endorsements for the policy.
                ListEndorsements(service, userInfo);
            }
            else
            {
                master.ShowErrorPopup(motorDetails.Result.TransactionErrorMessage, "Request failed!");
            }
        }