Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

DnB Risk Analysis

0.00/5 (No votes)
5 Aug 2013CPOL2 min read 9.8K   8  
Analyzing the risk associated with owning, investing, or collaborating with business by utilizing DnB Marketplace data subset.

This article is an entry in our DnB Developer Challenge. Articles in this sub-section are not required to be full articles so care should be taken when voting.

Introduction

Change is inevitable, and so is the ever growing market with variety of businesses. Thus analyzing company in a bid to understand current market trends, unforeseen incidents or penalties is essential in the road-map of business success.

As DnB has very latest information on the bankruptcy, lien, and judgment, debarment, out of business indicator, Annual Sales, Environmental Hazard Risk areas, green-certified indicator and Net Worth of businesses around the world. All this factors are updated quite frequently and give a valuable insight of the performance, future prospect, and code of conduct of a business.

The application, that I am proposing, is a tool that could be utilized to fetch these various factors of a business based on Company’s name or DUNS number, and list out other companies with same line of business.

Link to Web application:  http://dnbriskanalysis.cloudapp.net/  

Mission  

This application has twofold mission. The first objective being achieved here is to retrieve the risk determining factors like bankruptcy, lien, judgment, debarment, out of business indicator, Annual Sales, Environmental Hazard Risk areas, green-certified indicator and Net Worth of business for given Company’s name or DUNS number.

Second objective is to lay down the equivalent businesses with much better performance, future prospect. This is achieved by calculating the Risk Factor,

Results would be posted on the Google Maps. This would ease users to compare various factors of business in near proximity.

Target Audience

  1. Suppliers it has been always concern of supplier to find the credit worthiness of buyers and find the new businesses that have same supply needs.
  2. Buyers can obtain the goods from a business based on evaluation of various risk factors fetched.
  3. Investors may observe various risk factors of business before allocating billions dollar amount into equities, securities, or bonds of a business.
  4. Loan Lenders based on debarment, out of business indicator, Annual Sales and Net Worth determines LGD (loss given default) and PD (Probability of default) to allocate Loan amount.

