Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Private Sub BindReconDetail(Optional ByVal bFlag As Boolean = True) 'Modified by sumit

        Dim altColor As Color = BgColor1

        Dim t As Table = GetFormattedTable("ReconDetail")
        Dim r As TableRow
        Dim c As TableCell
        Dim fields As ReportFields
        Dim melSecID As String
        Dim dict As Dictionary(Of String, String)
        Dim lnkBtn As LinkButton

        'Create a new dataview based on the sorting field
        Dim dv As New DataView(dtOTEDetail, "", SortField, DataViewRowState.CurrentRows)

        Pages = Math.Ceiling(CType(dv.Count, Double) / CType(RowsPerPage, Double))
        UpdatePagination()

        'Create Header row
        r = GetFormattedTableRow(altColor, HorizontalAlign.Center)
        ' Changes by Revathy on 07/Jan/2011 for XXX phase 2 - F2 requirement [Replaced "XXXXXXXXXX" with "System"]
        ' Changes by Deepa on 10/Jan/2011 for XXX phase 2 - F2 requirement [Replaced "XXXXXXXXXX Security ID" Or "xxxxxxxxxx Security" with "Security ID"]
        ' Changes by Revathy on 12/Jan/2011 for ETD phase 2 - F2 requirement [Replaced "Net Qty (XXXXXXXXXXX)" with "Net Qty (System)"]

        If ShowAllCurrencies Then
            fields = New ReportFields(New ReportField(6) { _
                                        New ReportField(fieldname:="MelSecID", headertext:=FMAWebConstants.SECURITY_ID), _
                                        New ReportField(fieldname:="CurrencyCode", headertext:="Currency"), _
                                        New ReportField(fieldname:="Units", headertext:="Net Qty (" + FMAWebConstants.SYSTEM + ")"), _
                                        New ReportField(fieldname:="ProductName", headertext:="Security Description"), _
                                        New ReportField(fieldname:="OTEBroker", headertext:="Broker"), _
                                        New ReportField(fieldname:="OTEMellon", headertext:=FMAWebConstants.SYSTEM), _
                                        New ReportField(fieldname:="OTEDifference", headertext:="Difference")})

        Else
            'Modified IsPriceUpdated to IsUpdated
            fields = New ReportFields(New ReportField(6) { _
                                        New ReportField(fieldname:="MelSecID", headertext:=FMAWebConstants.SECURITY_ID), _
                                        New ReportField(fieldname:="Units", headertext:="Net Qty (" + FMAWebConstants.SYSTEM + ")"), _
                                        New ReportField(fieldname:="ProductName", headertext:="Security Description"), _
                                        New ReportField(fieldname:="OTEBroker", headertext:="Broker"), _
                                        New ReportField(fieldname:="OTEMellon", headertext:=FMAWebConstants.SYSTEM), _
                                        New ReportField(fieldname:="OTEDifference", headertext:="Difference"), _
                                        New ReportField(fieldname:="IsUpdated", headertext:="FMA Price Update")})
        End If


        'Create the header columns
        For Each field As ReportField In fields
            c = GetSortableHeaderCell(t.ID, field, SortField, AddressOf OTEDetailSort_Click)
            r.Cells.Add(c)
        Next field

        t.Rows.Add(r)

        If dv.Count > 0 Then

            'Create data rows for the current page
            For i As Integer = 0 To dv.Count - 1

                'If the row doesn't belong to this page, skip it
                'If IsInPageRange(i, CurrentPageNumber, RowsPerPage) Then -> Sumit
                If IsInPageRange(i, CurrentPageNumber, RowsPerPage) Or bFlag = False Then 'Modified By Sumit

                    'Alternate the background color
                    If altColor.Equals(BgColor1) Then altColor = BgColor2 Else altColor = BgColor1

                    r = GetFormattedTableRow(altColor)

                    melSecID = dv(i)("MelSecID").ToString

                    'Mellon Security ID
                    dict = New Dictionary(Of String, String)
                    dict.Add("FID", FID.ToString)
                    dict.Add("CurrencyID", dv(i)("CurrencyID"))
                    dict.Add("MelSecID", melSecID)
                    lnkBtn = New LinkButton
                    lnkBtn.Attributes.Add("onclick", GetModalDialogString(Request.ApplicationPath.TrimEnd("/"c) & "/futures/dialogbox/securityotedetail.aspx", dict, 250, 600))
                    lnkBtn.ID = "lnkBtn" & melSecID
                    lnkBtn.Text = melSecID
                    lnkBtn.ToolTip = "View Detail"
                    c = GetFormattedTableCell(HorizontalAlign.Center)
                    c.Controls.Add(lnkBtn)
                    r.Cells.Add(c)

                    'Currency Code, if needed
                    If ShowAllCurrencies Then
                        c = GetFormattedTableCell(HorizontalAlign.Center)
                        c.Text = dv(i)("CurrencyCode").ToString
                        r.Cells.Add(c)
                    End If

                    'Units
                    c = GetFormattedTableCell(HorizontalAlign.Center)
                    c.Text = ToCurrencyFormat(dv(i)("Units"))
                    r.Cells.Add(c)

                    'Security Description
                    c = GetFormattedTableCell()
                    c.Text = dv(i)("ProductName").ToString
                    r.Cells.Add(c)

                    'Broker OTE
                    c = GetFormattedTableCell(HorizontalAlign.Right)
                    c.Text = ToCurrencyFormat(dv(i)("OTEBroker"))
                    r.Cells.Add(c)

                    'Mellon OTE
                    c = GetFormattedTableCell(HorizontalAlign.Right)
                    c.Text = ToCurrencyFormat(dv(i)("OTEMellon"))
                    r.Cells.Add(c)

                    'Diffenece in OTEs
                    c = GetFormattedTableCell(HorizontalAlign.Right)
                    c.Text = ToCurrencyFormat(dv(i)("OTEDifference"))
                    r.Cells.Add(c)

                    'FMA Price Update
                    c = GetFormattedTableCell(HorizontalAlign.Center)
                    Dim isUpdated As Boolean = CType(dv(i)("IsUpdated"), Boolean)
                    Dim isUpdatable As Boolean = CType(dv(i)("IsUpdatable"), Boolean)

                    If isUpdatable AndAlso Not isUpdated Then
                        lnkBtn = New LinkButton
                        lnkBtn.Attributes.Add("SecMasterId", dv(i)("SecMasterId"))
                        lnkBtn.ID = "lnkBtnRecalc_" & dv(i)("FHoldingID")
                        lnkBtn.Text = "RECALC"
                        lnkBtn.ToolTip = "Recalculate OTE for the position"
                        lnkBtn.Enabled = IsAuthorized(Enumerations.Privilege.RecalculateWorkItem) AndAlso IsCurrentRecon()
                        If lnkBtn.Enabled Then AddHandler lnkBtn.Click, AddressOf lnkBtn_Recalc
                        c.Controls.Add(lnkBtn)
                    ElseIf isUpdated Then
                        c.Text = "Recalculated"
                        c.Font.Bold = True
                        c.Font.Italic = True
                        c.ForeColor = Color.Red
                    Else
                        c.Text = String.Empty
                    End If
                    r.Cells.Add(c)

                    t.Rows.Add(r)

                End If
            Next i

        Else

            r = GetFormattedTableRow(altColor)
            c = GetFormattedTableCell(HorizontalAlign.Center)
            c.ColumnSpan = fields.Count
            c.Text = "No Data"
            r.Cells.Add(c)
            t.Rows.Add(r)

        End If

        pOTEDetail.Controls.Clear()
        pOTEDetail.Controls.Add(t)

    End Sub

#End Region

#Region "Properties"

    ''' <summary>
    ''' Gets or sets the sort field on the recon summary table
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Property SortField() As String
        Get
            Return DirectCast(ViewState("SortField"), String)
        End Get
        Set(ByVal value As String)
            ViewState("SortField") = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets the current page number of the table
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Property CurrentPageNumber() As Integer
        Get
            If ViewState("CurrentPageNumber") Is Nothing Then ViewState("CurrentPageNumber") = 1
            Return DirectCast(ViewState("CurrentPageNumber"), Integer)
        End Get
        Set(ByVal value As Integer)
            ViewState("CurrentPageNumber") = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets the total number of rows per page
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Property RowsPerPage() As Integer
        Get
            If ViewState("RowsPerPage") Is Nothing Then ViewState("RowsPerPage") = LibFMA.Constants.ROWS_PER_PAGE_DEFAULT
            Return DirectCast(ViewState("RowsPerPage"), Integer)
        End Get
        Set(ByVal value As Integer)
            ViewState("RowsPerPage") = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets the number of pages in the table
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Property Pages() As Integer
        Get
            If ViewState("Pages") Is Nothing Then ViewState("Pages") = 1
            Return CType(ViewState("Pages"), Integer)
        End Get
        Set(ByVal value As Integer)
            ViewState("Pages") = value
        End Set
    End Property

    ''' <summary>
    ''' Checks if we are showing all currency
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private ReadOnly Property ShowAllCurrencies() As Boolean
        Get
            Return CurrencyID.Equals(-1)
        End Get
    End Property


