コード例 #1
0
        public async Task <AgentThirdPartyGetRes> GetPartnerAgentContactDetails(AgentThirdPartyGetReq request, string ticket)
        {
            AgentThirdPartyGetRes response = new AgentThirdPartyGetRes();

            response = await serviceProxy.PostData(_configuration.GetValue <string>("AgentService:GetPartnerAgentContactDetails"), request, typeof(AgentThirdPartyGetRes), ticket);

            return(response);
        }
コード例 #2
0
ファイル: AgentProviders.cs プロジェクト: dilip07156/CoreUI
        public async Task <AgentThirdPartyGetRes> GetPartnerAgentContactDetails(AgentThirdPartyGetReq agentGetReq, string ticket)
        {
            AgentThirdPartyGetRes agentGetRes = new AgentThirdPartyGetRes();

            agentGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("AgentService:GetPartnerAgentContactDetails"), agentGetReq, typeof(AgentThirdPartyGetRes), ticket);

            return(agentGetRes);
        }
コード例 #3
0
        public async Task <AgentThirdPartyGetRes> GetPartnerAgentContactDetails([FromBody] AgentThirdPartyGetReq request)
        {
            var response = new AgentThirdPartyGetRes();

            try
            {
                response = await _agentRepository.GetPartnerAgentContactDetails(request);

                response.ResponseStatus.ErrorMessage = response.ContactId != null ? "" : "No Records Found.";
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
コード例 #4
0
        public async Task <IActionResult> UpdateAgentContactInfo([FromBody] AgentContactPartnerReq model)
        {
            ManageAgentContactReq request = new ManageAgentContactReq();
            var response = new AgentThirdPartyGetRes();

            try
            {
                if (!ModelState.IsValid)
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "Request is not valid";
                    return(BadRequest(ModelState));
                }
                else
                {
                    if (model != null)
                    {
                        request = SetAgentContactInfoWithModel(model);
                        IntegrationLoginResponse objTokenResponse = loginProviders.GetIntegrationToken(request.CredentialInfo).Result;
                        if (string.Compare(objTokenResponse.Message, "Success", true) == 0 && objTokenResponse.Token != "")
                        {
                            request.ContactMappingInfo.CreateUser  = objTokenResponse.UserInfo.UserName;
                            request.ContactMappingInfo.Application = request.CredentialInfo.Source;
                            request.Token = objTokenResponse.Token;
                            request.LoggedInUserContactId = objTokenResponse.UserInfo.Contact_Id;
                            //request.ContactMappingInfo.CreateUser = objTokenResponse.UserInfo.u

                            AgentThirdPartyGetReq CompanyInfoRequest = new AgentThirdPartyGetReq();
                            CompanyInfoRequest.PartnerEntityCode = request.CompanyId;
                            CompanyInfoRequest.Application       = request.ContactMappingInfo.Application;

                            var CompanyInfo = agentProviders.GetPartnerAgentDetails(CompanyInfoRequest, objTokenResponse.Token).Result;
                            if (CompanyInfo != null && string.IsNullOrEmpty(CompanyInfo.CompanyId))
                            {
                                response.ResponseStatus.Status       = "Failure";
                                response.ResponseStatus.ErrorMessage = "Company/Agent details doesn't exists.";
                                return(NotFound(response.ResponseStatus));
                            }
                            request.SelectedCompanyId = CompanyInfo.CompanyId;

                            AgentThirdPartyGetReq ContactInfoRequest = new AgentThirdPartyGetReq();
                            ContactInfoRequest.PartnerEntityCode = request.ContactMappingInfo.PartnerEntityCode;
                            ContactInfoRequest.PartnerEntityName = request.ContactMappingInfo.PartnerEntityName;
                            ContactInfoRequest.Application       = request.ContactMappingInfo.Application;

                            var ContactInfo = agentProviders.GetPartnerAgentContactDetails(ContactInfoRequest, objTokenResponse.Token).Result;
                            request.SelectedContactId = ContactInfo.ContactId;
                            if (ContactInfo != null && !string.IsNullOrEmpty(request.SelectedCompanyId) && string.IsNullOrEmpty(ContactInfo.ContactId))
                            {
                                response.ResponseStatus.Status       = "Failure";
                                response.ResponseStatus.ErrorMessage = "Contact details doesn't exists.";
                                return(NotFound(response.ResponseStatus));
                            }

                            //Update Contact against the agent/contact
                            response = agentProviders.UpdatePartnerAgentContactDetails(request, objTokenResponse.Token).Result;
                        }
                        else
                        {
                            return(Unauthorized());
                        }
                    }
                    else
                    {
                        response.ResponseStatus.Status       = "Failure";
                        response.ResponseStatus.ErrorMessage = "Contact Info details can not be save due to error.";
                        return(BadRequest(response.ResponseStatus));
                    }
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message.ToString();
                return(BadRequest(response.ResponseStatus));
            }
            //return Ok(response.ResponseStatus);
            return(Ok(new { Status = response.ResponseStatus.Status, ErrorMessage = response.ResponseStatus.ErrorMessage, StatusMessage = response.ResponseStatus.StatusMessage, Id = response.ContactId }));
        }