Problem app

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem app

chris.b

MY COMMENTS (EXPLANATIONS) IN BOLD RED

<%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="SharePhotosAndVideos.aspx.vb" Inherits="OperationReadyForRetail_SharePhotosAndVideos" %>

<%@ Register Assembly="Brettle.Web.NeatUpload" Namespace="Brettle.Web.NeatUpload"

    TagPrefix="Upload" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <div id="bumpLeft">

        <table width="777" cellpadding="0">

            <tr>

                <td width="620" valign="bottom">

                     <span  class="MediumBlueHeader">READY FOR RETAIL</span>

                </td>

                <td align="right" valign="middle" rowspan="2">

                    <img src="../images/GenuinePlaceHolder.gif" alt="Genuine Service" />

                </td>

            </tr>

            <tr>

                <td width="620" valign="top">

                     <span class="DarkBlueHeader">PHOTO/VIDEO UPLOAD PAGE</span>

                </td>

            </tr>

        </table>

        <br />

        <div id="verbiage" class="GeneralContent">

            Just some static content

            <br />

            <a href="#" onclick="showUploadFilesDIV()">

                <span class="infoOnly">Click here to upload files</span>

            </a>

        </div>

        <div id="uploadFiles" style="visibility:hidden;top:100px;left:11px;position:absolute;">

            <table width="750">

                <tr>

                    <td colspan="3" valign="top">

                        <asp:Label ID="lblExistingEvents" runat="server" CssClass="GeneralContent" />

                        <asp:RadioButtonList ID="rblEvents" runat="server" CssClass="infoOnly" />

                    </td>

                </tr>

                <tr>

                    <td width="150" valign="bottom">

                        <asp:Label ID="lblUpLoadInstructions" runat="server" CssClass="fileUploader"

                                   Text="File(s) to upload" />

                    </td>

                    <td width="400">

                        <Upload:MultiFile ID="MultiFile1" runat="server" FileQueueControlID="uploaders">

                            <a href="#" onclick="hideFeedback()">

                                <span class="infoOnly">Click here to add a file to the upload list</span>

                            </a>

                        </Upload:MultiFile>

                        <Upload:ProgressBar ID="ProgressBar1" runat='server' />

                    </td>

                    <td>

                        <asp:Button ID="btnUpload" runat="server" CssClass="infoOnly"

                                    Text="Upload these files" Width="270px" />

                   </td>

                </tr>

                <tr>

                    <td colspan="3">

                        <div id="uploaders" class="fileUploader">

FILE LIST DISPLAYS HERE

                        </div>

                    </td>

                </tr>

                <tr>

                    <td align="left" colspan="3">

                        <a href="#" onclick="showverbiageDIV()">

                            <span class="infoOnly">Click here to leave the file uploading page</span>

                        </a>

                    </td>

                </tr>

                <tr>

                    <td align="center" colspan="3">

                        <asp:UpdatePanel ID="feedback" runat="server">

                            <ContentTemplate>

                                <asp:Label ID="lblFeedback" runat="server"

                                           Text=""  CssClass="catalogCategoryItems" Visible="false" />

                            </ContentTemplate>

                            <Triggers>

                                <asp:AsyncPostBackTrigger ControlID="btnUpload" EventName="Click" />

                            </Triggers>

                        </asp:UpdatePanel>

                    </td>

                </tr>

            </table>

        </div>

 

THESE SIMPLY SHOW/HIDE SECTIONS OF THE PAGE

 

        <script type="text/javascript">

            function hideFeedback() {

                var feedbackMssg = document.getElementById("feedback");

                feedbackMssg.style.visibility = "hidden";

            }

 

            function showUploadFilesDIV() {

                var verbiageDIV = document.getElementById("verbiage");

                verbiageDIV.style.visibility = "hidden";

                var fileUploadDIV = document.getElementById("uploadFiles");

                fileUploadDIV.style.visibility = "visible";

            }

 

            function showverbiageDIV() {

                var fileUploadDIV = document.getElementById("uploadFiles");

                fileUploadDIV.style.visibility = "hidden";

                var verbiageDIV = document.getElementById("verbiage");

                verbiageDIV.style.visibility = "visible";

            }

 

        </script>       

    </div>

</asp:Content>

 

 

CODE-BEHIND

Imports System.Web.UI

Imports System.Data

Imports Brettle.Web.NeatUpload

Imports System.IO

 

Partial Class OperationReadyForRetail_SharePhotosAndVideos

    Inherits System.Web.UI.Page

 

NOTHING IN PAGE LOAD SPEAKS TO THE NEAT UPLOAD AT ALL

 

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Session.IsNewSession Then

            Response.Redirect("~/timeOut.aspx")

        End If

 

        Dim strDC As String = Session("DealerCode")

 

        If Not IsPostBack Then

            Dim MetricsDataHandler As New EventMetricsData(HttpContext.Current.Application("FCSDConnectionString"))

            Dim intActionID As Integer = MetricsDataHandler.GetPageMetricActionID(HttpContext.Current.Request.Path)

            Dim mt As New MetricTracker

            mt.WriteMetricEvent(intActionID)

 

 

            Dim eventRegistrationDataHandler As New EventRegistrationsDataHandler(HttpContext.Current.Application("FCSDConnectionString"), _

                                                                          strDC)

            Dim eventRegistrationData As DataTable

            eventRegistrationData = eventRegistrationDataHandler.GetEventRegistrationsForDealerCode()

            If eventRegistrationData.Rows.Count >= 1 Then

                Dim strEventListHeader As String = "For which event are you uploading photos and/or videos?"

                lblExistingEvents.Text = strEventListHeader

 

                Dim strEventDescription As String

                Dim intCount As Integer = 1

                Dim strEventDescr As String

                Dim eventRegistrationRecord As DataRow

                For Each eventRegistrationRecord In eventRegistrationData.Rows

                    strEventDescription = eventRegistrationRecord.Item("StartDate") & " to " & _

                                          eventRegistrationRecord.Item("EndDate")

                    strEventDescription = strEventDescription & " -- " & eventRegistrationRecord.Item("EventName")

                    If (Len(eventRegistrationRecord.Item("EventDetails")) > 50) Then

                        strEventDescr = Left(eventRegistrationRecord.Item("EventDetails"), 48) & "..."

                    Else

                        strEventDescr = eventRegistrationRecord.Item("EventDetails")

                    End If

                    strEventDescription = strEventDescription & " || " & strEventDescr

 

                    Dim newListItem As New ListItem

                    newListItem.Text = strEventDescription

                    newListItem.Value = eventRegistrationRecord.Item("RecID")

                    If (intCount = 1) Then

                        newListItem.Selected = "true"

                    End If

                    rblEvents.Items.Add(newListItem)

                    intCount = intCount + 1

                Next

 

            Else

                Dim strEventListHeader As String = "Your location has no events registered."

                lblExistingEvents.Text = strEventListHeader

            End If

        End If

    End Sub

 

    Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click

        Dim i As Integer = 0

        Dim strFeedback As String

        Dim strDC As String = Session("DealerCode")

        Dim intEventID As Integer = rblEvents.SelectedItem.Value

        Dim uploadsDataHandler As New PhotoVideoUploadsDataHandler(HttpContext.Current.Application("FCSDConnectionString"), _

                                                                   strDC, intEventID)

MULTIFILE1.FILES.COUNT IS ALWAYS 0

 

        For Each inputFileId As UploadedFile In MultiFile1.Files

            Dim c As String = inputFileId.FileName

            Try

                inputFileId.MoveTo(Path.Combine(Request.PhysicalApplicationPath, inputFileId.FileName), _

                                   MoveToOptions.Overwrite)

                uploadsDataHandler.AddUploadedFile(c)

                i = i + 1

            Catch ex As Exception

                lblFeedback.Text = "Error: " & ex.Message & vbCrLf & "Contact us"

                lblFeedback.Visible = "true"

                Exit Sub

            End Try

        Next

        strFeedback = i & " file(s) successfully uploaded"

        lblFeedback.Text = strFeedback

        lblFeedback.Visible = "true"

 

    End Sub

End Class