none
How to call the URL in wcf RRS feed

  • Question

  • Hi friends,

    when some one changes the status: as 'Getting Daily Feed' in addition to saving the status as of now we need to call following URL is '(http://dev.bullseyeprospecting.com/api/dealer/saveevent?dealerGuid=&eventCode=A&userid=5212404' .

    How can i do this in wcf .

     function UpdateDealers() {
                //alert("calling the function");
                var url = baseUrl + "/UpdateDealers"; 
                var dealerId = $('#DealerId').val();
                var msg = {
                    "BlackBookDealerId": dealerId,
                    "IconicStatus": $('#IconicDropDown').val(),
                    "MarketingStatus": $('#blackBookDropdown').val(),  
                    //"AuthenticomStatusCode": $('#blackBookDropdown').val(),
                    "DealerNotes": $('#d_notes').val()
                };
                var data = JSON.stringify(msg);
                //alert(data);
    
                $.ajax({
                    type: "POST", //GET or POST or PUT or DELETE verb
                    url: url, // Location of the service
                    data: data, //Data sent to server
                    contentType: "application/json; charset=utf-8", // content type sent to server                
                    success: function (result) {
                        ServiceSucceeded(result, dealerId);
                    },
                    error: function (result) {
    
                        ServiceFailed(result); // When Service call fails
                    }
                });
    
               
            }
    
            function ServiceSucceeded(result, dealerId) {
               // populateFields(result);
                alert("Record successfully Updated");
                GetDealer(dealerId);
                //var parameter = $('#DealerId').val();
                //var url = "Dealers.html?id=" + parameter;
                //$(location).attr('href', url);
               // window.location = "Dealers.html";
    
            }
            
    
                function GetDealer(id) {
                    //alert(id);
                    $.ajax({
                        type: "GET",
                        //url: baseUrl + "/GetDealerById?DealerId=6C090C22-F194-4712-A273-2BA246F64F1A",//GET or POST or PUT or DELETE verb
                        url: baseUrl + "/GetDealerById?DealerId=" + id,
                        // url: baseUrl + "/GetDealerById?DealerId=" +id, // Location of the service                
                        contentType: "application/json; charset=utf-8", // content type sent to server
    
                        success: function (result) {//On Successfull service call
                            
                            PopulateDealerInfo(result);
                         
                            //populateFields(result);
                        },
                        error: function (result) {
                            alert("hi");
                            ServiceFailed(result)// When Service call fails
                        }
                    });
                }
                function GetDealerList(id) {
                    $.ajax({
                        type: "GET", //GET or POST or PUT or DELETE verb
                        url: baseUrl + "/GetDealerList", // Location of the service                
                        contentType: "application/json; charset=utf-8", // content type sent to server
    
                        success: function (result) {//On Successfull service call
                            //PopulateDealerList(result);
                            PopulateDealerList(result, id);
    
                        },
                        error: function (result) {
                            ServiceFailed(result)// When Service call fails
                        }
                    });
                }
    
                function PopulateDealerInfo(result) {
                    //alert(result.IconicDealerInfo.AuthenticomStatusDesc);
                    //alert('PopulateDealerInfo' + JSON.stringify(result));
                    //commenting actual code
                    //debugger;
                    $('#d_CompanyDetails').html("<h1>" + result.IconicDealerInfo.Name + "</h1>" + result.IconicDealerInfo.Address1 + ',&nbsp&nbsp ' + result.IconicDealerInfo.City + ',&nbsp&nbsp' + result.IconicDealerInfo.State + "  " + result.IconicDealerInfo.ZIP + "<br>" + result.IconicDealerInfo.Phone);
                   
                    //$('#d_CompanyDetails').html("<h1>" + result.IconicDealerInfo.Address1 + "</h1>" + result.IconicDealerInfo.City + "," + result.IconicDealerInfo.State + " " + result.IconicDealerInfo.Pin + "<br>" + result.IconicDealerInfo.Phone);
    
                    //$("#d_Address1").html("Hello World");
                    if (result.IconicDealerInfo.Phone)
                    $('#d_Phone').html(result.IconicDealerInfo.Phone);
                    $('#BlackBookDealerID').html('<span>Black Book Dealer ID:</span>' + result.IconicDealerInfo.BlackBookDealerId);
                    $('#DMSDealerID').html('<span>DMS Dealer ID :</span>' + result.IconicDealerInfo.AuthenticomDealerID);
                    $('#d_Company').html(result.MarketerDealerInfo.name);
                    $('#d_Status').html('<span>Status:</span>' + result.MarketerDealerInfo.Active);
                    //$('#IconicDropDown').append('<option value="' + result.IconicDealerInfo.IconicDMSStatusDesc + '">' + result.IconicDealerInfo.IconicDMSStatusDesc + '</option>');
                    //$('#IconicDropDown').val(result.IconicDealerInfo.IconicDMSStatusDesc).change();
                    $('option:contains(' + result.IconicDealerInfo.IconicDMSStatusDesc + ')', '#IconicDropDown')[0].selected = true
                    //$('#blackBookDropdown').append('<option value="' + result.IconicDealerInfo.AuthenticomStatusDesc + '">' + result.IconicDealerInfo.AuthenticomStatusDesc + '</option>');
                    //$('#blackBookDropdown').val(result.IconicDealerInfo.AuthenticomStatusDesc).change();
                    //$('option:contains(' + result.IconicDealerInfo.AuthenticomStatusDesc + ')', '#blackBookDropdown')[0].selected = true
                    $('#BBStatus').val(result.IconicDealerInfo.AuthenticomStatusDesc);
                    $('#d_Name').html(result.IconicDealerInfo.Name);
                    $('#d_Marketingcompany').html('<span>Marketing Company:</span>' + result.MarketerDealerInfo.name);
                    //$('#d_Address').html(result.IconicDealerInfo.Address1);
                    $('#d_Address').html("<h1>" + result.IconicDealerInfo.Address1 + "</h1>" + result.IconicDealerInfo.City + "," + result.IconicDealerInfo.State + " " + result.IconicDealerInfo.ZIP);
                    $('#d_Website').html(result.MarketerDealerInfo.web_url);
                    $('#d_salesemail').html(result.IconicDealerInfo.SalesEmail);
                    $('#d_Serviceemail').html(result.IconicDealerInfo.ServiceEmail);
                    $('#d_Serviceprovider').html(result.MarketerDealerInfo.dms_provider);
                    $('#d_Pollingprovider').html(result.MarketerDealerInfo.dms_polling_provider);
                    $('#d_Type').html(result.MarketerDealerInfo.DMSType);
                    $('#d_Contactperson').html(result.MarketerDealerInfo.dms_contact_name);
                    //$('#d_Address').text = result.IconicDealerInfo.Name;
                    $('#d_DMSPhone').html(result.MarketerDealerInfo.dms_contact_phone);
                    $('#d_Email').html(result.MarketerDealerInfo.dms_contact_email);
                    $('#d_Username').html(result.MarketerDealerInfo.dms_username);
                    $('#d_Password').html(result.MarketerDealerInfo.dms_password);
                    $('#d_Masterclientfilenumber').html(result.MarketerDealerInfo.dms_client_master_file_number);
                    $('#d_Serialnumber').html(result.MarketerDealerInfo.dms_serial_number);
                    $('#d_notes').html(result.IconicDealerInfo.DealerNotes);
                    $('#DealerId').val(result.IconicDealerInfo.BlackBookDealerId);
                    
                    if (result.MarketerDealerInfo.logoavailable == "0") {
                        imgstr = result.MarketerDealerInfo.logo;
                        logoformat = result.MarketerDealerInfo.logoformat;
                        getload();
                        compname = result.IconicDealerInfo.Name;
                    }
                    else {
                        imgstr = result.MarketerDealerInfo.logo;
                        logoformat = result.MarketerDealerInfo.logoformat;
                        //getload();
                        compname = result.IconicDealerInfo.Name;
                    }
                    //getimage();
                   
                }
                
                function getload() {
                    debugger;
                    var image = document.getElementById("img");
                    if (imgstr != null) {
                        image.src = logoformat + "," + imgstr;
                        
                        
                    }
                    else {
                        var locimg = "" 
                        image.src = locimg;
                    }
                }
                function ServiceFailed(result) {
                    // Show error details
                }
               
                function PopulateDealerList(result, id) {
    
                    // actual code defaultDealerId = result[0].IconicDealerInfo.BlackBookDealerId;
                    // array to bind to autocomplete (to set source property of autocomplete)
                    var autoDealList = [];
                    $.each(result, function (key, value) {
                        //commenting actual code
                        if (id != "") {
                            GetDealer(id);
                        } else {
                            if (key == 0) {
                                GetDealer(value.IconicDealerInfo.BlackBookDealerId);
                            }
                        }
    
                        //////////////added code
                        // Populate the array to bind to autocomplete (to set source property of autocomplete)                
                        var obj = new Object;
                        obj.label = value.IconicDealerInfo.Name;
                        obj.value = value.IconicDealerInfo.BlackBookDealerId;
                        autoDealList.push(obj);
                        if (value.MarketerDealerInfo.Active) {
                            $("#DealerList").append("<li><a href='#' onclick='GetDealer(this.id)' id=" + value.IconicDealerInfo.BlackBookDealerId + " ><i class='fa fa-circle cir_grn'></i>" + value.IconicDealerInfo.Name + "</a></li>");
                        }
                        else {
                            $("#DealerList").append("<li><a href='#' onclick='GetDealer(this.id)' id=" + value.IconicDealerInfo.BlackBookDealerId + " ><i class='fa fa-circle cir_red'></i>" + value.IconicDealerInfo.Name + "</a></li>");
                        }
                        
                    });
                    /* actual code $('#filterTable-input').autocomplete({
                         source: autoDealList,
                         minLength: 1
                     });
                     */
                    $('#filterTable-input').autocomplete({
                        source: autoDealList,
                        minLength: 1,
                        select: function (event, ui) {
                            //event.preventDefault() is used to set the lable in the autocomplete serach box after selecting the item. Otherwise it will show the value instaed of label.
                            event.preventDefault();
                            GetDealer(ui.item.value);
                            $('#filterTable-input').val((ui.item.label));
                            
                        }
                    });
    
                }
    
                $(function () {
                  //  debugger;
                    $('#cmd').click(function () {
                         createPDFObject();
                      
                    });
                });
                function GetimgFormat(logoformat) {
                    debugger;
                    var pos = logoformat.search("png");
                    if (pos == -1) {
                        var imgfor = 'Jpeg';
                        return imgfor;
                    }
                    else {
                        var imgfor = 'png';
                        return imgfor;
                    }
                }
    
                
                function createPDFObject() {
                    debugger;
                   
                    var doc = new jsPDF();
                    doc.setFontSize(20);
                    var specialElementHandlers = {
                        '#ignoreElement': function (element, renderer) {
                            return true;
                        }
                    };
    
                    if (imgstr != null) {
                        var imgdata = document.getElementById("img");
                        
                        var imgdt = logoformat + "," + imgstr;
                        var imgs = getBase64Image(imgdata);
                        var imgfor = GetimgFormat(logoformat);
                        
                        //Get logo
                       
                        doc.addImage(imgs, imgfor, 15, 15, 30, 30);
                        
                        doc.fromHTML($('#d_CompanyDetails').html(), 50, 15, {
                            'width': 100, 'elementHandlers': specialElementHandlers
                        });
    
                        doc.fromHTML($('#deal_info_r').html(), 15, 60, {
                            'width': 100, 'elementHandlers': specialElementHandlers
                        });
    
                        doc.fromHTML($('#dealerInfo').html(), 15, 60, {
                            'width': 100, 'elementHandlers': specialElementHandlers
                        });
                        //var pdfname = $('#d_Company').text.toString();
                        doc.save(compname + '.pdf')
                    }
                    else {
                        //var imgData = getBase64Image("images/dealer_logo.png");
                        //doc.addImage(imgData, 'png', 15, 15, 30, 30);
    
                        doc.fromHTML($('#d_CompanyDetails').html(), 50, 15, {
                            'width': 100, 'elementHandlers': specialElementHandlers
                        });
    
                        doc.fromHTML($('#deal_info_r').html(), 15, 60, {
                            'width': 100, 'elementHandlers': specialElementHandlers
                        });
    
                        doc.fromHTML($('#dealerInfo').html(), 15, 60, {
                            'width': 100, 'elementHandlers': specialElementHandlers
                        });
    
                        doc.save(compname + '.pdf')
                    }
                }
                
    
                function getBase64Image(logoimg) {
                    debugger;
                    var canvas = document.createElement("canvas");
                    //canvas.width = img.width;
                   // canvas.height = img.height;
                    
                   var ctx = canvas.getContext("2d");
                    ctx.drawImage(logoimg, 0, 0);
                    var dataURL = canvas.toDataURL("image/JPEG");
                    return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
                }
    
                function GetIconicData() {
                    $.ajax({
                        type: "GET", //GET or POST or PUT or DELETE verb
                        url: baseUrl + "/GetIconicStatus", // Location of the service                
                        contentType: "application/json; charset=utf-8", // content type sent to server
    
                        success: function (result) {
                            var myDropDownList = $('#IconicDropDown');
    
                            $.each(result, function (key, value) {
                                //alert(value.IconicDMSStatusCode, value.IconicDMSStatusDesc);
                                myDropDownList.append('<option value="' + value.IconicDMSStatusCode + '">' + value.IconicDMSStatusDesc + '</option>');
                            });
                        },
                        error: function (result) {
                            ServiceFailed(result)// When Service call fails
                        }
                    });
                }
                //function GetBlackBookData() {
                //    debugger;
                //    $.ajax({
                //        type: "GET", //GET or POST or PUT or DELETE verb
                //        url: baseUrl + "/GetBlackBookMarketingStatus", // Location of the service                
                //        contentType: "application/json; charset=utf-8", // content type sent to server
    
                //        success: function (result) {
                //            var myDropDownList = $('#blackBookDropdown');
                //            $.each(result, function (key, value) {
                //                //alert(value.AuthenticomStatusCode, value.AuthenticomStatusDesc);
                //                myDropDownList.append('<option value="' + value.AuthenticomStatusCode + '">' + value.AuthenticomStatusDesc + '</option>');
    
                //            });
                //        },
                //        error: function (result) {
                //            alert("ërror");
                //            // ServiceFailed(result)// When Service call fails
                //        }
                //    });
                //}
    
    
                $(document).ready(
                  function () {
                      var id = ""
                      var parameters = location.search.substring(1).split("&");
                      if (parameters.length > 0) {
                          var temp = parameters[0].split("=");
                          if (temp.length == 2) {
                              id = unescape(temp[1]);
                          }
                      }
                      GetIconicData();
                      //GetBlackBookData();
                      GetDealerList(id);
    
                      
                  }
              );
                
                
        </script>
    </head>
    
    <body id="target">
       
        <div id="wrapper">
            <!--sidemenu-->
            <div id="menu">
                <div class="logo"><a href="#"></a></div>
                <div class="dealer_search">
                    <input type="text" placeholder="Dealership" name="dealer_search" id="filterTable-input"><a href="#"><i class="fa fa-search"></i></a></div>
                <div class="side_nav" style="height: 550px; overflow-y: auto">
                    <h1>All Dealers</h1>
                    <ul id="DealerList" class="ui-responsive" data-role="list">
    
                        <!--            	<li><a href="#" onclick=GetDealer(123)><i class="fa fa-circle cir_grn"></i>Capital Ford</a></li>
                         <li><a href="#"><i class="fa fa-circle cir_red"></i>Brian Harris BMW</a></li>
                    <li><a href="#"><i class="fa fa-circle cir_grn"></i>Pueblo Toyota </a></li>
                    <li><a href="#"><i class="fa fa-circle cir_red"></i>Sportdurst Automotive</a></li>
                        <!--<li><a href="#"><i class="fa fa-circle cir_grn"></i>Wolfchase Honda</a></li> -->
                    </ul>
                </div>
            </div>
            <!--sidemenu-->
    
            <!--content-->
            <div id="contentblock">
                <!--Top fixed bar-->
                <div class="top_bar">
                    <div class="comp_title">
                        <div class="comp_left">
                            <h1>Iconic Solutions - Admin Dashboard</h1>
                        </div>
                        <div class="comp_right">
                            <div class="sett"><a href="#"><i class="fa fa-cog wht_icon"></i></a></div>
                            <span><i class="fa fa-user usr_icon"></i>Admin</span>
                        </div>
                    </div>
                    <div class="top_nav">
                        <ul>
                            <li><a href="dealers.html" class="active">Dealers</a></li>
                            <li><a href="index.html">Testing</a></li>
                            <li><a href="reports.html">Reports</a></li>
                        </ul>
                    </div>
                </div>
                <!--Top fixed bar End-->
    
                <!--Content start-->
               
                <div class="content_main">
                    <div class="title_wrap">
                        <h1>Dealer Information </h1>
                        <div class="fr" >
                            <a href="add_dealers.html" class="btn_inline mar_left"><i class="fa fa-plus-circle"></i>Add New Dealer</a>
                            <a href="#" class="btn_inline mar_left" id="cmd">Create PDF</a>
                        </div>
                    </div>
                    
                    <div class="deal_cont">
                        <div class="deal_info_l">
                            <div class="deal_img">
                               
                                <img width="98" height="97" alt=""  id="img" /></div>
                                
                            <div class="deal_text" id="d_CompanyDetails">
                                <h1>CAPITAL Ford</h1>
                                4900 Capital Blvd., Raleigh, NC 27616<br>
                                800-279-8871</div>
                        </div>
                        
                        <div class="deal_info_r">
                            <div class="deal_text width100" id="d_Marketingcompany"><span>Marketing Company:</span> B2B International</div>
                            <div class="deal_text width100" id="d_Status"><span>Status:</span> Active</div>
                        </div>
                    </div>
    
                      <div id="dealerInfo">
    
    
                    <div class="clear_20"></div>
                    <h1>Additional Dealer Details </h1>
                    <div class="deal_cont">
                        <div class="deal_info_l width32">
                            <div class="deal_text width100" id="BlackBookDealerID"><span>Black Book Dealer ID:</span> 428039</div>
                            <div class="deal_text width100" id="DMSDealerID"><span>DMS Dealer ID :</span> </div>
                        </div>
                        <div class="deal_info_r width70">
                            <div class="deal_text width100">
                                <span>Iconic Solutions Status: </span>
                                <div class="deal_text_select">
                                    <select id="IconicDropDown">
                                        <option>Authenticom Order Placed</option>
                                        <!--<option>Select 1</option>
                                <option>Select 2</option>-->
                                    </select>
                                </div>
                            </div>
                            <div class="deal_text width100" >
                                <span>Black Book Marketing Status</span>
                                <!-- <div class="deal_text_select">-->
                               <input id="BBStatus" type="text" disabled  />
                               
                                <!--</div>-->
                            </div>
                        </div>
                        
                        <div class="clear_5_b"></div>
                        <div class="fl width100">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" id="TableID">
                                <tr>
                                    <td align="left"><span>Dealership Name</span></td>
                                    <td align="right" id="d_Name">Capital Ford</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Physical Address </span></td>
                                    <td align="right" id="d_Address">4900 Capital Blvd., Raleigh, NC 27616</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Phone</span></td>
                                    <td align="right" id="d_Phone">877-660-1721</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Website</span></td>
                                    <td align="right" id="d_Website">www.capital-ford.com</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Marketing Company </span></td>
                                    <td align="right" id="d_Company">B2B International</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Sales Email </span></td>
                                    <td align="right" id="d_salesemail">sales_email@domain-name.com</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Service Email</span></td>
                                    <td align="right" id="d_Serviceemail">service_email@domain-name.com</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Service Provider</span></td>
                                    <td align="right" id="d_Serviceprovider">Dealership Service Provider</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>Dealership Polling Provider </span></td>
                                    <td align="right" id="d_Pollingprovider">Dealership Polling Provider</td>
                                </tr>
                            </table>
                        </div>
    
                    </div>
    
                    <div class="clear_20"></div>
                    <h1>Dealer DMS Details </h1>
                    <div class="deal_cont">
                        <div class="fl width100">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="left"><span>DMS Type:</span></td>
                                    <td align="right" id="d_Type">DMS Type</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Contact Person:</span></td>
                                    <td align="right" id="d_Contactperson">DMS Contact Person6</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Contact Person Phone:</span></td>
                                    <td align="right" id="d_DMSPhone">DMS Contact Person Phone</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Contact Person Email:</span></td>
                                    <td align="right" id="d_Email">DMS Contact Person Email</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Username:</span></td>
                                    <td align="right" id="d_Username">DMS Username</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Password:</span></td>
                                    <td align="right" id="d_Password">DMS Password</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Master Client File Number:</span></td>
                                    <td align="right" id="d_Masterclientfilenumber">DMS Master Client File Number</td>
                                </tr>
                                <tr>
                                    <td align="left"><span>DMS Serial Number:</span></td>
                                    <td align="right" id="d_Serialnumber">DMS Serial Number</td>
                                </tr>
                            </table>
                        </div>
    
                    </div>
    
                    <div class="clear_20"></div>
                    <h1>Dealership Notes</h1>
                   <!-- <div class="deal_cont" style="min-height: 100px;" id="d_notes1">                    
                        
                        </div> -->
                          <div class="add_deal">
    			            <textarea id="d_notes"></textarea>
                        </div>
                        <div>
                            <button id="btnUpdate" onclick="UpdateDealers()"> UpdateDealer</button>
                            <input type="hidden" id="DealerId">
                            &nbsp;</div>
    
    
    
    
                
                    
                <!--Content end-->
    
            </div>
            <!--content-->
    
        </div>
        </div>
           
    
    </body>
    
    </html>
    


    Arunraj Kumar

    • Moved by Tina-Shi Wednesday, June 3, 2015 8:10 AM WCF
    Tuesday, June 2, 2015 6:35 AM

Answers

All replies

  • Hi Arunraj,

    Thank you for posting in MSDN forum.

    Since this issue is related to the WCF, so we will move this case to this WCF forum, you will get better support.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 3, 2015 8:10 AM
  • Hi Arunraj Kumar ,
       According to your case, I recommend to refer the following articles which may guide you to write the given code in WCF   :
    Click here to know more  about WCF Web HTTP Programming Object Model.

    Moreover I suggest you to refer the following link which explains that how to Consuming a WCF / ASMX / REST Service using jQuery in step by step process :

    http://www.codeproject.com/Articles/59551/Consuming-a-WCF-ASMX-REST-Service-using-jQuery

    Note : Check No.5 “Calling a WCF Service using jQuery [GET method] and retrieving data in JSON format” in the above article which may help to resolve this case.

    Thursday, June 4, 2015 8:19 AM