Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DataLayer:
- Sub GetStatistics(ByVal ProductNumbers As List(Of String), ByRef Passed As Integer, ByRef TestList As List(Of KeyValuePair(Of String, Integer)))
- For Each productNumber As String In ProductNumbers
- Dim TestAddIndex As Integer
- Using context As New SelmaEntities
- context.CommandTimeout = 150
- Dim Table = (From GoodProducts In context.TestResults
- Where (GoodProducts.Art_no = productNumber)
- Select GoodProducts.Art_no, GoodProducts.Failed).AsQueryable
- Dim GetTPDesc = (From tpProducts In context.TestResultLim
- Where tpProducts.Art_no = productNumber
- Order By tpProducts.TP_no
- Select tpProducts.TP_desc)
- For Each key In GetTPDesc
- TestList.Add(New KeyValuePair(Of String, Integer)(key.ToString, 0))
- Next
- Passed += Table.Where(Function(p) p.Failed <> 0 And p.Art_no = productNumber).Count
- For Each ArtFailedPair In Table
- TestAddIndex = ArtFailedPair.Failed
- If TestAddIndex <> 0 Then
- TestList(TestAddIndex - 1) = New KeyValuePair(Of String, Integer)(TestList(TestAddIndex - 1).Key, TestList(TestAddIndex - 1).Value + 1)
- End If
- Next
- End Using
- Next
- End Sub
- UserInterface:
- Sub GetStatistics(ByRef listView As ListView, ByRef label As Label)
- Dim passed As Integer
- dataLayer.GetStatistics(ProductNumbers, passed, TestList)
- label.Text = passed.ToString
- ListViewReBind(listView)
- passed = 0
- End Sub
- Sub ListViewReBind(ByRef listView As ListView)
- listView.DataSource = TestList
- listView.DataBind()
- End Sub
- And Code-Behind:
- Public Sub ListView1_PagePropertiesChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.PagePropertiesChangingEventArgs) Handles ListView1.PagePropertiesChanging
- userInterface.ListViewReBind(ListView1)
- End Sub
- And the pager:
- <asp:DataPager ID="DataPager1" runat="server" PageSize="5">
- <Fields>
- <asp:NextPreviousPagerField
- ButtonType="Button"
- ShowFirstPageButton="true"
- ShowLastPageButton="true" />
- </Fields>
- </asp:DataPager>
Advertisement
Add Comment
Please, Sign In to add comment