public ActionResult GetDnBAPIList(string Parameters)
        {
            int    credId  = 0;
            string apiType = string.Empty;

            if (Parameters != null)
            {
                Parameters = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                apiType    = Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 0, 1);
                credId     = Convert.ToInt32(Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 1, 1));
            }
            SettingFacade fac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);
            List <ThirdPartyAPICredentialsEntity> lst = new List <ThirdPartyAPICredentialsEntity>();
            List <DnbAPIEntity> lstAPI = new List <DnbAPIEntity>();

            if (credId == 0)
            {
                lst = CommonDropdown.GetCredentials(this.CurrentClient.ApplicationDBConnectionString, ThirdPartyProvider.DNB.ToString(), apiType);
            }
            else
            {
                lstAPI = fac.GetDnBAPIList(apiType, credId);
            }
            if (lst.Count > 1)
            {
                lst.RemoveAt(0);
                lstAPI = fac.GetDnBAPIList(apiType, lst[0].CredentialId);
            }
            var result = new { data = lstAPI, data2 = lst };

            return(new JsonResult {
                Data = result
            });
        }
        public ActionResult InsertUpdateDataEnrichment(string Parameters)
        {
            // Get Query string in Encrypted mode and decrypt Query string and set Parameters
            if (Parameters == "undefined" || Parameters.ToLower() == "null")
            {
                Parameters = null;
            }
            if (Parameters != null)
            {
                Parameters = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
            }
            // Open Popup for DnbAbi Data.
            int               GroupId = Convert.ToInt32(Parameters);
            SettingFacade     fac     = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);
            DnBAPIGroupEntity model   = new DnBAPIGroupEntity();

            if (GroupId > 0)
            {
                model            = fac.GetAPIGroupDetailsById(GroupId);
                model.lstDnbAPIs = fac.GetDnBAPIList(model.APIType, model.CredentialId);
                if (model != null)
                {
                    model.tmpName = model.APIGroupName;
                    if (model.DnbAPIIds != null)
                    {
                        model.lstDnBApiGrp = new List <DnbAPIEntity>();
                        foreach (var item in model.DnbAPIIds.Split(','))
                        {
                            var obj = model.lstDnbAPIs.FirstOrDefault(d => d.DnBAPIId == Convert.ToInt32(item));
                            if (obj != null)
                            {
                                model.lstDnBApiGrp.Add(obj);
                                model.lstDnbAPIs.Remove(obj);
                            }
                        }
                    }
                }
                else
                {
                    model.lstDnbAPIs = fac.GetDnBAPIList(null);
                }
            }

            else
            {
                model.lstDnbAPIs = fac.GetDnBAPIList(null);
            }
            return(PartialView(model));
        }
        public ActionResult InsertUpdateDataEnrichment(DnBAPIGroupEntity model, string btnDnBApiGrp, string Tags)
        {
            Tags       = Tags.TrimStart(',').TrimEnd(',');
            model.Tags = Tags == "0" ? null : Tags;
            // Save for DnbAbi Data.
            SettingFacade fac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);

            model.lstDnbAPIs = fac.GetDnBAPIList(model.APIType);
            List <string> lstAPIIDS = model.DnbAPIIds != null?model.DnbAPIIds.Split(',').ToList() : new List <string>();

            if (model.IsValidSave)
            {
                if (!IsAPIGroupExists(model))
                {
                    fac.InsertOrUpdateDnBAPIDetail(model);
                    ViewBag.APIMessage = model.APIGroupId == 0 ? CommonMessagesLang.msgCommanInsertMessage : CommonMessagesLang.msgCommanUpdateMessage;
                    return(Json(new { result = true, message = model.APIGroupId == 0 ? CommonMessagesLang.msgCommanInsertMessage : CommonMessagesLang.msgCommanUpdateMessage }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ViewBag.APIMessage = DandBSettingLang.msgGroupNameExist;
                    return(Json(new { result = false, message = DandBSettingLang.msgGroupNameExist }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { result = false, message = DandBSettingLang.msgInvadilState }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 4
0
        public ActionResult SetEntitleMentsForCreds(string Parameters)
        {
            EntitlementsViewModel viewModel = new EntitlementsViewModel();
            int           CredentialId      = 0;
            string        apiType           = string.Empty;
            SettingFacade fac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);

            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters   = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                CredentialId = Convert.ToInt32(Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 0, 1));
                apiType      = Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 1, 1);
            }
            List <DnbAPIEntity> lstAPIs = fac.GetDnBAPIList(apiType, CredentialId);

            viewModel.CredentialId = CredentialId;
            viewModel.APIType      = apiType;
            viewModel.lstAPIIds    = string.Join(",", lstAPIs.Select(x => x.DnBAPIId).ToList());
            return(View(viewModel));
        }
Esempio n. 5
0
        public static List <DnbAPIEntity> GetDnBAPIList(string ConnectionString, string APIType = null)
        {
            SettingFacade fac = new SettingFacade(ConnectionString);

            return(fac.GetDnBAPIList(APIType));
        }