<%@ Page Language="VB" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="false"
CodeFile="ReleaseNotes.aspx.vb" Inherits="Admin_ReleaseNotes" %>
<asp:Content ContentPlaceHolderID="CP" runat="server">
<div>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<asp:Repeater ID="rpReleaseNotes" runat="server">
<HeaderTemplate>
<table style="width: 500px" cellpadding="2">
<tr style="background-color: #5D7B9D; color: White">
<td colspan="2">
<b>Release Notes</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" height="8px">
</td>
</tr>
<tr style="background-color: #EBEFF0">
<td>
<table style="background-color: #EBEFF0; width: 500px">
<tr>
<td>
<strong>Date:</strong>
<asp:Label ID="lblDate" runat="server" Text='<%#Eval("DateAdded") %>' Font-Bold="true" />
</td>
<td>
<strong>Version:</strong>
<asp:Label ID="lblVersion" runat="server" Font-Bold="true" Text='<%#Eval("DBVersion") %>' />
</td>
</tr>
</table>
</td>
</tr>
<tr style="background-color: #EBEFF0">
<td>
<table style="background-color: #EBEFF0; width: 500px">
<tr>
<td>
<asp:Label ID="lblNotes" runat="server" Text='<%#Eval("Notes") %>' Font-Bold="true" />
</td>
</tr>
</table>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<table>
<tr>
<td>
<asp:PlaceHolder ID="plcPaging" runat="server" />
<asp:Label runat="server" ID="lblPageName" /><asp:Label ID="lblCurrentPage" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</asp:Content>
-----------------------------------------------------------------------------
Imports System.Data.SqlClient
Imports System.Linq
Partial Class Admin_ReleaseNotes
Inherits AdminPage
Dim RowCount As Integer = 0
Dim GpageSize As Integer = 6
Dim pagecount As Integer = 0
#Region "Events"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim ThemeName As String = SystemSettingsBO.GetSettings("themename")
If (Not IsPostBack) Then
BindDataToGrid(ThemeName)
Getdate(GpageSize, 0)
If ViewState("AllPageCount") > 0 Then
lblCurrentPage.Text = "Page: " & "1" & " of " & ViewState("AllPageCount")
End If
Else
plcPaging.Controls.Clear()
Dim dt As DataTable = DirectCast(ViewState("MyTable"), DataTable)
CreatePagingControl(dt.Rows.Count)
End If
Catch ex As Exception
ErrorLog.XMLError("Page_Load", ex)
End Try
End Sub
#End Region
#Region "Methods"
''' <summary>
''' This is for Get the all Release Notes depending on (if themename matche 0r themename is null).
''' </summary>
''' <param name="ThemeName"></param>
''' <remarks></remarks>
Private Sub BindDataToGrid(ByVal ThemeName As String)
Try
Dim ds As DataSet = ReleaseNotesBO.GetAllReleaseNotes(ThemeName)
If ds.Tables(0).Rows.Count > 0 Then
ViewState.Add("MyTable", ds.Tables(0))
lblMessage.Text = ""
Else
lblMessage.Text = "No Release Notes Available!"
End If
Catch ex As Exception
ErrorLog.XMLError("BindDataToGrid Function", ex)
End Try
End Sub
Private Sub FetchData(ByVal take As Integer, ByVal skip As Integer)
Try
Dim page As System.Web.UI.WebControls.PagedDataSource = New PagedDataSource()
page.AllowCustomPaging = True
page.AllowPaging = True
Dim dt As DataTable = DirectCast(ViewState("MyTable"), DataTable)
Dim dv As New DataView()
dv = dt.DefaultView
Dim result = (From p In dt.AsEnumerable() Select PKReleaseNotesID = p.Field(Of Int64)("PKReleaseNotesID"), Notes = p.Field(Of String)("Notes"), ThemeName = p.Field(Of String)("ThemeName"), DateAdded = p.Field(Of String)("DateAdded"), DBVersion = p.Field(Of Integer)("DBVersion")).Skip(skip).Take(take)
rpReleaseNotes.DataSource = result
rpReleaseNotes.DataBind()
If Not IsPostBack Then
Dim RowCount As Integer = dt.Rows.Count
CreatePagingControl(RowCount)
End If
Catch ex As Exception
ErrorLog.XMLError("FetchData Function", ex)
End Try
End Sub
''' <summary>
''' This is for Create and Add the page numbers for paging of Repeater control.
''' </summary>
''' <param name="RowCount"></param>
''' <remarks></remarks>
Private Sub CreatePagingControl(ByVal RowCount As Integer)
Try
Dim pagesize As Decimal = (RowCount / GpageSize)
If ((pagesize Mod 1) = 0) Then
pagesize = pagesize - 1
Else
Dim PageNo() As String = CType(pagesize, String).Split(".")
pagesize = PageNo(0)
End If
If pagesize > 0 Then
For i As Integer = 0 To pagesize
Dim lnk As New LinkButton()
AddHandler lnk.Click, AddressOf lbl_Click
lnk.ID = "lnkPage" & (i + 1).ToString()
lnk.Text = (i + 1).ToString()
plcPaging.Controls.Add(lnk)
Dim spacer As New Label()
spacer.Text = " "
plcPaging.Controls.Add(spacer)
pagecount += 1
Next
End If
ViewState("AllPageCount") = pagecount
Catch ex As Exception
ErrorLog.XMLError("CreatePagingControl Function", ex)
End Try
End Sub
Private Sub lbl_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim lnk As LinkButton = TryCast(sender, LinkButton)
Dim currentPage As Integer = Integer.Parse(lnk.Text)
Dim take As Integer = GpageSize
Dim skip As Integer = ((currentPage - 1) * GpageSize)
lblCurrentPage.Text = "Page: " & (currentPage).ToString() & " of " & ViewState("AllPageCount")
Getdate(take, skip)
Catch ex As Exception
ErrorLog.XMLError("lbl_Click", ex)
End Try
End Sub
Private Sub Getdate(ByVal take As String, ByVal skip As String)
FetchData(take, skip)
End Sub
#End Region
End Class
=============================================================
BO File
--------
Imports Microsoft.VisualBasic
Public Class ReleaseNotesBO
Public Sub New()
End Sub
Public Shared Function GetAllReleaseNotes(ByVal ThemeName As String) As DataSet
Return ReleaseNotesDB.GetAllReleaseNotes(ThemeName)
End Function
End Class
==========================================================
DB File
--------
Imports System.Data.SqlClient
Public Class ReleaseNotesDB
Inherits BaseDB
Public Shared Function GetAllReleaseNotes(ByVal ThemeName As String) As DataSet
Dim spName As String = "spGetAllReleaseNotes"
Dim pThemeName As New SqlParameter("@ThemeName", SqlDbType.VarChar)
pThemeName.Value = ThemeName
Return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, spName, pThemeName)
End Function
End Class
=========================================================================
fields properties File
---------------------
Public Class ReleaseNotes
Public Sub New()
End Sub
Public Sub New(ByVal PKReleaseNotesID As Int64, ByVal Notes As String, ByVal DBVersion As Integer, ByVal DateAdded As DateTime, ByVal ThemeName As String)
_PKReleaseNotesID = PKReleaseNotesID
_Notes = Notes
_DBVersion = DBVersion
_DateAdded = DateAdded
End Sub
Private _PKReleaseNotesID As Int64
Public Property PKReleaseNotesID() As Int64
Get
Return (_PKReleaseNotesID)
End Get
Set(ByVal value As Int64)
_PKReleaseNotesID = value
End Set
End Property
Private _Notes As String
Public Property Notes() As String
Get
Return (_Notes)
End Get
Set(ByVal value As String)
_Notes = value
End Set
End Property
Private _DBVersion As Integer
Public Property DBVersion() As Integer
Get
Return (_DBVersion)
End Get
Set(ByVal value As Integer)
_DBVersion = value
End Set
End Property
Private _DateAdded As DateTime
Public Property DateAdded() As DateTime
Get
Return _DateAdded
End Get
Set(ByVal Value As DateTime)
_DateAdded = Value
End Set
End Property
Private _ThemeName As String
Public Property ThemeName() As String
Get
Return (_ThemeName)
End Get
Set(ByVal value As String)
_ThemeName = value
End Set
End Property
End Class
CodeFile="ReleaseNotes.aspx.vb" Inherits="Admin_ReleaseNotes" %>
<asp:Content ContentPlaceHolderID="CP" runat="server">
<div>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<asp:Repeater ID="rpReleaseNotes" runat="server">
<HeaderTemplate>
<table style="width: 500px" cellpadding="2">
<tr style="background-color: #5D7B9D; color: White">
<td colspan="2">
<b>Release Notes</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" height="8px">
</td>
</tr>
<tr style="background-color: #EBEFF0">
<td>
<table style="background-color: #EBEFF0; width: 500px">
<tr>
<td>
<strong>Date:</strong>
<asp:Label ID="lblDate" runat="server" Text='<%#Eval("DateAdded") %>' Font-Bold="true" />
</td>
<td>
<strong>Version:</strong>
<asp:Label ID="lblVersion" runat="server" Font-Bold="true" Text='<%#Eval("DBVersion") %>' />
</td>
</tr>
</table>
</td>
</tr>
<tr style="background-color: #EBEFF0">
<td>
<table style="background-color: #EBEFF0; width: 500px">
<tr>
<td>
<asp:Label ID="lblNotes" runat="server" Text='<%#Eval("Notes") %>' Font-Bold="true" />
</td>
</tr>
</table>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<table>
<tr>
<td>
<asp:PlaceHolder ID="plcPaging" runat="server" />
<asp:Label runat="server" ID="lblPageName" /><asp:Label ID="lblCurrentPage" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</asp:Content>
-----------------------------------------------------------------------------
Imports System.Data.SqlClient
Imports System.Linq
Partial Class Admin_ReleaseNotes
Inherits AdminPage
Dim RowCount As Integer = 0
Dim GpageSize As Integer = 6
Dim pagecount As Integer = 0
#Region "Events"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim ThemeName As String = SystemSettingsBO.GetSettings("themename")
If (Not IsPostBack) Then
BindDataToGrid(ThemeName)
Getdate(GpageSize, 0)
If ViewState("AllPageCount") > 0 Then
lblCurrentPage.Text = "Page: " & "1" & " of " & ViewState("AllPageCount")
End If
Else
plcPaging.Controls.Clear()
Dim dt As DataTable = DirectCast(ViewState("MyTable"), DataTable)
CreatePagingControl(dt.Rows.Count)
End If
Catch ex As Exception
ErrorLog.XMLError("Page_Load", ex)
End Try
End Sub
#End Region
#Region "Methods"
''' <summary>
''' This is for Get the all Release Notes depending on (if themename matche 0r themename is null).
''' </summary>
''' <param name="ThemeName"></param>
''' <remarks></remarks>
Private Sub BindDataToGrid(ByVal ThemeName As String)
Try
Dim ds As DataSet = ReleaseNotesBO.GetAllReleaseNotes(ThemeName)
If ds.Tables(0).Rows.Count > 0 Then
ViewState.Add("MyTable", ds.Tables(0))
lblMessage.Text = ""
Else
lblMessage.Text = "No Release Notes Available!"
End If
Catch ex As Exception
ErrorLog.XMLError("BindDataToGrid Function", ex)
End Try
End Sub
Private Sub FetchData(ByVal take As Integer, ByVal skip As Integer)
Try
Dim page As System.Web.UI.WebControls.PagedDataSource = New PagedDataSource()
page.AllowCustomPaging = True
page.AllowPaging = True
Dim dt As DataTable = DirectCast(ViewState("MyTable"), DataTable)
Dim dv As New DataView()
dv = dt.DefaultView
Dim result = (From p In dt.AsEnumerable() Select PKReleaseNotesID = p.Field(Of Int64)("PKReleaseNotesID"), Notes = p.Field(Of String)("Notes"), ThemeName = p.Field(Of String)("ThemeName"), DateAdded = p.Field(Of String)("DateAdded"), DBVersion = p.Field(Of Integer)("DBVersion")).Skip(skip).Take(take)
rpReleaseNotes.DataSource = result
rpReleaseNotes.DataBind()
If Not IsPostBack Then
Dim RowCount As Integer = dt.Rows.Count
CreatePagingControl(RowCount)
End If
Catch ex As Exception
ErrorLog.XMLError("FetchData Function", ex)
End Try
End Sub
''' <summary>
''' This is for Create and Add the page numbers for paging of Repeater control.
''' </summary>
''' <param name="RowCount"></param>
''' <remarks></remarks>
Private Sub CreatePagingControl(ByVal RowCount As Integer)
Try
Dim pagesize As Decimal = (RowCount / GpageSize)
If ((pagesize Mod 1) = 0) Then
pagesize = pagesize - 1
Else
Dim PageNo() As String = CType(pagesize, String).Split(".")
pagesize = PageNo(0)
End If
If pagesize > 0 Then
For i As Integer = 0 To pagesize
Dim lnk As New LinkButton()
AddHandler lnk.Click, AddressOf lbl_Click
lnk.ID = "lnkPage" & (i + 1).ToString()
lnk.Text = (i + 1).ToString()
plcPaging.Controls.Add(lnk)
Dim spacer As New Label()
spacer.Text = " "
plcPaging.Controls.Add(spacer)
pagecount += 1
Next
End If
ViewState("AllPageCount") = pagecount
Catch ex As Exception
ErrorLog.XMLError("CreatePagingControl Function", ex)
End Try
End Sub
Private Sub lbl_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim lnk As LinkButton = TryCast(sender, LinkButton)
Dim currentPage As Integer = Integer.Parse(lnk.Text)
Dim take As Integer = GpageSize
Dim skip As Integer = ((currentPage - 1) * GpageSize)
lblCurrentPage.Text = "Page: " & (currentPage).ToString() & " of " & ViewState("AllPageCount")
Getdate(take, skip)
Catch ex As Exception
ErrorLog.XMLError("lbl_Click", ex)
End Try
End Sub
Private Sub Getdate(ByVal take As String, ByVal skip As String)
FetchData(take, skip)
End Sub
#End Region
End Class
=============================================================
BO File
--------
Imports Microsoft.VisualBasic
Public Class ReleaseNotesBO
Public Sub New()
End Sub
Public Shared Function GetAllReleaseNotes(ByVal ThemeName As String) As DataSet
Return ReleaseNotesDB.GetAllReleaseNotes(ThemeName)
End Function
End Class
==========================================================
DB File
--------
Imports System.Data.SqlClient
Public Class ReleaseNotesDB
Inherits BaseDB
Public Shared Function GetAllReleaseNotes(ByVal ThemeName As String) As DataSet
Dim spName As String = "spGetAllReleaseNotes"
Dim pThemeName As New SqlParameter("@ThemeName", SqlDbType.VarChar)
pThemeName.Value = ThemeName
Return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, spName, pThemeName)
End Function
End Class
=========================================================================
fields properties File
---------------------
Public Class ReleaseNotes
Public Sub New()
End Sub
Public Sub New(ByVal PKReleaseNotesID As Int64, ByVal Notes As String, ByVal DBVersion As Integer, ByVal DateAdded As DateTime, ByVal ThemeName As String)
_PKReleaseNotesID = PKReleaseNotesID
_Notes = Notes
_DBVersion = DBVersion
_DateAdded = DateAdded
End Sub
Private _PKReleaseNotesID As Int64
Public Property PKReleaseNotesID() As Int64
Get
Return (_PKReleaseNotesID)
End Get
Set(ByVal value As Int64)
_PKReleaseNotesID = value
End Set
End Property
Private _Notes As String
Public Property Notes() As String
Get
Return (_Notes)
End Get
Set(ByVal value As String)
_Notes = value
End Set
End Property
Private _DBVersion As Integer
Public Property DBVersion() As Integer
Get
Return (_DBVersion)
End Get
Set(ByVal value As Integer)
_DBVersion = value
End Set
End Property
Private _DateAdded As DateTime
Public Property DateAdded() As DateTime
Get
Return _DateAdded
End Get
Set(ByVal Value As DateTime)
_DateAdded = Value
End Set
End Property
Private _ThemeName As String
Public Property ThemeName() As String
Get
Return (_ThemeName)
End Get
Set(ByVal value As String)
_ThemeName = value
End Set
End Property
End Class
No comments:
Post a Comment