コード例 #1
0
        public bool ValidateCPR(string CPR, OAuthTokenResponse userInfo, DataServiceManager service)
        {
            bool isCPRExist = false;

            if (!string.IsNullOrEmpty(CPR))
            {
                var req = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyUserRequest
                {
                    Agency    = userInfo.Agency,
                    AgentCode = userInfo.AgentCode,
                    CPR       = CPR
                };

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

                if (insuredResult.StatusCode == 200 && insuredResult.Result.IsTransactionDone &&
                    insuredResult.Result.AgencyInsured.Count > 0)
                {
                    master.ShowErrorPopup("The CPR is already exists !!!", "CPR");
                    isCPRExist = true;
                }
                return(isCPRExist);
            }
            return(isCPRExist);
        }
コード例 #2
0
 // [ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin, BKIC.SellingPont.DTO.Constants.Roles.BranchAdmin)]
 public RR.AgencyUserResponse GetAgencyUsers(RR.AgencyUserRequest request)
 {
     try
     {
         BLO.AgencyUserRequest  req    = _mapper.Map <RR.AgencyUserRequest, BLO.AgencyUserRequest>(request);
         BLO.AgencyUserResponse result = _adminRepository.GetAgencyUser(req);
         return(_mapper.Map <BLO.AgencyUserResponse, RR.AgencyUserResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.AgencyUserResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
コード例 #3
0
        private void GetUserByUserName()
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            ClearControl();
            ClearAdminControl();
            btnSubmit.Text = "Save";

            var req = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyUserRequest
            {
                Agency    = userInfo.Agency,
                AgentCode = userInfo.AgentCode,
                UserName  = txtSearchUser.Text.Trim()
            };


            var userResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                               <BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyUserResponse>,
                                               BKIC.SellingPoint.DTO.RequestResponseWrappers.AgencyUserRequest>
                                 (BKIC.SellingPoint.DTO.Constants.AdminURI.GetAgencyUsers, req);

            if (userResult.StatusCode == 200 && userResult.Result.IsTransactionDone &&
                userResult.Result.AgencyUsers.Count > 0)
            {
                var user = userResult.Result.AgencyUsers[0];

                if (ViewState["UserId"] != null)
                {
                    ViewState["UserId"] = string.Empty;
                }
                ViewState["UserId"] = user.Id;

                ddlAgency.SelectedIndex      = ddlAgency.Items.IndexOf(ddlAgency.Items.FindByText(user.Agency));
                ddlAgentBranch.SelectedIndex = ddlAgentBranch.Items.IndexOf(ddlAgentBranch.Items.FindByValue(user.AgentBranch));
                ddlAgentCode.SelectedIndex   = ddlAgentCode.Items.IndexOf(ddlAgentCode.Items.FindByText(user.AgentCode));
                ddlRole.SelectedIndex        = ddlRole.Items.IndexOf(ddlRole.Items.FindByValue(user.Role));
                txtStaffNo.Text = user.StaffNo.ToString();
                txtUserId.Text  = user.UserId;
                txtMobile.Text  = user.Mobile;

                if (user.Role == BKIC.SellingPoint.DL.Constants.Roles.SuperAdmin)
                {
                    txtAdEmail.Text      = user.Email;
                    txtAdPassword.Text   = string.Empty;
                    txtAdConfirmPwd.Text = string.Empty;
                    txtAdUserName.Text   = user.UserName;
                }
                else
                {
                    txtEmail.Text      = user.Email;
                    txtPassword.Text   = string.Empty;
                    txtConfirmPwd.Text = string.Empty;
                    txtUserName.Text   = user.UserName;
                }
                if (ddlRole.SelectedItem.Value == BKIC.SellingPoint.DL.Constants.Roles.BranchAdmin ||
                    ddlRole.SelectedItem.Value == BKIC.SellingPoint.DL.Constants.Roles.User)
                {
                    admindetails.Visible = false;
                    userdetails.Visible  = true;
                }
                if (ddlRole.SelectedItem.Value == BKIC.SellingPoint.DL.Constants.Roles.SuperAdmin)
                {
                    userdetails.Visible  = false;
                    admindetails.Visible = true;
                }
                btnSubmit.Text = "Update";
            }
            else
            {
                master.ShowErrorPopup("User not found", "User");
                ClearControl();
                btnSubmit.Text = "Save";
            }
        }