Skip to content

Instantly share code, notes, and snippets.

@ChrisMoney
Created August 26, 2015 18:21
Show Gist options
  • Save ChrisMoney/df16e1b7f18374a05ab9 to your computer and use it in GitHub Desktop.
Save ChrisMoney/df16e1b7f18374a05ab9 to your computer and use it in GitHub Desktop.
Ultra Web Grid - Infragistics
Imports BusinessLayer
Imports GlobalVBNet
Imports Infragistics.WebUI.UltraWebGrid
Imports Telerik.Web.UI
'**************** user leveling ****************
'none
'*************************************************
'for all of the buttons on the top of the division page, we need to make sure that the information can be viewed and NOT edited for a completed division (new 2/11/09) TSP 11/16/09
'removed the reference to ssi global javascript since this is now in the master page TLM 2/19/09
'old - if Win Percentage is selected, enable the label and text box below
Partial Class DivisionPerformancePopup
Inherits System.Web.UI.Page
'application name swap - create the business layer application object TSP 4/27/11
Private mobjBusinessLayerApplication As New BusinessLayer.clsApplication
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
'********************************************************************
' Developer: Brian Ziegler
' Date: 2/24/10
' Purpose: loads the page
' Inputs: none
' Returns: nothing
' Note:
' QA: JMC 4/28/10
'********************************************************************
Dim hdrHeaderMaster As Header
Dim blnPageIsLocked As Boolean
'changed DivisionPerformancePageLock to DivisionPerformancePopupPageLock TLM 11/14/08
'get the page lock status from the web config file TMS, PBB & JMC 3/6/08
blnPageIsLocked = CommonFunctions.ConvertToBoolean(ConfigurationManager.AppSettings("DivisionPerformancePopupPageLock"), False)
'if the logged in user id session variable is NOT set (the session is expired)...
If Len(Session("UserID")) = 0 Then
'redirect the user to the session expired page
Response.Redirect("../Common/SessionExpired.aspx")
'if the user is an external user and the page is locked for beta testing... TMS, PBB & JMC 3/6/08
ElseIf (Session("UserType") = "LeagueContact" Or Session("UserType") = "CorporateContact") And blnPageIsLocked Then
'redirect the user to the permission denied page TMS, PBB & JMC 3/6/08
Response.Redirect("../Common/PermissionDenied.aspx")
'added the two elseif clauses for the terms of use and password expired session checks SOS 10/02/08
'if the user's password is expired... JMC 2/8/07
ElseIf Session("PasswordExpired") = "True" Then
'redirect the user to the session expired page
Response.Redirect("../Common/SessionExpired.aspx")
'if the user hasn't accepted the terms of use... JMC 9/19/08
ElseIf Session("TermsOfUseAccepted") = "False" Then
'redirect the user to the session expired page
Response.Redirect("../Common/SessionExpired.aspx")
'if the logged in user id session variable IS set (the session is NOT expired)...
Else
Try
'changed from using the shared application name to using the following TSP 4/27/11
mobjBusinessLayerApplication.CurrentApplicationName = Session("ApplicationName")
hdrHeaderMaster = Page.Master
'set the refresh button as the default button JMC 4/27/10
PeterBlum.DES.Globals.Page.RegisterKeyClicksControl(hdrHeaderMaster.MasterForm1, btnRefresh, 13, True)
'if this is the first time the page is loaded (the page is not being reloaded from an action on this page)
If Not IsPostBack Then
'if the league division session id is NOT set (should always be set)... JMC 4/27/10
If CommonFunctions.ConvertToString(Session("DivisionLeagueDivisionSessionID")).Length = 0 Then
Throw New Exception("The League Division Session ID has not been set!")
'if the league division session id IS set... JMC 4/27/10
Else
With hdrHeaderMaster
'hide the navigation menu, banner, logoff assume control and connected db control
.NavigationMenuVisible = False
.BannerImageVisible = False
.LogoffAssumeControlVisible = False
.ConnectedDBControlVisible = False
'don't show the footer on the popup pages TMS & JMC 5/27/10
.FooterVisible = False
'set the iframe height and width based on the content of the page
.BodyOnLoad = "AutoFitPopupIframe();"
'don't show the scheduled maintenance value PMG 9/17/12
.ScheduledMaintanceControlVisible = False
End With
'when the user clicks close, hide the popup iframe TLM 1/27/09
btnClose.OnClientClick = "HidePopupIFrame(); return false;"
'changed to load the division name, division number and session on the top of the page from session variables set on the division page TMS, JMC & TSP 5/4/10
lblDivisionNumberName.Text = Session("DivisionDivisionNumberAndDivisionNameForPageHeaders")
lblSessionName.Text = Session("DivisionSessionNameForPageHeaders")
'load the grid
LoadDivisionPerformanceGrid(CommonFunctions.ConvertToInt32(Session("DivisionLeagueDivisionSessionID"), 0), CommonFunctions.ConvertToInt32(txtMatches.Text, 0))
'set focus on matches for inclusion textbox
txtMatches.Focus()
End If
End If
Catch objException As Exception
Throw New Exception("Error in DivisionPerformancePopup.Page_Load - " & objException.Message)
Finally
'clean up objects
hdrHeaderMaster = Nothing
End Try
End If
End Sub
Private Sub LoadDivisionPerformanceGrid(ByVal intLeagueDivisionSessionID As Int32, ByVal intMinimumMatchesPlayed As Int32)
Dim objMember As New clsMember
Dim dsMember As New DataSet
Try
objMember.BusinessLayerApplication = mobjBusinessLayerApplication
If (rbPerformancePoints.Checked) Then
dsMember = objMember.GetMemberForPerformancePointsByLeagueDivisionSessionIDTotalMatchesPlayed(intLeagueDivisionSessionID, intMinimumMatchesPlayed)
ElseIf (rbWinPercentage.Checked) Then
dsMember = objMember.GetMemberForWinPercentageByLeagueDivisionSessionIDTotalMatchesPlayed(intLeagueDivisionSessionID, intMinimumMatchesPlayed)
ElseIf (rbPPM.Checked) Then
dsMember = objMember.GetMemberForPointsPerMatchByLeagueDivisionSessionID(intLeagueDivisionSessionID, intMinimumMatchesPlayed)
End If
If (clsApplication.ValidateDataset(dsMember)) Then
With uwgPerformance
.DataSource = dsMember
.DataBind()
End With
'format the division performance grid
FormatDivisionPerformanceGrid()
Else
uwgPerformance.Clear()
End If
dsMember.Dispose()
Catch objException As Exception
Throw New Exception("Error in DivisionPerformancePopup.LoadDivisionPerformanceGrid - " & objException.Message)
Finally
'clean up objects
objMember = Nothing
dsMember = Nothing
End Try
''********************************************************************
'' Developer: Brian Ziegler
'' Date: 2/24/10
'' Purpose: loads the division performance grid according to the
'' radio button selected
'' Inputs: intLeagueDivisionSessionID, intMinimumMatchesPlayed
'' Returns: nothing
'' Note:
'' QA: JMC 5/4/10
''********************************************************************
'Dim objMember As New clsMember
'Dim dsMember As New DataSet
'Try
' 'application name swap - set the business layer application for all business layer objects TSP 4/27/11
' objMember.BusinessLayerApplication = mobjBusinessLayerApplication
' 'load all of the players in the division based on the Matches Required for Inclusion field (new 2/17/10) BJZ 2/24/10
' 'matches are only based on a team in the selected division for the session selected from the division page (new 2/17/10) BJZ 2/24/10
' 'rank the players based on the selection from the radio button list (WinPercentage (tblLDSTeamMemberAlias.TotalMatchesWon/TotalMatchesPlayed) or tblLDSTeamMemberAlias.TotalPerformancePoints) (new 2/17/10) BJZ 2/24/10
' 'if the radio button selected IS performance points...
' If rbPerformancePoints.Checked Then
' 'get the member performance points ranked by performance points
' dsMember = objMember.GetMemberForPerformancePointsByLeagueDivisionSessionIDTotalMatchesPlayed(intLeagueDivisionSessionID, intMinimumMatchesPlayed)
' 'if the division information is NOT located...
' If dsMember.Tables(0).Rows.Count = 0 Then
' 'clear the performance grid
' uwgPerformance.Clear()
' 'if the division information IS located...
' Else
' With uwgPerformance
' .DataSource = dsMember
' .DataBind()
' End With
' 'format the division performance grid
' FormatDivisionPerformanceGrid()
' End If
' dsMember.Dispose()
' 'if the radio button selected is NOT performance points (win percentage radio button is selected)...
' Else
' 'get the member performance points ranked by win percentage
' dsMember = objMember.GetMemberForWinPercentageByLeagueDivisionSessionIDTotalMatchesPlayed(intLeagueDivisionSessionID, intMinimumMatchesPlayed)
' 'if the division information is NOT located...
' If Not clsApplication.ValidateDataset(dsMember) Then
' 'clear the performance grid
' uwgPerformance.Clear()
' 'if the division information IS located...
' Else
' With uwgPerformance
' .DataSource = dsMember
' .DataBind()
' End With
' End If
' dsMember.Dispose()
' End If
'Catch objException As Exception
' Throw New Exception("Error in DivisionPerformancePopup.LoadDivisionPerformanceGrid - " & objException.Message)
'Finally
' 'clean up objects
' objMember = Nothing
' dsMember = Nothing
'End Try
End Sub
Private Sub FormatDivisionPerformanceGrid()
'format the division performance grid
With uwgPerformance
.Width = Unit.Pixel(900)
.Columns.Item(0).HeaderText = "Rank"
.Columns.Item(1).HeaderText = "Member Number"
.Columns.Item(2).HeaderText = "Member Name"
'added matches played, matches won, total performance points, win percent, skill level and gender and tooltips/column widths where needed BJZ 5/6/10
.Columns.Item(3).HeaderText = "Team"
.Columns.Item(4).HeaderText = "MP"
.Columns.Item(4).Header.Title = "Team Session Matches Played"
.Columns.Item(4).Width = Unit.Pixel(60)
.Columns.Item(5).HeaderText = "MW"
.Columns.Item(5).Header.Title = "Team Session Matches Won"
.Columns.Item(5).Width = Unit.Pixel(60)
.Columns.Item(6).HeaderText = "PP"
.Columns.Item(6).Header.Title = "Team Session Performance Points"
.Columns.Item(6).Width = Unit.Pixel(60)
.Columns.Item(7).HeaderText = "Win%"
.Columns.Item(7).Header.Title = "Team Session Win Percent"
.Columns.Item(7).Width = Unit.Pixel(60)
.Columns.Item(8).HeaderText = "SL"
.Columns.Item(8).Header.Title = "Skill Level"
.Columns.Item(8).Width = Unit.Pixel(60)
.Columns.Item(9).HeaderText = "Gender"
.Columns.Item(9).Width = Unit.Pixel(60)
.Columns.Item(10).HeaderText = "PA"
.Columns.Item(10).Header.Title = "Points Per Match Average"
.Columns.Item(10).Width = Unit.Pixel(60)
.Columns.Item(11).Header.Title = "Points Per Match"
.Columns.Item(11).HeaderText = "PPM"
.Columns.Item(11).Width = Unit.Pixel(60)
End With
End Sub
Protected Sub btnRefresh_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRefresh.Click
'********************************************************************
' Developer: Brian Ziegler
' Date: 2/25/10
' Purpose: reloads the division performance grid according to the
' criteria handed in
' Inputs: none
' Returns: nothing
' Note:
' QA: JMC 4/22/10
'********************************************************************
Try
'if the page validation passed...
If PeterBlum.DES.Globals.Page.IsValid Then
'load the division performance grid
LoadDivisionPerformanceGrid(CommonFunctions.ConvertToInt32(Session("DivisionLeagueDivisionSessionID"), 0), CommonFunctions.ConvertToInt32(txtMatches.Text, 0))
'if the page validation did NOT pass...
Else
'do nothing - display validation messages to the user
End If
Catch objException As Exception
Throw New Exception("Error in DivisionPerformancePopup.btnRefresh_Click - " & objException.Message)
Finally
'clean up objects
End Try
End Sub
Private Sub uwgPerformance_DataBound(sender As Object, e As EventArgs) Handles uwgPerformance.DataBound
End Sub
Private Sub uwgPerformance_InitializeLayout(sender As Object, e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles uwgPerformance.InitializeLayout
End Sub
Private Sub uwgPerformance_InitializeRow(sender As Object, e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles uwgPerformance.InitializeRow
Dim ppm As Double = CDbl(e.Row.Cells.FromKey("PA").Text) / 100
Dim strPPM As String
strPPM = FormatPercent(ppm, 2)
e.Row.Cells.FromKey("PA").Text = strPPM
e.Row.Cells.FromKey("PPM").Text = Math.Round(CDbl(e.Row.Cells.FromKey("PPM").Text), 2)
End Sub
End Class
'-------------------------------------------------------------------------------------------------------------------------
'Start Markup
'--------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="vb" MasterPageFile="../Common/Header.Master" AutoEventWireup="false"
CodeBehind="DivisionPerformancePopup.aspx.vb" Inherits="Nexus.DivisionPerformancePopup"
Title="Division Performance - Nexus" %>
<%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics4.WebUI.UltraWebGrid.v11.1, Version=11.1.20111.2225, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>
<%@ Register TagPrefix="des" Namespace="PeterBlum.DES.Web.WebControls" Assembly="PeterBlum.DES" %>
<asp:Content ContentPlaceHolderID="cplhMainContent" ID="Content1" runat="server">
<!-- do NOT remove these javascript references, they are needed due to how this page is rendered to the client -->
<script src="../Javascript/SSIGlobalJavaScript.js" type="text/javascript" language="javascript"></script>
<script src="../Javascript/jquery-1.7.2.min.js" type="text/javascript" language="javascript"></script>
<asp:Panel ID="pnlDivisionPerformance" runat="server">
<table cellspacing="5" cellpadding="0" border="0" style="width: 680px">
<tr>
<td>
<asp:Label ID="Label84" Width="248px" runat="server" CssClass="pageHeader" Text="Division Performance"></asp:Label>
</td>
<td align="right">
<div id="divHelpImage" runat="server" style="background-image: url(../Images/help.png);
width: 16px; height: 16px; cursor: hand;" onclick="Help_Clicked(62);">
</div>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblDivisionNumberName" CssClass="boldLabel" runat="server">DivisionNumberName</asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="lblSessionName" CssClass="boldLabel" runat="server">SessionName</asp:Label>
</td>
</tr>
</table>
<fieldset class="inputFieldsetLightBlue" style="width: 680px">
<div>
<table cellspacing="5" cellpadding="0" border="0" style="width: 780px">
<tr>
<td align="left">
<p>
<asp:RadioButton ID="rbPPM" runat="server" Text="Points Per Match" Checked="True" GroupName="DivisionPerformanceGroup"
TabIndex="103"></asp:RadioButton>
<asp:RadioButton ID="rbPerformancePoints" runat="server" Text="Performance Points"
GroupName="DivisionPerformanceGroup" TabIndex="101"></asp:RadioButton>&nbsp;&nbsp;
<asp:RadioButton ID="rbWinPercentage" runat="server" Text="Win Percentage" GroupName="DivisionPerformanceGroup"
TabIndex="102"></asp:RadioButton>
</p>
</td>
</tr>
<tr>
<td align="left">
<asp:Label ID="Label1" runat="server">Matches Required for Inclusion:</asp:Label>&nbsp;&nbsp;
<des:IntegerTextBox ID="txtMatches" runat="server" TabIndex="103" Width="50px" MaxLength="8"></des:IntegerTextBox>
</td>
</tr>
<tr>
<td align="left">
<igtbl:UltraWebGrid ID="uwgPerformance" runat="server" Width="651px" Height="200px" Browser="UpLevel">
<Bands>
<igtbl:UltraGridBand>
<FilterOptions>
<FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"
Font-Size="11px" Width="200px">
<Padding Left="2px" />
</FilterDropDownStyle>
<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
</FilterHighlightRowStyle>
</FilterOptions>
<AddNewRow View="NotSet" Visible="NotSet">
</AddNewRow>
</igtbl:UltraGridBand>
</Bands>
<DisplayLayout AllowSortingDefault="OnClient" BorderCollapseDefault="Separate" CellClickActionDefault="RowSelect"
HeaderClickActionDefault="SortSingle" Name="uwgScheduleSet" RowHeightDefault="15px"
SelectTypeRowDefault="Single" Version="3.00">
<ClientSideEvents InitializeLayoutHandler="UltraWebGrid_InitializeLayoutHandler" />
<FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt"
Height="200px" Width="651px">
</FrameStyle>
<RowAlternateStyleDefault BackColor="WhiteSmoke">
</RowAlternateStyleDefault>
<Pager>
<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
</PagerStyle>
</Pager>
<EditCellStyleDefault BorderStyle="None" BorderWidth="0px" Cursor="Default">
</EditCellStyleDefault>
<FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
</FooterStyleDefault>
<HeaderStyleDefault BackgroundImage="../Images/Infragistics/Grid/Grid_Header_Bkgrnd.gif"
BorderStyle="Solid" Cursor="Default">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
</HeaderStyleDefault>
<RowSelectorStyleDefault BackColor="LightGray">
</RowSelectorStyleDefault>
<RowStyleDefault BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" Cursor="Default">
<Padding Left="3px" />
<BorderDetails WidthLeft="0px" WidthTop="0px" />
</RowStyleDefault>
<SelectedRowStyleDefault BackgroundImage="../Images/Infragistics/Grid/Grid_Selection_Bkgrnd.gif"
Cursor="Default" ForeColor="Black" TextOverflow="Ellipsis">
</SelectedRowStyleDefault>
<AddNewBox>
<BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
</BoxStyle>
</AddNewBox>
<ActivationObject BorderColor="" BorderWidth="">
</ActivationObject>
<FilterOptionsDefault>
<FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"
Font-Size="11px" Width="200px">
<Padding Left="2px" />
</FilterDropDownStyle>
<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
</FilterHighlightRowStyle>
</FilterOptionsDefault>
</DisplayLayout>
</igtbl:UltraWebGrid>
</td>
</tr>
</table>
</div>
</fieldset>
<table cellspacing="5" cellpadding="0" border="0" style="width: 680px">
<tr>
<td align="right">
<des:Button ID="btnRefresh" runat="server" CausesValidation="False" DisableOnSubmit="true"
TabIndex="104" Text="Refresh" Width="81px" />&nbsp;&nbsp;
<des:Button ID="btnClose" runat="server" CausesValidation="False" DisableOnSubmit="true"
TabIndex="105" Text="Close" Width="81px" />
</td>
</tr>
</table>
</asp:Panel>
</asp:Content>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment