Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Android Asp problem

    Ok I am trying to make an app for android that accesses a website. on the website there is an option to view a schedule. that schedule is in asp. I am trying to get the data from the asp file into the android calendar. I am not quite sure how to go about doing that. any help? here is the asp file. Any help is appreciated.

    i added only the data that should really be important as the whole was too long


    <script type="text/javascript">
    //<![CDATA[
    var displayedScheduleDate = '04-16-2012';var currentWeek = 12;var scheduleTimestamp = new Date('04/17/2012 1:54:33'); $('#scheduleFooter').html(formatTime(scheduleTimestamp)); $(document).ready(function(){ lastUpdatedEmailAddy = 'buddyfoeva1@hotmail.com';});$(document).ready(function() {$('#lnkSubmit').hide();});//]]>
    </script>
    </form>

    <script type="text/javascript">
    var showAvail = false;
    var showActual = false;
    var menuActive = false;
    var lastUpdatedEmailAddy;
    var winID = 213199781;
    var userID = 2711346;
    var userFullName = "Buddy Harrison";
    var selectedWeek;
    var omnitureSuiteId = "walmartstoresmywalmartprod,walmartstorewalmartstoremywalmartsched";

    $(document).ready(function() {
    hideAvailability();

    selectedWeek = currentWeek;
    showSchedules();

    $('#btnShowAvail').click(function () { toggleAvailability(); return false; });
    $('#btnHideAvail').click(function () { toggleAvailability(); return false; });
    //showExceptionCalendar();


    $('#txtEmail, #txtEmail2').val(lastUpdatedEmailAddy);
    });

    function toggleSendButton() {
    if($('[id$=chkAccept]').get(0).checked) {
    $('#lnkSubmit').show();
    }
    else {
    $('#lnkSubmit').hide();
    }
    }


    function updateTab(week) {
    $('#pnlWeek' + selectedWeek).hide();
    $("#scheduleTab" + selectedWeek).removeClass("walSchHeaderTabs_cur");
    selectedWeek = week;
    $('#pnlWeek' + selectedWeek).show();
    $("#scheduleTab" + selectedWeek).addClass("walSchHeaderTabs_cur");


    //Code to capture stat for yesterday here...
    if(currentWeek != selectedWeek)
    {
    var s=s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click ' + getOmnitureWeekText(selectedWeek));
    }
    }

    function getOmnitureWeekText(weekNumber)
    {
    var ret = '';
    switch( weekNumber - currentWeek )
    {
    case -2:
    ret = 'Two Weeks Ago';
    break;
    case -1:
    ret = 'Last Week';
    break;
    case 0:
    ret = 'Current Week';
    break;
    case 1:
    ret = 'Next Week';
    break;
    case 2:
    ret = 'Two Weeks Ahead';
    break;
    default:
    }
    return ret;
    }




    function showAvailability() {
    //$(".workbar").hide();
    $(".availbar").show();
    $(".rightColHeader").css("background-color", "#337321");
    //$(".rightColHeader div.w").hide();
    $(".rightColHeader div.avH").show();
    //$(".ActualsDetails").hide();
    $(".AvailDetails").show();
    }

    function hideAvailability() {
    $(".availbar").show();
    $(".availbar").hide();
    //$(".workbar").show();
    //var iB = "#" + ((showActual) ? "003896" : "FFFFFF");
    $(".rightColHeader").css("background-color", "#FFFFFF");
    $(".rightColHeader div.avH").hide();
    //$(".rightColHeader div.w").show();
    $(".AvailDetails").hide();
    //$(".ActualsDetails").show();
    }



    function toggleAvailability() {

    showAvail = $('#btnShowAvail').css('display') != 'none';
    if (showAvail) {
    showAvailability();
    $('#btnShowAvail').hide();
    $('#btnHideAvail').show();
    }
    else {
    hideAvailability();
    $('#btnShowAvail').show();
    $('#btnHideAvail').hide();
    }
    }

    function showSchedules() {
    $(".walSchHeader div a:lt(2)").show();
    $("#timeSchedule").show();
    $("#hTabHolder").show();
    $(".walSchFooter").show();
    $("#schIcon").hide();
    $("#availIcon").show();
    //Handle the problem where current week is not selected when coming back from exceptions.
    updateTab(selectedWeek);
    }

    function hideSchedules() {
    $("#timeSchedule").hide();
    $("#hTabHolder").hide();
    $(".walSchFooter").hide();
    $(".walSchHeader div a:lt(2)").hide();
    }

    function showExceptionCalendar() {

    $("#timeExceptions").show();
    $(".assocInfo").show();
    $("#availIcon").hide();
    $("#schIcon").show();


    var s=s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click Exception Calendar');

    }

    function hideExceptionCalendar() {
    $("#timeExceptions").hide();
    $(".assocInfo").hide();
    }

    function showExceptionToolTip(e, elemId) {

    if (!menuActive) {
    var posX = 0;
    var posY = 0;
    var e = (!e) ? window.event : e;

    if (e.pageX || e.pageY) {
    posX = e.pageX;
    posY = e.pageY;
    }
    else if (e.clientX || e.clientY) {
    posX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
    posY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
    }

    var iDiv = document.createElement("div");
    with (iDiv) {
    className = "tooltip";
    style.top = posY + "px";
    style.left = (posX + 5) + "px";
    innerHTML = '<div class="sttt">&nbsp;</div><div class="sttm">' + $('#' + elemId).html() + '</div><div class="sttb"></div>';
    }

    document.body.insertBefore(iDiv, document.body.firstChild);
    repositionDiv(posX, posY);
    menuActive = true;
    }
    }

    function repositionDiv() {
    if (arguments[0] + $("div.tooltip").width() > document.documentElement.clientWidth) {
    $("div.tooltip").css("left", arguments[0] - $("div.tooltip").width());
    }

    if (arguments[1] + $("div.tooltip").height() > document.documentElement.clientHeight) {
    $("div.tooltip").css("top", document.documentElement.clientHeight - $("div.tooltip").height());
    }
    }

    function hideExceptionToolTip() {
    $("div.tooltip").remove();
    menuActive = false;
    }

    function printSchedule() {
    window.open('printableSchedule.aspx?w=213199781&d=04-16-2012&p=' + selectedWeek, '', 'width=615,height=455,scrollbars=yes');
    }

    function showFeedback() {
    window.open('technicalsurvey.aspx', '', 'width=520,height=460,scrollbars=yes');
    }

    var popupStatus = 0;

    function loadPopup(popupToShow) {
    if (popupStatus == 0) {
    if (popupToShow == 'email') {
    $(".help").hide();
    $(".emailLayout").show();
    }
    else if (popupToShow == 'help') {
    $(".emailLayout").hide();
    $(".help").show();
    }
    this.centerPopup();

    $("#backgroundPopup").css({
    "opacity": "0.7"
    });
    $("#backgroundPopup").fadeIn("slow");
    $("#popupContact").fadeIn("slow");
    this.popupStatus = 1;
    }
    }

    function disablePopup() {
    if (this.popupStatus == 1) {
    $(".help").hide();
    $(".emailLayout").hide();
    $("#backgroundPopup").fadeOut("slow");
    $("#popupContact").hide();
    setTimeout('emailReset()', 1000);
    this.popupStatus = 0;
    }
    }

    function centerPopup() {
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();

    $("#popupContact").css({
    "position": "absolute",
    "top": (document.documentElement.clientHeight / 2) - (popupHeight / 2),
    "left": (document.documentElement.clientWidth / 2) - (popupWidth / 2)
    });

    $("#backgroundPopup").css({
    "height": document.documentElement.clientHeight,
    "width": document.documentElement.clientWidth
    });
    }


    function emailReset() {
    $("#divEmailError").fadeOut(1000);
    $("#contactArea").show();
    $("#confirmArea").hide();
    $('#txtEmail').val(lastUpdatedEmailAddy);
    $('#txtEmail2').val(lastUpdatedEmailAddy);
    $("span.ackErr").fadeOut(1000);


    if (!this.lastUpdatedEmailAddy == '') {
    $("#contactArea b").html(lastUpdatedEmailAddy);
    $('[id$=divAddress]').show();
    $('[id$=divNoAddress]').hide();
    }
    else {
    $('[id$=divAddress]').hide();
    $('[id$=divNoAddress]').show();
    }
    }

    // function hideConfirmEmailAddy() {
    // $("#divEmailError").hide();
    // $("#hideEmailAddyLink").hide();
    // $("#confirmEmailAddyLink").show();
    // $(".confirmEmailAddy").hide();
    // centerPopup('email');
    // $('#txtEmail').val(lastUpdatedEmailAddy);
    // $('#txtEmail2').val('');
    // }

    // function showConfirmEmailAddy() {
    // $("#confirmEmailAddyLink").hide();
    // $("#hideEmailAddyLink").show();
    // $(".confirmEmailAddy").show();
    // centerPopup('email');
    // $('#txtEmail').val('');
    // $('#txtEmail2').val('');
    // }

    function confirmEmail() {
    var validEmailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var iTest = false;
    if ($('.confirmEmailAddy').get(0)) {
    iTest = true
    }

    if (iTest && $('#txtEmail').val() == "") {
    $("#divEmailError").html('You have not entered an email address!');
    $("#divEmailError").show();
    return false;
    }
    else if (iTest && $('#txtEmail2').val() == "") {
    $("#divEmailError").html('You have not confirmed the email address!');
    $("#divEmailError").show();
    return false;
    var s = new String();
    }
    else if (iTest && $('#txtEmail').val().toLowerCase() != $('#txtEmail2').val().toLowerCase()) {
    $("#divEmailError").html('The email address and confirmed email address do not match!');
    $("#divEmailError").show();
    return false;
    }
    else if (iTest && (!validEmailReg.test($('#txtEmail').val()) || !validEmailReg.test($('#txtEmail2').val()))) {
    $("#divEmailError").html('You have not entered a valid email address!');
    $("#divEmailError").show();
    return false;
    }
    else {
    var w = parseInt(winID);



    var toEmail = '';
    if (iTest) {
    toEmail = $('#txtEmail').val()
    }
    else {
    toEmail = lastUpdatedEmailAddy;
    }

    var iTitle = 'Walmart Schedule for Walmart Week #' + selectedWeek + ' for ' + userFullName;

    var parms = {
    "setPrimary": false,
    "optInForMyWalmartNotifications": ($("#elemOkToOptIn").get(0) != null && $("#elemOkToOptIn").attr('checked')),
    "optInForScheduleNotifications": ($("#elemOkToSendSchChanges").get(0) != null && $("#elemOkToSendSchChanges").attr('checked')),
    "emailAddress": toEmail,
    "userID": userID,
    "displayedScheduleDate": displayedScheduleDate,
    "scheduleValidString": formatTime(scheduleTimestamp),
    "weekToPrint": selectedWeek
    };


    jsonString = JSON.stringify(parms);
    $.ajax({
    type: "POST",
    url: "/_resources/Services/UserSchedules/UserSchedule.asmx/EmailAssociateSchedule",
    data: jsonString,
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
    $("#contactArea").hide();
    $("#confirmArea").show();
    $("#confirmArea").html("The schedule has been emailed to: <b>" + toEmail + "</b>");
    //Omniture code to notify success of email.
    var s=s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click Email Schedule');
    setTimeout('disablePopup()', 3000);
    setTimeout('emailReset()', 4000);
    },
    error: function(xhr, msg) { alert('An error occurred while sending the email. Please try again.'); }
    });
    }
    }

    </script>
    <script type="text/javascript">
    //Send start for showing current tab when page loads.
    //By the way, apparently this won't work in document.ready. I tried.
    var s = s_gi(omnitureSuiteId); s.tl(this, 'o', 'OTW Full Tab Click Current Week');
    </script>
    </body>
    </html>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,506
    Thanks
    77
    Thanked 4,378 Times in 4,343 Posts
    Point 1: You said "ASP code", but your apparently mean "ASP.NET' Be aware they aren't the same thing.

    Point 2: You don't seem to be showing any ASP.NET code. So how can we guess where the problem in said code might be?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts
    Point 3: Although you *can* do .net on android- keeping it native Java is better- what you need to do is figure out how/what they are doing in their code behind to make the calendar "work" and then do that as an activity on the android

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,506
    Thanks
    77
    Thanked 4,378 Times in 4,343 Posts
    Alykins: I don't think he is doing any .NET on Android. I think the ASP.NET code is all on the server. I think he is simply using AJAX to pull info from an ASP.NET server. I see no evidence at all of any ASP.NET code in what he posted, which presumably is the code he is using on the Android device. I do see evidence of jQuery, but that shouldn't cause problems.

    Look here:
    Code:
    $.ajax({
    type: "POST",
    url: "/_resources/Services/UserSchedules/UserSchedule.asmx
    /EmailAssociateSchedule",
    ...
    See? Just using jQuery AJAX to post a request to the ASP.NET page(s).
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts
    if he is making an android app though (i do android coding) he needs to do some java- jquery won't work on an android as an app... if he is serving up to a mobile device via androids browser different story- but yes i see now the service request- I guess question bounces to OP- what are you trying to do? and what is not working as it should?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #6
    New to the CF scene
    Join Date
    Jul 2012
    Location
    Bangladesh
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you have android apps problem plz come here solve your problem http://http://blogermasud.blogspot.com


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •