コード例 #1
0
        public IActionResult GetPartnerQuoteDetails(QuoteThirdPartyGetReq model)
        {
            QuoteThirdPartyGetRes response = new QuoteThirdPartyGetRes();

            response = salesProviders.GetPartnerQuoteDetails(model, token).Result;

            if (response != null && !string.IsNullOrEmpty(response.QRFID) && !string.IsNullOrEmpty(response.CurrentPipeline))
            {
                if (string.Compare(response.CurrentPipeline, _configuration.GetValue <string>("PipeLines:Quote"), true) == 0)
                {
                    return(RedirectToAction("NewQuote", new { QRFID = response.QRFID, PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation }));
                }
                else if (string.Compare(response.CurrentPipeline, _configuration.GetValue <string>("PipeLines:Costing"), true) == 0)
                {
                    return(RedirectToAction("Itinerary", "Itinerary", new { QRFID = response.QRFID, PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation }));
                }
                else if (string.Compare(response.CurrentPipeline, _configuration.GetValue <string>("PipeLines:CostingApproval"), true) == 0)
                {
                    return(RedirectToAction("Itinerary", "Itinerary", new { QRFID = response.QRFID, PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation }));
                }
                else if (string.Compare(response.CurrentPipeline, _configuration.GetValue <string>("PipeLines:Amendment"), true) == 0)
                {
                    return(RedirectToAction("Itinerary", "Amendment", new { QRFID = response.QRFID, PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation }));
                }
                else if (string.Compare(response.CurrentPipeline, _configuration.GetValue <string>("PipeLines:AgentApproval"), true) == 0)
                {
                    return(RedirectToAction("Itinerary", "AgentApproval", new { QRFID = response.QRFID, PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation }));
                }
                else if (string.Compare(response.CurrentPipeline, _configuration.GetValue <string>("PipeLines:Handover"), true) == 0)
                {
                    return(RedirectToAction("Itinerary", "Handover", new { QRFID = response.QRFID, PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation }));
                }
            }
            else
            {
                AgentThirdPartyGetRes responseNew = new AgentThirdPartyGetRes();
                responseNew = agentProviders.GetPartnerAgentContactDetails(new AgentThirdPartyGetReq()
                {
                    Application = model.Application, PartnerEntityCode = model.PartnerEntityContactCode, PartnerEntityName = ""
                }, token).Result;
                if (responseNew != null)
                {
                    return(RedirectToAction("NewQuote", new { PartnerEntityCode = model.PartnerEntityCode, Application = model.Application, Module = model.Module, Operation = model.Operation, ContactId = responseNew.ContactId, CompanyId = responseNew.CompanyId }));
                }
                return(View("IntegrationError"));
            }

            return(View("IntegrationError"));
        }
コード例 #2
0
        public async Task <IActionResult> CreateAgentContactInfo([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;

                            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(ContactInfo.CompanyId) && !string.IsNullOrEmpty(ContactInfo.ContactId))
                            {
                                response.ResponseStatus.Status       = "Failure";
                                response.ResponseStatus.ErrorMessage = "Contact details already exists.";
                                return(BadRequest(response.ResponseStatus));
                            }

                            //Insert Contact against the agent/contact
                            response = agentProviders.CreatePartnerAgentContactDetails(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 }));
        }