Esempio n. 1
0
        public ActionResult OIAltSearchOrbNumber(string Parameters)
        {
            //OI - Search Data(Support Search by webdomain, orb number, email, ein)(MP - 577)
            string Country = string.Empty, OrbNum = string.Empty;

            if (!string.IsNullOrEmpty(Parameters))
            {
                Parameters = StringCipher.Decrypt(Parameters.Replace(Utility.Utility.urlseparator, "+"), General.passPhrase);
                OrbNum     = Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 0, 1);
                Country    = Utility.Utility.SplitParameters(Parameters, Utility.Utility.Colonseparator, 1, 1);
            }
            string ConnectionString = this.CurrentClient.ApplicationDBConnectionString;

            string[] hostParts            = new System.Uri(Request.Url.AbsoluteUri).Host.Split('.');
            string   SubDomain            = hostParts[0];
            OICleanseMatchViewModel model = new OICleanseMatchViewModel();

            model = APIUtility.GetOICleanseMatchResult("", "", "", "", "", Country, "", "", ConnectionString, SubDomain, null, "", OrbNum);
            if (model.oICleanseMatchOutputs == null && model.Error != null)
            {
                model.oICleanseMatchOutputs = new List <OICleanseMatchOutput>();
                ViewBag.ErrorMessage        = model.Error.ToString();
            }
            return(PartialView("~/Views/OI/OISearchData/_Index.cshtml", model));
        }
Esempio n. 2
0
        public ActionResult Index(string CompanyName, string Address1, string Address2, string City, string State, string Country, string Zipcode, string Telephone)
        {
            OICleanseMatchViewModel model = new OICleanseMatchViewModel();

            if (!string.IsNullOrEmpty(CompanyName) && !string.IsNullOrEmpty(Country))
            {
                string   ConnectionString = this.CurrentClient.ApplicationDBConnectionString;
                string[] hostParts        = new System.Uri(Request.Url.AbsoluteUri).Host.Split('.');
                string   SubDomain        = hostParts[0];
                model = APIUtility.GetOICleanseMatchResult(CompanyName, Address1, Address2, City, State, Country, Zipcode, Telephone, ConnectionString, SubDomain);
                if (model.oICleanseMatchOutputs == null && model.Error != null)
                {
                    model.oICleanseMatchOutputs = new List <OICleanseMatchOutput>();
                    ViewBag.ErrorMessage        = model.Error.ToString();
                }
            }
            else
            {
                model.oICleanseMatchOutputs = new List <OICleanseMatchOutput>();
                ViewBag.ErrorMessage        = DandBSettingLang.msgInvadilState;
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("~/Views/OI/OISearchData/_Index.cshtml", model));
            }
            else
            {
                return(PartialView("~/Views/OI/OISearchData/Index.cshtml", model));
            }
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            OICleanseMatchViewModel model = new OICleanseMatchViewModel();

            model.oICleanseMatchOutputs = new List <OICleanseMatchOutput>();
            return(View("~/Views/OI/OISearchData/Index.cshtml", model));
        }
Esempio n. 4
0
        public JsonResult FillMatchData(string orb_num, string MatchString)
        {
            ViewBag.OriginalSrcRecordId = orb_num;
            ViewBag.orb_num             = "Orb-" + orb_num;

            OICleanseMatchViewModel OIMatch = new OICleanseMatchViewModel();

            if (!string.IsNullOrWhiteSpace(MatchString))
            {
                OIMatch = SerializeHelper.DeserializeString <OICleanseMatchViewModel>(MatchString);
            }
            ViewBag.MatchUrl         = OIMatch.MatchUrl;
            ViewBag.ResponseJson     = OIMatch.ResponseJson;
            ViewBag.ConnectionString = this.CurrentClient.ApplicationDBConnectionString;
            string ResponseString = RenderViewAsString.RenderPartialViewToString(this, "~/Views/OI/OISearchData/AddCompany.cshtml", null);

            return(Json(new { result = true, htmlData = ResponseString }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public JsonResult AddCompany(string SrcId, string orb_num, string Tag, string MatchURL, string ResponseJSON)
        {
            // On selecting Adding Company
            OICleanseMatchViewModel OIMatch = new OICleanseMatchViewModel();
            OICompanyMatchFacade    company = new OICompanyMatchFacade(this.CurrentClient.ApplicationDBConnectionString);

            try
            {
                // Validate SrcId.
                company.ValidateCompanySrcId(SrcId);
                OICompanyEntity Company = new OICompanyEntity();
                if (!string.IsNullOrWhiteSpace(orb_num))
                {
                    OIMatch.MatchUrl     = MatchURL;
                    OIMatch.ResponseJson = ResponseJSON;
                    Company.Tags         = Tag;
                    Company.SrcRecordId  = SrcId;
                    ViewBag.matchRecord  = Company;
                    company.OIAddRecordAsNewCompany(MatchURL, ResponseJSON, orb_num, SrcId == null ? "123" : SrcId, Tag, Helper.oUser.UserId);
                }
            }
            catch (SqlException ex)
            {
                return(new JsonResult {
                    Data = ex.Message
                });
            }
            catch (Exception ex)
            {
                return(new JsonResult {
                    Data = ex.Message
                });
            }
            return(new JsonResult {
                Data = CommonMessagesLang.msgSuccess
            });
        }
Esempio n. 6
0
        public static OICleanseMatchViewModel GetOICleanseMatchResult(string CompanyName, string Address1, string Address2, string City, string State, string Country, string Zipcode, string Telephon, string connectionString, string CustomerSubDomain, string SrcRecordId = "123", string inputId = "", string orb_num = "", string EIN = "", string Website = "", string Email = "")
        {
            OICleanseMatchViewModel     oICleanseMatchViewModel = new OICleanseMatchViewModel();
            OICleanseMatchResponse      oICleanseMatchResponse  = new OICleanseMatchResponse();
            List <OICleanseMatchOutput> oICleanseMatchOutputs   = new List <OICleanseMatchOutput>();

            try
            {
                SettingFacade fac = new SettingFacade(connectionString);
                //string endPoint = fac.GetOICleanseMatchURLEncode(CustomerSubDomain, Country, SrcRecordId == null ? "123" : SrcRecordId, inputId == null ? "" : inputId, CompanyName == null ? "" : CompanyName, Address1, Address2, City, State, Zipcode, Telephon, "", "", "", "", "", "");
                string endPoint = fac.GetOICleanseMatchURLEncode(CustomerSubDomain, Country == null ? "" : Country, string.IsNullOrEmpty(SrcRecordId) ? "123" : SrcRecordId, inputId, CompanyName == null ? "" : CompanyName, Address1, Address2, City, State, Zipcode, Telephon, "", "", "", "", "", "");
                //string endPoint = "https://localhost/CleanseMatch/OI?CustomerSubDomain=sbisccmdev:9092&Country=USA&SrcRecordId=123&CompanyName=dell&address1=St&city=MtDora&state=FL&PostalCode=32757";

                if (!string.IsNullOrEmpty(orb_num))
                {
                    endPoint += "&OrbNum=" + orb_num;
                }
                if (!string.IsNullOrEmpty(EIN))
                {
                    endPoint += "&EIN=" + EIN;
                }
                if (!string.IsNullOrEmpty(Website))
                {
                    endPoint += "&Website=" + Website;
                }
                if (!string.IsNullOrEmpty(Email))
                {
                    endPoint += "&Email=" + Email;
                }
                string cleanJsonResponse = string.Empty;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                var httpWebRequest = (HttpWebRequest)WebRequest.Create(endPoint);
                httpWebRequest.ContentType = "application/json";
                httpWebRequest.Method      = "GET";
                httpWebRequest.Headers.Add("Authorization", "Bearer " + Helper.OIAPIKey);
                //httpWebRequest.Headers.Add("Authorization", "Bearer 30324d3b-49f9-4078-82f0-5240830c5709");

                var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    cleanJsonResponse = streamReader.ReadToEnd();
                    if (!string.IsNullOrEmpty(cleanJsonResponse))
                    {
                        var serializer = new JavaScriptSerializer();
                        oICleanseMatchResponse = serializer.Deserialize <OICleanseMatchResponse>(cleanJsonResponse);

                        //getting wrong candidate counts from API, for resolving that issue set records count which are get from API
                        //for resolving error set custom result count (MP-718)
                        if (oICleanseMatchResponse != null && oICleanseMatchResponse.results != null && oICleanseMatchResponse.results.Any())
                        {
                            oICleanseMatchResponse.results_count = oICleanseMatchResponse.results.Count;
                        }

                        if (oICleanseMatchResponse != null && oICleanseMatchResponse.results_count > 0)
                        {
                            foreach (var item in oICleanseMatchResponse.results)
                            {
                                OICleanseMatchOutput oICleanseMatchOutput = new OICleanseMatchOutput();
                                oICleanseMatchOutput.result_number         = item.result_number;
                                oICleanseMatchOutput.orb_num               = item.orb_num;
                                oICleanseMatchOutput.name                  = item.name;
                                oICleanseMatchOutput.std_streetnum         = item.std_streetnum;
                                oICleanseMatchOutput.std_streetname        = item.std_streetname;
                                oICleanseMatchOutput.address1              = item.address1;
                                oICleanseMatchOutput.city                  = item.city;
                                oICleanseMatchOutput.state                 = item.state;
                                oICleanseMatchOutput.zip                   = item.zip;
                                oICleanseMatchOutput.company_status        = item.company_status;
                                oICleanseMatchOutput.confidence_score      = item.confidence_score;
                                oICleanseMatchOutput.entity_type           = item.entity_type;
                                oICleanseMatchOutput.is_standalone_company = item.is_standalone_company;
                                oICleanseMatchOutput.branches_count        = item.branches_count;
                                oICleanseMatchOutputs.Add(oICleanseMatchOutput);
                            }
                            oICleanseMatchViewModel.oICleanseMatchOutputs = oICleanseMatchOutputs;
                            //oICleanseMatchViewModel.ResponseJson = cleanJsonResponse;

                            //getting wrong candidate counts from API, for resolving that issue set records count which are get from API
                            //for resolving error set custom result count (MP-718)
                            oICleanseMatchViewModel.ResponseJson = serializer.Serialize(oICleanseMatchResponse);
                        }
                        else if (oICleanseMatchResponse != null && oICleanseMatchResponse.results_count == 0 && oICleanseMatchViewModel.Error == null)
                        {
                            oICleanseMatchViewModel.Error        = "No records found.";
                            oICleanseMatchViewModel.ResponseJson = cleanJsonResponse;
                        }
                        else
                        {
                            oICleanseMatchViewModel.Error = oICleanseMatchResponse.ErrorMessage;
                        }
                        oICleanseMatchViewModel.MatchUrl = endPoint;
                    }
                }
            }
            catch (WebException ex)
            {
                string ErrorMessage = ex.Message;

                using (var stream = ex.Response.GetResponseStream())
                    using (var streamReader = new StreamReader(stream))
                    {
                        var result = streamReader.ReadToEnd();
                        oICleanseMatchViewModel.Error = result.ToString();
                    }
            }
            catch (Exception ex)
            {
                oICleanseMatchViewModel.Error = ex.Message;
            }
            return(oICleanseMatchViewModel);
        }