Using the Code

  1. Create a method to initialize the connection to DNBDeveloperSandboxContainer.
    C#
    DNBDeveloperSandboxContainer clntDnN = new DNBDeveloperSandboxContainer(
              new Uri("https://api.datamarket.azure.com/DNB/DeveloperSandbox/v1"));
    public void fnInitializeDnNSandboxData()
    {
        string AccountKey = "YourKey"
        clntDnN.Credentials = new System.Net.NetworkCredential(AccountKey,AccountKey );
        List<string > lstDUNSNo = getDUNSNo();
        getCompanydata(lstDUNSNo);
    }
  2. Create a function to fetch data from Windows Azure Marketplace, this function would create task for each entity that we are interested in and would execute all of them parallely.
    C#
    public void getCompanydata(List<string> strDUNSNo)
    {
        {
            tskGetLatLong = Task<List<LocationLatLong>>.Factory.StartNew(() => getLocationLatLongdata(strDUNSNo));
            tskGetFamilyData = Task<List<FamilyHierarchy>>.Factory.StartNew(() => getFamilyHierarchydata(strDUNSNo));
            tskGetFirmograpgyData = Task<List<Firmographics>>.Factory.StartNew(() => getFirmographicsdata(strDUNSNo));
            tskGetDemographicsData = Task<List<Demographics>>.Factory.StartNew(() => getDemographicsdata(strDUNSNo));
            tskGetPublicRecordsData = Task<List<PublicRecords>>.Factory.StartNew(() => getPublicRecordsdata(strDUNSNo));
            tskGetGreenData = Task<List<Green>>.Factory.StartNew(() => getGreendata(strDUNSNo));
            tskGetMinorityData = Task<List<Minority>>.Factory.StartNew(() => getMinoritydata(strDUNSNo));
            tskGetWomenData = Task<List<Women>>.Factory.StartNew(() => getWomendata(strDUNSNo));
            tskGetVeteranData = Task<List<Veteran>>.Factory.StartNew(() => getVeterandata(strDUNSNo));
            tskGetDisadvantagedData = Task<List<Disadvantaged>>.Factory.StartNew(() => getDisadvantageddata(strDUNSNo));
            Task.WaitAll(tskGetFamilyData, tskGetFirmograpgyData, tskGetLatLong, tskGetPublicRecordsData, 
              tskGetVeteranData, tskGetWomenData, tskGetGreenData, tskGetDisadvantagedData, tskGetMinorityData);
        }
    }
  3. Use the jQuery AJAX calls to fetch the data from code behind and utilize those to display details in side bar on the click of markers on Google Maps.
    JavaScript
    function showDetails() {
        $(document).ready(function () {
            var valFromNameBox = $("#txtValueEntered").val();
            var jsonObj = '{strCompanyorDUNS: "' + valFromNameBox + '"}';
    
            if (geocoder) {
    
    
    
    
                $.ajax({
                    type: 'POST',
                    contentType: "application/json",
                    url: "DnBRiskAnalysis.aspx/MarkerData",
                    data: jsonObj,
                    dataType: "json",
                    success: function (data) {
    
                         $(data.d).each(function (index, item) {
                          var data = item.split(",");
    
    
                          var marker = new GMarker(new GLatLng(data[1], data[2]));
                          map.setCenter(new GLatLng(data[1], data[2]), 6);
                            GEvent.addListener(marker, "click", function () {
                                //alert('showed');
                                getBasicData(data[0]);
                                getAdvancedData(data[0]);
                                $('#dynamicTable').show();
    
                            });
    
                            map.addOverlay(marker);
    
                        })
                    },
                    error: function (xhr, ajaxOptions, thrownError) {
                        alert(xhr.status);
                        alert(xhr.responseText);
                        alert(thrownError);
                    }
    
                });
    
            }
        });
    };
    
    function getBasicData(valFromNameBox) {
                $(document).ready(function () {
    
                   // var valFromNameBox = $("#txtValueEntered").val();
                    var jsonObj = '{strCompanyorDUNS: "' + valFromNameBox + '"}';
                    $.ajax({
                        type: 'POST',
                        contentType: "application/json",
                        url: "DnBRiskAnalysis.aspx/DisplayBasicDetails",
                        data:jsonObj,
                        dataType: "json",
                        success: function (data) {
                            var div = $('#dynamicTable');
    
                            var i = 1;
                            //var tde = $('#basicdata tr:nth-child(2) td:last');
                            //alert(tde.val());
                            //alert(tde.text());
                            //alert(tde.html());
                            //var index = tde.index('td');
    
                            //alert(index);
                                $(data.d).each(function (index, item) {
                                    i++;
                                    if (item == null)
                                        item = 'NA';
                                    $(div).find('#basicdata tr:nth-child(' + i + ') td:eq(1)').remove();
                                    $(div).find('#basicdata tr:nth-child(' + i + ') td:last').after('<td>' + item + '</td>');
    
                                });
    
    
                        },
    
                        error: function (xhr, ajaxOptions, thrownError) {
                            alert(xhr.status);
                            alert(xhr.responseText);
                            alert(thrownError);
                        }
    
                    });
    
                })
            };
    
    function getAdvancedData(valFromNameBox) {
                $(document).ready(function () {
    
                   // var valFromNameBox = $("#txtValueEntered").val();
                    var jsonObj = '{strCompanyorDUNS: "' + valFromNameBox + '"}';
    
                    $.ajax({
                        type: 'POST',
                        contentType: "application/json",
                        url: "DnBRiskAnalysis.aspx/AdvancedDetailsData",
                        data: jsonObj,
                        dataType: "json",
                        success: function (data) {
                            var div = $('#dynamicTable');
                            var i = 1;
    
                            if (div.find('#basicdata tr:nth-child(2) td:last').index != 2) {
                                $(data.d).each(function (index, item) {
    
                                    if (item == null)
                                        item = 'NA';
                                    i++;
                                    $(div).find('#advanceddata tr:nth-child(' + i + ') td:eq(1)').remove();
                                    $(div).find('#advanceddata tr:nth-child(' + i + ') td:last').after('<td>' + item + '</td>');
    
                                });
                            }
    
                        },
                        error: function (xhr, ajaxOptions, thrownError) {
                            alert(xhr.status);
                            alert(xhr.responseText);
                            alert(thrownError);
                        }
    
                    });
    
                })
            };
    

UI Snapshots

1. Enter company name or DUNS no, and click search image.<o:p>

 <o:p>  

2. Check the compare check box, and hit search button to display the same businesses in near proximity.  

3. Click on the Marker to get basic and advanced details of the company.

 

Background 

The importance of risk assessment should not be undervalued. It’s the risk estimation that eases the decision making, and saving a business from a disaster. Risk assessment should be the part of every organization’s strategic plan.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)