public InsuredMasterDetails GetInsured(string CPR, string InsuredCode, string Agency, string AgentCode)
        {
            this.IsSessionAvailable();
            var service = CommonMethods.GetLogedInService();

            var insured = new InsuredRequest
            {
                CPR         = CPR,
                InsuredCode = "",
                Agency      = Agency,
                AgentCode   = AgentCode
            };
            var serviceResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                  <BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredResponse>,
                                                  BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredRequest>
                                    (BKIC.SellingPoint.DTO.Constants.AdminURI.FetchUserDetailsByCPRInsuredCode, insured);

            if (serviceResult.StatusCode == 200 && serviceResult.Result.IsTransactionDone)
            {
                return(serviceResult.Result.InsuredDetails);
            }
            else
            {
                ShowErrorPopup("Insured not found", "Insured");
                return(null);
            }
        }
        private void GetUserforEdit(string insuredCd, string cpr)
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var insured = new InsuredRequest
            {
                CPR         = cpr,
                InsuredCode = insuredCd,
                Agency      = userInfo.Agency,
                AgentCode   = userInfo.AgentCode
            };

            var serviceResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                  <BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredResponse>,
                                                  BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredRequest>
                                    (BKIC.SellingPoint.DTO.Constants.AdminURI.FetchUserDetailsByCPRInsuredCode, insured);

            if (serviceResult.StatusCode == 200 && serviceResult.Result.IsTransactionDone)
            {
                var userInformation = serviceResult.Result.InsuredDetails;
                if (userInformation != null)
                {
                    txtCPR.Text                  = userInformation.CPR;
                    txtFirstName.Text            = userInformation.FirstName;
                    txtMiddleName.Text           = userInformation.MiddleName;
                    txtLastName.Text             = userInformation.LastName;
                    ddlGender.SelectedIndex      = ddlGender.Items.IndexOf(ddlGender.Items.FindByValue(userInformation.Gender));
                    txtFlat.Text                 = userInformation.Flat;
                    txtBuilding.Text             = userInformation.Building;
                    txtRoad.Text                 = userInformation.Road;
                    txtBlock.Text                = userInformation.Block;
                    ddlArea.SelectedIndex        = ddlArea.Items.IndexOf(ddlArea.Items.FindByValue(userInformation.Area));
                    txtMobile.Text               = userInformation.Mobile;
                    txtEmail.Text                = userInformation.Email;
                    txtDateOfBirth.Text          = userInformation.DateOfBirth.ConvertToLocalFormat();
                    ddlNationality.SelectedIndex = ddlNationality.Items.IndexOf(ddlNationality.Items.FindByValue(userInformation.Nationality));
                    txtOccupation.Text           = userInformation.Occupation;
                }
            }
        }
        private void GetInsuredPolicies()
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            string uri = "api/admin/getdocumentsbycpr/{cpr}/{agentcode}";

            uri = uri.Replace("{cpr}", txtCPRSearch.Text.Trim()).Replace("{agentcode}", userInfo.AgentCode);

            var AllDocuments = service.GetData <BKIC.SellingPoint.DTO.RequestResponseWrappers
                                                .ApiResponseWrapper <BKIC.SellingPoint.DTO.RequestResponseWrappers.DocumentDetailsResult> >(uri);


            if (AllDocuments != null && AllDocuments.Result != null && AllDocuments.StatusCode == 200 && AllDocuments.Result.IsTransactionDone)
            {
                gvDocuments.DataSource = AllDocuments.Result.DocumentDetails;
                gvDocuments.DataBind();
            }

            string uri1 = "api/user/fetchdetailscprinsuredCode";

            BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredRequest request = new InsuredRequest
            {
                CPR       = txtCPRSearch.Text.Trim(),
                Agency    = userInfo.Agency,
                AgentCode = userInfo.AgentCode
            };

            var postData = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                             <BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredResponse>,
                                             BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredRequest>(uri1, request);

            if (postData.StatusCode == 200 && postData.Result != null && postData.Result.IsTransactionDone)
            {
                InsuredCode.Value = postData.Result.InsuredDetails.InsuredCode;
                InsuredName.Value = postData.Result.InsuredDetails.LastName;
            }
        }