private void BindAgencyClientCodeDropdown()
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var dropDownResult = service.GetData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                  <BKIC.SellingPoint.DTO.RequestResponseWrappers.FetchDropDownsResponse> >
                                     (BKIC.SellingPont.DTO.Constants.DropdownURI.GetPageDropDowns.Replace("{type}",
                                                                                                          BKIC.SellingPoint.DTO.RequestResponseWrappers.PageType.DomesticHelp));

            if (dropDownResult.StatusCode == 200 && dropDownResult.Result.IsTransactionDone)
            {
                DataSet   dropdownds = JsonConvert.DeserializeObject <DataSet>(dropDownResult.Result.dropdownresult);
                DataTable branches   = dropdownds.Tables["BranchMaster"];
                DataTable Financier  = dropdownds.Tables["Financier"];

                if (branches != null && branches.Rows.Count > 0)
                {
                    ddlBranch.DataValueField = "AGENTBRANCH";
                    ddlBranch.DataTextField  = "BranchName";
                    ddlBranch.DataSource     = branches.AsEnumerable()
                                               .Where(row => row.Field <string>("Agency") == userInfo.Agency)
                                               .CopyToDataTable();
                    ddlBranch.DataBind();
                    ddlBranch.Items.Insert(0, new ListItem("--Please Select--", ""));
                }
                if (Financier != null && Financier.Rows.Count > 0)
                {
                    ddlBank.DataValueField = "Financier";
                    ddlBank.DataTextField  = "Code";
                    ddlBank.DataSource     = Financier;
                    ddlBank.DataBind();
                    ddlBank.Items.Insert(0, new ListItem("--Please Select--", ""));
                }
            }
            var req = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyInsuredRequest();

            req.AgentBranch = userInfo.AgentBranch;
            req.AgentCode   = userInfo.AgentCode;

            var insuredResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                  <BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyInsuredResponse>,
                                                  BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyInsuredRequest>
                                    (BKIC.SellingPoint.DTO.Constants.AdminURI.GetAgencyInsured, req);

            if (insuredResult.StatusCode == 200 && insuredResult.Result.IsTransactionDone && insuredResult.Result.AgencyInsured.Count > 0)
            {
                //ddlCPR.DataSource = insuredResult.Result.AgencyInsured;
                //ddlCPR.DataTextField = "CPR";
                //ddlCPR.DataValueField = "InsuredCode";
                //ddlCPR.DataBind();
                //ddlCPR.Items.Insert(0, new ListItem("--Please Select--", ""));
                InsuredNames = insuredResult.Result.AgencyInsured;
            }
            txtIndroducedBy.Text    = userInfo.UserName;
            ddlBranch.SelectedIndex = ddlBranch.Items.IndexOf(ddlBranch.Items.FindByValue(userInfo.AgentBranch));
            txtIndroducedBy.Text    = userInfo.UserName;
        }
        private void GetInsuredUserByCPR()
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var req = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyInsuredRequest
            {
                AgentBranch = userInfo.AgentBranch,
                AgentCode   = userInfo.AgentCode,
                Agency      = userInfo.Agency,
                CPR         = txtSearchByCPR.Text.Trim()
            };

            var insuredResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                  <BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyInsuredResponse>,
                                                  BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyInsuredRequest>
                                    (BKIC.SellingPoint.DTO.Constants.AdminURI.GetAgencyInsured, req);

            if (insuredResult.StatusCode == 200 && insuredResult.Result.IsTransactionDone && insuredResult.Result.AgencyInsured.Count > 0)
            {
                var insured = insuredResult.Result.AgencyInsured[0];
                txtCPR.Text             = insured.CPR;
                txtPassport.Text        = insured.PassportNo;
                txtFirstName.Text       = insured.FirstName;
                txtMiddleName.Text      = insured.MiddleName;
                txtLastName.Text        = insured.LastName;
                txtFlat.Text            = insured.Flat;
                ddlGender.SelectedIndex = insured.Gender == "Male" ? 1 : 2;
                txtRoad.Text            = insured.Road;
                txtBuilding.Text        = insured.Building;
                txtBlock.Text           = insured.Block;
                SetAreaBlock();
                txtEmail.Text                = insured.Email;
                txtMobile.Text               = insured.Mobile;
                txtDateOfBirth.Text          = insured.DateOfBirth.ConvertToLocalFormat();
                ddlNationality.SelectedIndex = ddlNationality.Items.IndexOf(ddlNationality.Items.FindByValue(insured.Nationality));
                txtOccupation.Text           = insured.Occupation;
                btnSubmit.Text               = HttpUtility.HtmlDecode("Update");
                _InsuredID = insured.InsuredId;
            }
            else
            {
                ClearControl();
                btnSubmit.Text = "Save";
            }
        }
Exemplo n.º 3
0
 // [ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin, BKIC.SellingPont.DTO.Constants.Roles.BranchAdmin)]
 public RR.AgencyInsuredResponse GetAgencyInsured(RR.AgencyInsuredRequest request)
 {
     try
     {
         BLO.AgencyInsuredRequest  req    = _mapper.Map <RR.AgencyInsuredRequest, BLO.AgencyInsuredRequest>(request);
         BLO.AgencyInsuredResponse result = _adminRepository.GetAgencyInsured(req);
         return(_mapper.Map <BLO.AgencyInsuredResponse, RR.AgencyInsuredResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.AgencyInsuredResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }