Ejemplo n.º 1
0
 //  [ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin, BKIC.SellingPont.DTO.Constants.Roles.BranchAdmin)]
 public RR.InsuredMasterDetailsResponse InsuredMasterOperation(RR.InsuredMasterDetails request)
 {
     try
     {
         BLO.InsuredMasterDetails         req    = _mapper.Map <RR.InsuredMasterDetails, BLO.InsuredMasterDetails>(request);
         BLO.InsuredMasterDetailsResponse result = _adminRepository.InsuredOperation(req);
         return(_mapper.Map <BLO.InsuredMasterDetailsResponse, RR.InsuredMasterDetailsResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.InsuredMasterDetailsResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    string opertaion = string.Empty;

                    master.IsSessionAvailable();
                    var userInfo = CommonMethods.GetUserDetails();
                    var service  = CommonMethods.GetLogedInService();
                    var details  = new BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredMasterDetails
                    {
                        CPR         = HttpUtility.HtmlDecode(txtCPR.Text),
                        FirstName   = HttpUtility.HtmlDecode(txtFirstName.Text),
                        MiddleName  = HttpUtility.HtmlDecode(txtMiddleName.Text),
                        LastName    = HttpUtility.HtmlDecode(txtLastName.Text),
                        Gender      = HttpUtility.HtmlDecode(ddlGender.SelectedValue),
                        Flat        = HttpUtility.HtmlDecode(txtFlat.Text),
                        Building    = HttpUtility.HtmlDecode(txtBuilding.Text),
                        Road        = HttpUtility.HtmlDecode(txtRoad.Text),
                        Block       = HttpUtility.HtmlDecode(txtBlock.Text),
                        Area        = HttpUtility.HtmlDecode(ddlArea.SelectedValue),
                        Mobile      = HttpUtility.HtmlDecode(txtMobile.Text),
                        Email       = HttpUtility.HtmlDecode(txtEmail.Text),
                        Nationality = HttpUtility.HtmlDecode(ddlNationality.SelectedValue),
                        Occupation  = HttpUtility.HtmlDecode(txtOccupation.Text),
                        DateOfBirth = txtDateOfBirth.Text.CovertToCustomDateTime(),
                        PassportNo  = HttpUtility.HtmlDecode(txtPassport.Text),

                        IsActive = true
                    };

                    opertaion = HttpUtility.HtmlDecode((sender as Button).Text);

                    if (opertaion == "Update")
                    {
                        details.InsuredId = _InsuredID;
                        details.Type      = "edit";
                    }
                    else
                    {
                        if (ValidateCPR(details.CPR, userInfo, service))
                        {
                            return;
                        }
                        details.Type = "insert";
                    }
                    details.Agency    = userInfo.Agency;
                    details.AgentCode = userInfo.AgentCode;

                    var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                    <BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredMasterDetailsResponse>,
                                                    BKIC.SellingPoint.DTO.RequestResponseWrappers.InsuredMasterDetails>
                                      (BKIC.SellingPoint.DTO.Constants.AdminURI.InsuredMasterOperation, details);

                    if (results.StatusCode == 200 && results.Result.IsTransactionDone)
                    {
                        master.ShowLoading = false;
                        if (details.Type == "insert")
                        {
                            if (PageType == 1)
                            {
                                Response.Redirect("DomesticHelp.aspx?CPR=" + details.CPR + "&InsuredCode=" + results.Result.InsuredCode + "&InsuredName=" + results.Result.InsuredName);
                            }
                            else if (PageType == 2)
                            {
                                Response.Redirect("Travelnsurance.aspx?CPR=" + details.CPR + "&InsuredCode=" + results.Result.InsuredCode + "&InsuredName=" + results.Result.InsuredName + "&DOB=" + details.DateOfBirth.ConvertToLocalFormat());
                            }
                            else if (PageType == 3)
                            {
                                Response.Redirect("HomeInsurancePage.aspx?CPR=" + details.CPR + "&InsuredCode=" + results.Result.InsuredCode + "&InsuredName=" + results.Result.InsuredName);
                            }
                            else if (PageType == 4)
                            {
                                Response.Redirect("MotorInsurance.aspx?CPR=" + details.CPR + "&InsuredCode=" + results.Result.InsuredCode + "&InsuredName=" + results.Result.InsuredName + "&DOB=" + details.DateOfBirth.ConvertToLocalFormat());
                            }
                            else if (PageType == 5)
                            {
                                Response.Redirect("MotorTransferEndorsement.aspx?CPR=" + details.CPR + "&InsuredCode=" + results.Result.InsuredCode + "&InsuredName=" + results.Result.InsuredName + "&DOB=" + details.DateOfBirth.ConvertToLocalFormat());
                            }
                            else
                            {
                                master.ShowErrorPopup("Insured Details Saved Successfully", "Insured");
                            }
                        }
                        else if (details.Type == "edit")
                        {
                            master.ShowErrorPopup("Insured Details Updated Successfully", "Insured");
                        }
                        ClearControl();
                        btnSubmit.Text = "Save";
                    }
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }