Beispiel #1
0
        public GetLeadAdapterResponse GetLeadAdapter(GetLeadAdapterRequest request)
        {
            GetLeadAdapterResponse response = new GetLeadAdapterResponse();

            Logger.Current.Verbose("Request to fetch LeadAdapter based on leadAdapterId" + request.Id);
            LeadAdapterAndAccountMap leadAdapter = leadAdaptersRepository.FindBy(request.Id);

            if (leadAdapter == null)
            {
                response.Exception = GetLeadAdapterNotFoundException();
            }
            else
            {
                if (leadAdapter.LeadAdapterTypeID != LeadAdapterTypes.Facebook)
                {
                    FTPAgent agent      = new FTPAgent();
                    var      ftpDetails = agent.GetFtpRegistration(leadAdapter.RequestGuid);
                    if (ftpDetails != null)
                    {
                        leadAdapter.Url       = ftpDetails.Host;
                        leadAdapter.UserName  = ftpDetails.UserName;
                        leadAdapter.Password  = ftpDetails.Password;
                        leadAdapter.EnableSsl = ftpDetails.EnableSsl;
                        leadAdapter.Port      = ftpDetails.Port;
                    }
                }
                LeadAdapterViewModel leadAdapterViewModel = Mapper.Map <LeadAdapterAndAccountMap, LeadAdapterViewModel>(leadAdapter);
                response.LeadAdapterViewModel = leadAdapterViewModel;
            }
            return(response);
        }
        public ActionResult EditLeadAdapter(int leadAdapterID)
        {
            LeadAdapterViewModel   viewModel = new LeadAdapterViewModel();
            GetLeadAdapterResponse response  = leadAdapterService.GetLeadAdapter(new GetLeadAdapterRequest(leadAdapterID));

            if (response != null)
            {
                viewModel = response.LeadAdapterViewModel;
            }
            var dropdownValues = cachingService.GetDropdownValues(this.Identity.ToAccountID());

            viewModel.LeadSourceDropdownValues = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.LeadSources)
                                                 .Select(s => s.DropdownValuesList).FirstOrDefault()
                                                 .Where(d => d.IsActive == true);
            ViewBag.FacebookAPPId = leadAdapterService.GetFacebookApp(new GetFacebookAppRequest()
            {
                AccountId = this.Identity.ToAccountID()
            }).FacebookAppID;
            return(View("AddEditLeadAdapter", viewModel));
        }
        public HttpResponseMessage GetLeadadapter(GetLeadAdapterRequest request)
        {
            GetLeadAdapterResponse response = leadAdapterService.GetLeadAdapter(request);

            return(Request.BuildResponse(response));
        }