#End Region
#Region "MagicButton"
    Protected Sub MagicButton_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MagicButton.Load
        Dim fnBindReconDetail_DataLoad As New MagicButton.clbDataLoadMethod(AddressOf BindReconDetail_DataLoad)
        Dim fnBindReconInfo As New MagicButton.clbDataLoadMethod(AddressOf BindReconInfo)
        MagicButton.ExportFileName = "OTE"
        MagicButton.ToolTip = "Clicking this button creates an Excel file with all of the data within this grid.  The output in the Excel file will be sorted exactly as it is in this grid"
        MagicButton.AddControlForExport(ucAcctInfo, fnBindReconInfo)
        MagicButton.AddControlForExport(pOTEDetail, fnBindReconDetail_DataLoad)
    End Sub
    Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)

    End Sub
#End Region
End Class



Front End:

XML
<%@ Page Language="VB" AutoEventWireup="false"
    Inherits="FMAWeb.futures_holding_opentradeequitydetail" EnableEventValidation="false" Codebehind="opentradeequitydetail.aspx.vb" %>

<%@ Register Src="~/usercontrols/MagicButton.ascx" TagName="MagicButton" TagPrefix="uc3" %>
<%@ Register Assembly="LibMellon" Namespace="LibMellon.Controls" TagPrefix="cc1" %>
<%@ Register Src="~/usercontrols/ucReconAcctInfo.ascx" TagName="ucAcctInfo" TagPrefix="uc2" %>
<%@ Register Src="~/usercontrols/ucHeader.ascx" TagName="ucHeader" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>FMA - OTE Detail Home Page</title>
    <link href="<%= Page.ResolveUrl("~/styles/default.css") %>" type="text/css" rel="stylesheet" />
    <link href="<%= Page.ResolveUrl("~/styles/futures/default.css") %>" type="text/css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <uc1:ucHeader ID="ucHeader" SubTitle="Open Trade Equity Detail" runat="server" />
        <cc1:ReportToolbar ID="ucReportToolbar" Pagination="False" runat="server" />
        <div style="margin: 10px">
            <uc2:ucAcctInfo ID="ucAcctInfo" Title="Open Trade Equity Detail" runat="server" />
            <br />
            <asp:PlaceHolder ID="pOTEDetail" runat="server" />
            <cc1:DatagridToolbar ID="dgToolbarBottom" runat="server" />
            <uc3:MagicButton ID="MagicButton" runat="server" cssClass="SlimItem" />
            <br />
            <asp:PlaceHolder ID="pSecInfo" runat="server" />
        </div>
    </form>
</body>
</html>
Posted
Updated 24-Dec-13 2:33am
v3
Comments
CHill60 24-Dec-13 8:35am    
I have edited your question to remove the references to the company that owns this code. I happen to know that they do not take kindly to their source code being posted on external sites. In the meantime which line of code is throwing the error?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900