Esempio n. 1
0
        public ActionResult AddUpdateThirdPartyOrbCredential(ThirdPartyAPICredentialsEntity model)
        {
            ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            try
            {
                model.ThirdPartyProvider = ThirdPartyProvider.ORB.ToString();
                string Message = fac.InsertUpdateThirdPartyAPICredentials(model, Helper.oUser.UserId);
                if (string.IsNullOrEmpty(Message))
                {
                    //fac.RefreshThirdPartyAPICredentials(ThirdPartyProvider.ORB.ToString());
                    if (model.CredentialId > 0)
                    {
                        return(Json(new { result = true, Message = CommonMessagesLang.msgCommanUpdateMessage }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { result = true, Message = CommonMessagesLang.msgCommanInsertMessage }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { result = false, Message = CommonMessagesLang.msgCommanErrorMessage }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, Message = CommonMessagesLang.msgCommanErrorMessage }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        public static SelectList GetAPITypeForThirdPartyAPICredentialsForEnrichment(string ConnectionString, string APIFamily)
        {
            List <ThirdPartyAPIForEnrichmentEntity> lstThirdPartyAPICredentials = new List <ThirdPartyAPIForEnrichmentEntity>();
            ThirdPartyAPICredentialsFacade          fac = new ThirdPartyAPICredentialsFacade(ConnectionString);

            lstThirdPartyAPICredentials = fac.GetAPITypeForUXDefaultUXEnrichment();
            List <SelectListItem> lstAPICredentials = new List <SelectListItem>();

            if (APIFamily == "DirectPlus")
            {
                lstThirdPartyAPICredentials = lstThirdPartyAPICredentials.Where(x => x.APIFamily == "DirectPlus").GroupBy(x => x.DnBAPIId).Select(g => g.First()).ToList();
            }
            else if (APIFamily == "Direct20")
            {
                lstThirdPartyAPICredentials = lstThirdPartyAPICredentials.Where(x => x.APIFamily == "Direct20").GroupBy(x => x.DnBAPIId).Select(g => g.First()).ToList();
            }
            else if (APIFamily == "")
            {
                lstThirdPartyAPICredentials = lstThirdPartyAPICredentials.Where(x => x.APIFamily == "").GroupBy(x => x.DnBAPIId).Select(g => g.First()).ToList();
            }
            foreach (var item in lstThirdPartyAPICredentials)
            {
                lstAPICredentials.Add(new SelectListItem {
                    Value = item.DnBAPIId.ToString(), Text = item.APIType.ToString() + "-" + item.DnBAPIName.ToString()
                });
            }
            return(new SelectList(lstAPICredentials, "Value", "Text"));
        }
Esempio n. 3
0
        public ActionResult IndexThirdPartyAPICredentials()
        {
            ThirdPartyAPICredentialsFacade        fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
            List <ThirdPartyAPICredentialsEntity> lstThirdPartyAPICredentials = fac.GetThirdPartyAPICredentials(ThirdPartyProvider.ORB.ToString());

            return(PartialView("~/Views/OI/OISetting/_indexThirdPartyAPICredentials.cshtml", lstThirdPartyAPICredentials));
        }
Esempio n. 4
0
        public JsonResult DeleteThirdPartyAPICredentials(string Parameters)
        {
            int CredentialId = 0;

            // Get Query string in Encrypted mode and decrypt Query string and set Parameters
            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters   = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                CredentialId = Convert.ToInt32(Parameters);

                // Delete specific Third Party API Credentials
                string Message = string.Empty;
                ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
                Message = fac.DeleteThirdPartyAPICredentials(CredentialId, Helper.oUser.UserId);
                if (string.IsNullOrEmpty(Message))
                {
                    return(Json(new { result = true, Message = CommonMessagesLang.msgCommanUpdateMessage }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { result = false, Message = Message }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { result = false, Message = CommonMessagesLang.msgInvadilState }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 5
0
        public ActionResult GetDandBCredentials()
        {
            ThirdPartyAPICredentialsFacade        fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
            List <ThirdPartyAPICredentialsEntity> lstThirdPartyAPICredentials = fac.GetThirdPartyAPICredentials(ThirdPartyProvider.DNB.ToString());

            return(View("~/Views/DNBLicence/DnBLicenseCredential.cshtml", lstThirdPartyAPICredentials));
        }
Esempio n. 6
0
 public ActionResult SetDefaultKeysForEnrichment(ThirdPartyAPIForEnrichmentEntity model)
 {
     try
     {
         ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
         fac.UpdateUXDefaultCredentialsForEnrichment(model.EnrichmentType, model.DnBAPIId, model.CredentialId);
         return(Json(new { result = true, Message = DandBSettingLang.msgSettingUpdate }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { result = false, Message = CommonMessagesLang.msgSomethingWrong }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 7
0
 public ActionResult SetEntitleMentsForCreds(EntitlementsViewModel entitlements)
 {
     try
     {
         ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
         fac.UpsertDnBAPIEntitlements(entitlements.CredentialId, entitlements.DnBAPIId);
         return(Json(new { result = true, Message = CommonMessagesLang.msgCommanUpdateMessage }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { result = false, Message = CommonMessagesLang.msgCommanErrorMessage }, JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult GetThirdPartyAPICredentials(string Parameters)
        {
            string Provider = string.Empty;

            if (!string.IsNullOrEmpty(Parameters))
            {
                Provider = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
            }
            List <ThirdPartyAPICredentialsEntity> lstThirdPartyAPICredentials = new List <ThirdPartyAPICredentialsEntity>();
            ThirdPartyAPICredentialsFacade        fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            lstThirdPartyAPICredentials = fac.GetThirdPartyAPICredentials(Provider);
            return(Json(lstThirdPartyAPICredentials, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
        public ActionResult SetDefaultInteractiveKeys(ThirdPartyAPIEntity model)
        {
            try
            {
                List <string> lstCodes             = new List <string>();
                List <string> credIds              = new List <string>();
                ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
                if (Helper.LicenseBuildAList)
                {
                    lstCodes.Add("DNB_BUILD_A_LIST");
                    credIds.Add(model.DNB_BUILD_A_LIST);
                }

                if (Helper.LicenseEnableInvestigations)
                {
                    lstCodes.Add("DNB_INVESTIGATIONS");
                    credIds.Add(model.DNB_INVESTIGATIONS);
                }

                lstCodes.Add("DNB_SINGLE_ENTITY_SEARCH");
                credIds.Add(model.DNB_SINGLE_ENTITY_SEARCH);

                lstCodes.Add("DNB_TYPEAHEAD_SEARCH");
                credIds.Add(model.DNB_TYPEAHEAD_SEARCH);

                lstCodes.Add("GOOGLE");
                credIds.Add(model.GOOGLE);

                lstCodes.Add("DESCARTES");
                credIds.Add(model.DESCARTES);

                fac.UpdateUXDefaultCredentials(string.Join(",", lstCodes), string.Join(",", credIds), Helper.oUser.UserId);
                if (Helper.LicenseEnableCompliance)
                {
                    //Update Ownership creds
                    fac.UpdateUXDefaultCredentialsForEnrichment(model.TypeOWNERSHIP, model.OwnershipDnBAPIId, model.OwnershipCredId);
                    CommonMethod.GetUXDefaultUXEnrichments(this.CurrentClient.ApplicationDBConnectionString);
                }

                //update session for UX default Credentials(for Auth tokens)
                CommonMethod.GetThirdPartyAPICredentials(this.CurrentClient.ApplicationDBConnectionString);
                return(Json(new { result = true, Message = DandBSettingLang.msgSettingUpdate }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, Message = CommonMessagesLang.msgSomethingWrong }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 10
0
        public static SelectList GetThirdPartyAPICredentialsForEnrichment(string ConnectionString, string thirdPartyProvider)
        {
            List <ThirdPartyAPIForEnrichmentEntity> lstThirdPartyAPICredentials = new List <ThirdPartyAPIForEnrichmentEntity>();
            ThirdPartyAPICredentialsFacade          fac = new ThirdPartyAPICredentialsFacade(ConnectionString);

            lstThirdPartyAPICredentials = fac.GetThirdPartyAPICredentialsForEhrichment(thirdPartyProvider);
            List <SelectListItem> lstAPICredentials = new List <SelectListItem>();

            foreach (var item in lstThirdPartyAPICredentials)
            {
                lstAPICredentials.Add(new SelectListItem {
                    Value = item.CredentialId.ToString() + "@#$" + item.APIType, Text = item.CredentialName.ToString()
                });
            }
            return(new SelectList(lstAPICredentials, "Value", "Text"));
        }
Esempio n. 11
0
        public ActionResult AddUpdateThirdPartyOrbCredential(string Parameters)
        {
            int CredentialId = 0;
            ThirdPartyAPICredentialsEntity model = new ThirdPartyAPICredentialsEntity();
            ThirdPartyAPICredentialsFacade fac   = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters   = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                CredentialId = Convert.ToInt32(Parameters);
                if (CredentialId > 0)
                {
                    model = fac.GetThirdPartyAPICredentialsById(CredentialId);
                }
            }
            return(View("~/Views/OI/OISetting/AddUpdateThirdPartyOrbCredential.cshtml", model));
        }
Esempio n. 12
0
        public ActionResult DefaultKeysForEnrichment()
        {
            ThirdPartyAPICredentialsFacade   fac   = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
            ThirdPartyAPIForEnrichmentEntity model = new ThirdPartyAPIForEnrichmentEntity();

            List <ThirdPartyAPIForEnrichmentEntity> uxCreds = new List <ThirdPartyAPIForEnrichmentEntity>();

            uxCreds = fac.GetUXDefaultUXEnrichments();
            model.EnrichmentType = uxCreds.FirstOrDefault(x => x.EnrichmentType == "FIRMOGRAPHICS").EnrichmentType;
            model.CredentialId   = uxCreds.FirstOrDefault(x => x.EnrichmentType == "FIRMOGRAPHICS").CredentialId;
            model.DnBAPIId       = uxCreds.FirstOrDefault(x => x.EnrichmentType == "FIRMOGRAPHICS").DnBAPIId;

            List <ThirdPartyAPICredentialsEntity> lst = JsonConvert.DeserializeObject <List <ThirdPartyAPICredentialsEntity> >(SessionHelper.ThirdPartyAPI);

            model.APIType = lst.FirstOrDefault(x => x.CredentialId == model.CredentialId).APIType;
            return(View(model));
        }
Esempio n. 13
0
        public ActionResult IndexOILicense()
        {
            List <ThirdPartyAPICredentialsEntity> lstThirdPartyAPICredentials = new List <ThirdPartyAPICredentialsEntity>();
            ThirdPartyAPICredentialsFacade        fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            lstThirdPartyAPICredentials = fac.GetThirdPartyAPICredentials(ThirdPartyProvider.ORB.ToString());
            OISettingEntity Orbmodel = new OISettingEntity();

            if (lstThirdPartyAPICredentials != null && lstThirdPartyAPICredentials.Any())
            {
                Orbmodel.ORB_API_KEY = lstThirdPartyAPICredentials.FirstOrDefault().APICredential;
            }

            // MP-1046 Create Individual URL redirection for all Tabs to make better format for URL
            ViewBag.SelectedTab = "OI Auto Acceptance";
            return(PartialView("~/Views/OI/OISetting/IndexOILicense.cshtml", Orbmodel));
        }
Esempio n. 14
0
        public ActionResult DnBLicenseCredential()
        {
            ThirdPartyAPICredentialsFacade        fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
            List <ThirdPartyAPICredentialsEntity> lstThirdPartyAPICredentials = fac.GetThirdPartyAPICredentials(ThirdPartyProvider.DNB.ToString());

            SessionHelper.ThirdPartyAPI = JsonConvert.SerializeObject(lstThirdPartyAPICredentials);

            // MP-1046 Create Individual URL redirection for all Tabs to make better format for URL
            if (Request.Headers["X-PJAX"] == "true")
            {
                return(View(lstThirdPartyAPICredentials));
            }
            else
            {
                ViewBag.SelectedTab = "License";
                return(View("~/Views/DandB/Index.cshtml", lstThirdPartyAPICredentials));
            }
        }
Esempio n. 15
0
        public static List <ThirdPartyAPICredentialsEntity> GetCredentials(string connectionString, string thirdPartyProvider, string APIType)
        {
            ThirdPartyAPICredentialsFacade        fac = new ThirdPartyAPICredentialsFacade(connectionString);
            List <ThirdPartyAPICredentialsEntity> lst = fac.GetThirdPartyAPICredentials(thirdPartyProvider);

            if (APIType == "DirectPlus")
            {
                lst = lst.Where(x => x.APIType == "DirectPlus").GroupBy(x => x.CredentialName).Select(g => g.First()).ToList();
            }
            else if (APIType == "Direct20")
            {
                lst = lst.Where(x => x.APIType == "Direct20").GroupBy(x => x.CredentialName).Select(g => g.First()).ToList();
            }
            lst.Insert(0, new ThirdPartyAPICredentialsEntity
            {
                CredentialName = "--Select--"
            });
            return(lst);
        }
Esempio n. 16
0
        public JsonResult DeleteThirdPartyAPICredentials(string Parameters)
        {
            int CredentialId = 0;

            // Get Query string in Encrypted mode and decrypt Query string and set Parameters
            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
            }
            CredentialId = Convert.ToInt32(Parameters);
            // Delete specific user
            string Message = string.Empty;
            ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            Message = fac.DeleteThirdPartyAPICredentials(CredentialId, Helper.oUser.UserId);
            if (Message == "")
            {
                Message = CommonMessagesLang.msgCommanDeleteMessage;
            }
            return(Json(Message));
        }
Esempio n. 17
0
        public ActionResult DefaultInteractiveKeys()
        {
            ThirdPartyAPICredentialsFacade          fac           = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
            ThirdPartyAPIEntity                     model         = new ThirdPartyAPIEntity();
            List <UXDefaultCredentialsEntity>       uxCreds       = fac.GetUXDefaultCredentials();
            List <ThirdPartyAPIForEnrichmentEntity> uxEnrichCreds = new List <ThirdPartyAPIForEnrichmentEntity>();

            uxEnrichCreds = fac.GetUXDefaultUXEnrichments();
            ThirdPartyAPIForEnrichmentEntity enrichModel = uxEnrichCreds.FirstOrDefault(x => x.EnrichmentType == "OWNERSHIP");

            model.DNB_BUILD_A_LIST         = Convert.ToString(uxCreds.FirstOrDefault(x => x.Code == "DNB_BUILD_A_LIST")?.CredentialId);
            model.DNB_INVESTIGATIONS       = Convert.ToString(uxCreds.FirstOrDefault(x => x.Code == "DNB_INVESTIGATIONS")?.CredentialId);
            model.DNB_SINGLE_ENTITY_SEARCH = Convert.ToString(uxCreds.FirstOrDefault(x => x.Code == "DNB_SINGLE_ENTITY_SEARCH")?.CredentialId);
            model.DNB_TYPEAHEAD_SEARCH     = Convert.ToString(uxCreds.FirstOrDefault(x => x.Code == "DNB_TYPEAHEAD_SEARCH")?.CredentialId);
            model.GOOGLE            = Convert.ToString(uxCreds.FirstOrDefault(x => x.Code == "GOOGLE")?.CredentialId);
            model.DESCARTES         = Convert.ToString(uxCreds.FirstOrDefault(x => x.Code == "DESCARTES")?.CredentialId);
            model.OwnershipCredId   = uxEnrichCreds.FirstOrDefault(x => x.EnrichmentType == "OWNERSHIP").CredentialId;
            model.OwnershipDnBAPIId = uxEnrichCreds.FirstOrDefault(x => x.EnrichmentType == "OWNERSHIP").DnBAPIId;
            model.TypeOWNERSHIP     = uxEnrichCreds.FirstOrDefault(x => x.EnrichmentType == "OWNERSHIP").EnrichmentType;
            return(View(model));
        }
Esempio n. 18
0
        public List <SelectListItem> SyncRegistration()
        {
            List <SelectListItem>          lstMonitoringRegistrations = new List <SelectListItem>();
            ThirdPartyAPICredentialsFacade thirdAPIFac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            //Get DirectPlus Credentials
            List <ThirdPartyAPICredentialsEntity> lstAuth = thirdAPIFac.GetThirdPartyAPICredentials(ThirdPartyProvider.DNB.ToString());

            if (lstAuth != null && lstAuth.Any())
            {
                List <ThirdPartyAPICredentialsEntity> lstDirectPlusAuth = lstAuth.Where(x => x.APIType.ToLower() == ApiLayerType.Directplus.ToString().ToLower()).ToList();
                if (lstDirectPlusAuth != null && lstDirectPlusAuth.Any())
                {
                    foreach (var authItem in lstDirectPlusAuth)
                    {
                        ListMonitoringRegistrationResponse objtMonitoringRegistrationResponse = GetListMonitoringRegistrationResponse(authItem.AuthToken);
                        if (objtMonitoringRegistrationResponse != null && objtMonitoringRegistrationResponse.messages != null && objtMonitoringRegistrationResponse.messages.references != null)
                        {
                            SettingFacade fac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);
                            string        NotDeleteRegistration = string.Join(",", objtMonitoringRegistrationResponse.messages.references.ToArray());
                            //sync DPMRegistration Name
                            fac.DeleteAllDPMRegistration(NotDeleteRegistration, authItem.CredentialId);
                            foreach (var item in objtMonitoringRegistrationResponse.messages.references)
                            {
                                MonitoringRegistrationDetailResponse monitoringRegistrationDetailResponse = new MonitoringRegistrationDetailResponse();
                                monitoringRegistrationDetailResponse = GetMonitoringRegistrationDetailResponse(item.ToString(), authItem.AuthToken);
                                //insert Registration name in database
                                fac.DPMInsertRegistration(monitoringRegistrationDetailResponse.messages.registration.reference, monitoringRegistrationDetailResponse.messages.registration.Tags, monitoringRegistrationDetailResponse.messages.notificationsSuppressed, monitoringRegistrationDetailResponse.messages.registration.productId, monitoringRegistrationDetailResponse.messages.registration.versionId, monitoringRegistrationDetailResponse.messages.registration.email, monitoringRegistrationDetailResponse.messages.registration.fileTransferProfile, monitoringRegistrationDetailResponse.messages.registration.description, monitoringRegistrationDetailResponse.messages.registration.deliveryTrigger, monitoringRegistrationDetailResponse.messages.registration.deliveryFrequency, monitoringRegistrationDetailResponse.messages.dunsCount, monitoringRegistrationDetailResponse.messages.registration.seedData, authItem.CredentialId, monitoringRegistrationDetailResponse.messages.registration.blockIds);
                                //insert Registration name in List
                                lstMonitoringRegistrations.Add(new SelectListItem {
                                    Value = item.ToString(), Text = item.ToString()
                                });
                            }
                        }
                    }
                }
            }
            return(lstMonitoringRegistrations);
        }
Esempio n. 19
0
 public ActionResult AddUpdateThirdPartyDandBCredential(ThirdPartyAPICredentialsEntity model)
 {
     ModelState.Remove("Tag");
     try
     {
         if (ModelState.IsValid)
         {
             ThirdPartyAPICredentialsFacade fac = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);
             model.ThirdPartyProvider = ThirdPartyProvider.DNB.ToString();
             string Message = fac.InsertUpdateThirdPartyAPICredentials(model, Helper.oUser.UserId);
             if (string.IsNullOrEmpty(Message))
             {
                 fac.RefreshThirdPartyAPICredentials(ThirdPartyProvider.DNB.ToString());
                 CommonMethod.GetThirdPartyAPICredentials(this.CurrentClient.ApplicationDBConnectionString);
                 if (model.CredentialId > 0)
                 {
                     return(Json(new { result = true, Message = CommonMessagesLang.msgCommanUpdateMessage }, JsonRequestBehavior.AllowGet));
                 }
                 else
                 {
                     return(Json(new { result = true, Message = CommonMessagesLang.msgCommanInsertMessage }, JsonRequestBehavior.AllowGet));
                 }
             }
             else
             {
                 return(Json(new { result = false, Message = CommonMessagesLang.msgCommanErrorMessage }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             return(Json(new { result = false, Message = CommonMessagesLang.msgInvadilState }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { result = false, Message = CommonMessagesLang.msgCommanErrorMessage }, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 20
0
        public MainMatchEntity LoadData(string CompanyName, string Address, string Address2, string City, string State, string Country, string zip, string Phone, bool ExcludeNonHeadQuarters, bool ExcludeNonMarketable, bool ExcludeOutofBusiness, bool ExcludeUndeliverable, bool ExcludeUnreachable, string Language, string SrcRecId, string ConnectionString, string InputId)
        {
            MainMatchEntity objmainMatchEntity = new MainMatchEntity();

            try
            {
                // Checking APIType is there or not
                string APItype = CommonMethod.GetThirdPartyProperty(ThirdPartyCode.DNB_SINGLE_ENTITY_SEARCH.ToString(), ThirdPartyProperties.APIType.ToString());
                if (string.IsNullOrEmpty(APItype))
                {
                    objmainMatchEntity.ResponseErroeMessage = CommonMessagesLang.msgNoDefaultKeyForSearch;
                    return(objmainMatchEntity);
                }
                bool         IsDirectPlusCall = false;
                CommonMethod objCommon        = new CommonMethod();
                Utility      api       = new Utility();
                var          objResult = objCommon.LoadCleanseMatchSettings(ConnectionString);

                bool      IsGlobal = true;
                string    LOBTag = null;
                int       PageSize = 10, PageNumber = 1, SortOrder = 0, TotalRecords = 0;
                int       totalCount = 0;
                DataTable lstThirdPartyAPICredentials = new DataTable();
                ThirdPartyAPICredentialsFacade fac    = new ThirdPartyAPICredentialsFacade(ConnectionString);
                lstThirdPartyAPICredentials = fac.GetMinConfidenceSettingsListPaging(IsGlobal, LOBTag);
                int candidateMaxQuantity = 0, confidenceLowerLevelThresholdValue = 0;
                foreach (DataRow row in lstThirdPartyAPICredentials.Rows)
                {
                    candidateMaxQuantity = Convert.ToInt32(row["MaxCandidateQty"]);
                    confidenceLowerLevelThresholdValue = Convert.ToInt32(row["MinConfidenceCode"]);
                }

                CountryGroupModel.CountryISOAlpha2Enum objEnum = new CountryGroupModel.CountryISOAlpha2Enum();
                try
                {
                    objEnum = (CountryGroupModel.CountryISOAlpha2Enum)Enum.Parse(typeof(CountryGroupModel.CountryISOAlpha2Enum), Convert.ToString(Country));
                }
                catch
                {
                    objEnum = (CountryGroupModel.CountryISOAlpha2Enum)Enum.Parse(typeof(CountryGroupModel.CountryISOAlpha2Enum), "US");
                }
                try
                {
                    CompanyFacade fcd = new CompanyFacade(ConnectionString, Helper.oUser.UserName);
                    if (APItype.ToLower() == ApiLayerType.Directplus.ToString().ToLower())
                    {
                        IsDirectPlusCall = true;
                        response         = api.GetCleanseMatchResultDirectPlus(CompanyName, Address, Address2, City, State, objEnum, zip, Phone, ExcludeNonHeadQuarters, ExcludeNonMarketable, ExcludeOutofBusiness, ExcludeUndeliverable, ExcludeUnreachable, Language, candidateMaxQuantity, confidenceLowerLevelThresholdValue, ConnectionString, InputId);
                    }
                    else if (APItype.ToLower() == ApiLayerType.Direct20.ToString().ToLower())
                    {
                        response = api.GetCleanseMatchResult(CompanyName, Address, Address2, City, State, objEnum, zip, Phone, ExcludeNonHeadQuarters, ExcludeNonMarketable, ExcludeOutofBusiness, ExcludeUndeliverable, ExcludeUnreachable, candidateMaxQuantity, confidenceLowerLevelThresholdValue, ConnectionString, InputId);
                    }

                    if (response != null && response.TransactionResponseDetail != null)
                    {
                        objCommon.InsertAPILogs(response.TransactionResponseDetail, ConnectionString);
                        fcd.InsertCleanseMatchCallResults(SrcRecId, response.ResponseJSON, response.APIRequest, Helper.oUser.UserId, InputId);
                        objmainMatchEntity.lstMatches = response.MatchEntities;
                        objmainMatchEntity.lstMatches.ForEach(x => x.MatchDataCriteriaText = response?.TransactionResponseDetail?.MatchDataCriteriaText);
                    }
                    else
                    {
                        objmainMatchEntity.ResponseErroeMessage = CommonMessagesLang.msgResponseErroeMessage;
                    }
                    if (!string.IsNullOrEmpty(response?.ResponseJSON))
                    {
                        dynamic data = JObject.Parse(response.ResponseJSON);
                        if (data.error != null && !string.IsNullOrEmpty(data.error.errorMessage.Value))
                        {
                            objmainMatchEntity.ResponseErroeMessage = data.error.errorMessage.Value;
                        }
                    }
                }
                catch (WebException webEx)
                {
                    using (var stream = webEx.Response.GetResponseStream())
                        using (var streamReader = new StreamReader(stream))
                        {
                            var result = streamReader.ReadToEnd();
                            if (result != null)
                            {
                                var serializer = new JavaScriptSerializer();
                                if (IsDirectPlusCall == false)
                                {
                                    GetCleanseMatchResponseMain objResponse = serializer.Deserialize <GetCleanseMatchResponseMain>(result);
                                    if (objResponse != null && objResponse.GetCleanseMatchResponse != null && objResponse.GetCleanseMatchResponse.TransactionResult != null)
                                    {
                                        objmainMatchEntity.ResponseErroeMessage = objResponse.GetCleanseMatchResponse.TransactionResult.ResultText;
                                        //objCommon.InsertAPILogs(ConnectionString, null, null, objResponse.GetCleanseMatchResponse.TransactionResult.SeverityText, objResponse.GetCleanseMatchResponse.TransactionResult.ResultID, objResponse.GetCleanseMatchResponse.TransactionResult.ResultText, null, 0, null);
                                    }
                                }
                                else
                                {
                                    var settings = new JsonSerializerSettings {
                                        NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore
                                    };
                                    IdentityResolutionResponse objResponse = JsonConvert.DeserializeObject <IdentityResolutionResponse>(result, settings);
                                    if (objResponse != null)
                                    {
                                        objmainMatchEntity.ResponseErroeMessage = objResponse.error.errorMessage;
                                        objCommon.InsertAPILogs(ConnectionString, objResponse.transactionDetail.transactionID, Convert.ToDateTime(objResponse.transactionDetail.transactionTimestamp), null, null, objResponse.error.errorMessage, null, 0, null);
                                    }
                                }
                            }
                        }
                }
            }
            catch (Exception ex)
            {
                objmainMatchEntity.ResponseErroeMessage = CommonMessagesLang.msgResponseErroeMessage;
            }
            finally
            {
            }
            return(objmainMatchEntity);
        }
Esempio n. 21
0
        public ActionResult RegistrationNumberPopup(string Parameters)
        {
            MainMatchEntity mainMatchEntity = new MainMatchEntity();

            mainMatchEntity.lstMatches = new List <MatchEntity>();
            //Resert values for Display Input field in match detail view(popup)
            Helper.CompanyName = "";
            Helper.Address     = "";
            Helper.City        = "";
            Helper.State       = "";
            Helper.PhoneNbr    = "";
            Helper.Zip         = "";
            Helper.Address1    = "";

            string        RegistrationNoValue = string.Empty, type = string.Empty, CountryCode = string.Empty, SrcRecId = string.Empty, InputId = string.Empty;
            bool          IsCleanSearch = false;
            CompanyFacade fcd = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);

            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters          = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                RegistrationNoValue = Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 0, 1);
                type          = Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 1, 1);
                IsCleanSearch = Convert.ToBoolean(Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 2, 1));
                CountryCode   = Convert.ToString(Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 3, 1));
                SrcRecId      = Convert.ToString(Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 4, 1));
                InputId       = Convert.ToString(Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 5, 1));
            }
            CommonMethod objCommon = new CommonMethod();

            Utility.Utility api       = new Utility.Utility();
            var             objResult = objCommon.LoadCleanseMatchSettings(this.CurrentClient.ApplicationDBConnectionString);

            bool      IsGlobal = true;
            string    LOBTag = null;
            int       PageSize = 10, PageNumber = 1, SortOrder = 0;
            int       totalCount = 0;
            DataTable lstThirdPartyAPICredentials = new DataTable();
            ThirdPartyAPICredentialsFacade fac    = new ThirdPartyAPICredentialsFacade(this.CurrentClient.ApplicationDBConnectionString);

            lstThirdPartyAPICredentials = fac.GetMinConfidenceSettingsListPaging(IsGlobal, LOBTag);
            int confidenceLowerLevelThresholdValue = 0;

            foreach (DataRow row in lstThirdPartyAPICredentials.Rows)
            {
                confidenceLowerLevelThresholdValue = Convert.ToInt32(row["MinConfidenceCode"]);
            }

            List <MatchEntity>       lstMatchEntity = new List <MatchEntity>();
            IPagedList <MatchEntity> pagedSearch    = new StaticPagedList <MatchEntity>(lstMatchEntity, 1, 1, 1);
            string APItype = CommonMethod.GetThirdPartyProperty(ThirdPartyCode.DNB_SINGLE_ENTITY_SEARCH.ToString(), ThirdPartyProperties.APIType.ToString());

            try // Validate Api Family is DirectPlus or Direct20 than according to API family call method for response.
            {
                if (APItype.ToLower() == ApiLayerType.Directplus.ToString().ToLower())
                {
                    response = api.GetMatchByRegistrationNoDirectPlus(CountryCode, this.CurrentClient.ApplicationDBConnectionString, RegistrationNoValue);
                }
                else if (APItype.ToLower() == ApiLayerType.Direct20.ToString().ToLower())
                {
                    response = api.GetMatchByRegistrationNo(CountryCode, this.CurrentClient.ApplicationDBConnectionString, RegistrationNoValue);
                }
                else
                {
                    mainMatchEntity.ResponseErroeMessage = CommonMessagesLang.msgNoDefaultKeyForSearch;
                }
            }
            catch (WebException webEx)
            {
                using (var stream = webEx.Response.GetResponseStream())
                    using (var streamReader = new StreamReader(stream))
                    {
                        var result = streamReader.ReadToEnd();
                        if (result != null)
                        {
                            var serializer = new JavaScriptSerializer();


                            if (APItype.ToLower() == ApiLayerType.Directplus.ToString().ToLower())
                            {
                                var settings = new JsonSerializerSettings {
                                    NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore
                                };
                                IdentityResolutionResponse objResponse = JsonConvert.DeserializeObject <IdentityResolutionResponse>(result, settings);
                                if (objResponse != null)
                                {
                                    mainMatchEntity.ResponseErroeMessage = objResponse.error.errorMessage;
                                    objCommon.InsertAPILogs(this.CurrentClient.ApplicationDBConnectionString, objResponse.transactionDetail.transactionID, Convert.ToDateTime(objResponse.transactionDetail.transactionTimestamp), null, null, objResponse.error.errorMessage, null, 0, null);
                                }
                            }
                            else if (APItype.ToLower() == ApiLayerType.Direct20.ToString().ToLower())
                            {
                                GetCleanseMatchResponseMain objResponse = serializer.Deserialize <GetCleanseMatchResponseMain>(result);
                                if (objResponse != null && objResponse.GetCleanseMatchResponse != null && objResponse.GetCleanseMatchResponse.TransactionResult != null)
                                {
                                    mainMatchEntity.ResponseErroeMessage = objResponse.GetCleanseMatchResponse.TransactionResult.ResultText;
                                }
                            }
                        }
                    }
            }
            if (response != null)
            {
                objCommon.InsertAPILogs(response.TransactionResponseDetail, this.CurrentClient.ApplicationDBConnectionString);
                fcd.InsertCleanseMatchCallResults(SrcRecId, response.ResponseJSON, response.APIRequest, Helper.oUser.UserId, InputId);
                int Count = Convert.ToInt32(response.MatchEntities.Count()) + 1;
                SessionHelper.SearchMatch   = JsonConvert.SerializeObject(response.MatchEntities);
                SessionHelper.SearchMatches = JsonConvert.SerializeObject(response.MatchEntities);
                //lstMatchEntity = new List<MatchEntity>(response.MatchEntities);
                mainMatchEntity.lstMatches = response.MatchEntities;

                if (!string.IsNullOrEmpty(response?.ResponseJSON))
                {
                    dynamic data = JObject.Parse(response.ResponseJSON);
                    if (data.error != null && !string.IsNullOrEmpty(data.error.errorMessage.Value))
                    {
                        mainMatchEntity.ResponseErroeMessage = data.error.errorMessage.Value;
                    }
                }
            }

            if (IsCleanSearch)
            {
                return(PartialView("~/Views/BadInputData/_SearchData.cshtml", mainMatchEntity));
            }
            else
            {
                ViewBag.SearchedRegNum  = RegistrationNoValue;
                ViewBag.SearchedWebsite = "";
                return(PartialView("_Index", mainMatchEntity));
            }
        }
Esempio n. 22
0
        public APIResponse SearchByDUNS(string DUNSNO, string ConnectionString)
        {
            // Checking APIType is there or not
            string APItype = CommonMethod.GetThirdPartyProperty(ThirdPartyCode.DNB_SINGLE_ENTITY_SEARCH.ToString(), ThirdPartyProperties.APIType.ToString());

            if (string.IsNullOrEmpty(APItype))
            {
                Helper.ResponseErroeMessage = CommonMessagesLang.msgNoDefaultKeyForSearch;
            }
            else
            {
                Helper.ResponseErroeMessage = null;
            }
            Helper.IsSearchBYDUNS = true;
            CommonMethod objCommon = new CommonMethod();
            Utility      api       = new Utility();
            var          objResult = objCommon.LoadCleanseMatchSettings(ConnectionString);

            bool      IsGlobal = true;
            string    LOBTag = null;
            int       PageSize = 10, PageNumber = 1, SortOrder = 0, TotalRecords = 0;
            int       totalCount = 0;
            DataTable lstThirdPartyAPICredentials = new DataTable();
            ThirdPartyAPICredentialsFacade fac    = new ThirdPartyAPICredentialsFacade(ConnectionString);

            lstThirdPartyAPICredentials = fac.GetMinConfidenceSettingsListPaging(IsGlobal, LOBTag);
            int candidateMaxQuantity = 0, confidenceLowerLevelThresholdValue = 0;

            foreach (DataRow row in lstThirdPartyAPICredentials.Rows)
            {
                confidenceLowerLevelThresholdValue = Convert.ToInt32(row["MinConfidenceCode"]);
            }

            // if Country is not specified than by default pass United state as a default company.
            bool IsDirectPlusCall = false;

            try
            {
                if (APItype.ToLower() == ApiLayerType.Directplus.ToString().ToLower())
                {
                    IsDirectPlusCall = true;
                    response         = api.GetMatchResultDirectPlus(DUNSNO.ToString().Trim(), ConnectionString, confidenceLowerLevelThresholdValue);
                }
                else if (APItype.ToLower() == ApiLayerType.Direct20.ToString().ToLower())
                {
                    response = api.GetMatchResult(DUNSNO.ToString().Trim(), ConnectionString, confidenceLowerLevelThresholdValue);
                }
            }
            catch (WebException webEx)
            {
                using (var stream = webEx.Response.GetResponseStream())
                    using (var streamReader = new StreamReader(stream))
                    {
                        var result = streamReader.ReadToEnd();
                        if (result != null)
                        {
                            var serializer = new JavaScriptSerializer();

                            if (IsDirectPlusCall == false)
                            {
                                MatchResponseMain objResponse = serializer.Deserialize <MatchResponseMain>(result);
                                if (objResponse != null && objResponse.MatchResponse != null && objResponse.MatchResponse.TransactionResult != null)
                                {
                                    Helper.ResponseErroeMessage = objResponse.MatchResponse.TransactionResult.ResultText;
                                    objCommon.InsertAPILogs(ConnectionString, null, null, objResponse.MatchResponse.TransactionResult.SeverityText, objResponse.MatchResponse.TransactionResult.ResultID, objResponse.MatchResponse.TransactionResult.ResultText, null, 0, null);
                                }
                            }
                            else
                            {
                                var settings = new JsonSerializerSettings {
                                    NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore
                                };
                                IdentityResolutionResponse objResponse = JsonConvert.DeserializeObject <IdentityResolutionResponse>(result, settings);
                                if (objResponse != null)
                                {
                                    Helper.ResponseErroeMessage = objResponse.error?.errorMessage;
                                    objCommon.InsertAPILogs(ConnectionString, objResponse.transactionDetail.transactionID, Convert.ToDateTime(objResponse.transactionDetail.transactionTimestamp), null, null, objResponse.error.errorMessage, null, 0, null);
                                }
                            }
                        }
                    }
                if (string.IsNullOrEmpty(Helper.ResponseErroeMessage))
                {
                    Helper.ResponseErroeMessage = "No match found.";
                }
            }
            return(response);
        }