Imports SpectrumWiki.BusinessComponent Imports System Imports System.Collections Imports System.Collections.Generic Imports System.Reflection Imports System.IO Partial Public Class _New Inherits BasePage Dim wiki_text_id As Integer = 0 Dim temp_wiki_text_id As Integer = 0 Dim mainHeading As String Dim descrp As String Dim temp_text_id As Integer = 0 Dim arrayList As New ArrayList() Dim countArray As Integer Dim fileName As String #Region "Private Member Variables" Private _imgPath As String = "~/wiki/Graphics/" Private _thumbNailPath As String = "~/wiki/GraphicsThumbnail/" Private _thumbNailHeight As Integer = Convert.ToInt32(ConfigurationManager.AppSettings("ThumbnailHeight")) Private _thumbNailWidth As Integer = Convert.ToInt32(ConfigurationManager.AppSettings("ThumbnailWidth")) Private _validPhotoFormats As String() = New String(9) {} Private _photoformat As String = ConfigurationSettings.AppSettings("validPhotoFormats") Private _seperator As Char() = {","c} Private _seperatorSlash As Char() = {"/"c} Private _split As Char() = {"."c} Private _imagename As String() = New String(5) {} Private _isflag As Boolean Private _dbPath As String Private _validFileFormat As String() = New String() {} Private _fileFormat As String = ConfigurationSettings.AppSettings("FileFormat") Dim nbCount As Integer = 0 Dim nbpCount As Integer = 0 Dim nfCount As Integer = 0 Dim nfpCount As Integer = 0 Dim ncCount As Integer = 0 Dim ncpCount As Integer = 0 Dim nbcCount As Integer = 0 Dim nbcpCount As Integer = 0 Dim editWikiId As Integer = 0 #End Region Protected Sub Page_Init(ByVal Sender As Object, ByVal e As EventArgs) Handles Me.Init 'End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load mainHeading = txtMainHeading.Text descrp = txtDescription.Text 'Dim c As Control = GetPostBackControl(Page) 'If Not IsNothing(c) Then ' 'If the add button was clicked, increase the count to let the page know we want ' 'to display an additional user control ' If c.ID.ToString = "btnAdd" Then ' ViewState("nb") = ViewState("nb") + 1 ' End If 'End If 'If ViewState("nb") = Nothing Then Dim nb As Integer = CInt(Request.QueryString("nb")) ''For i As Integer = 1 To nb '' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") '' ctrl.FrequencyRangeNumber = i '' pnlBandEntries.Controls.Add(ctrl) '' AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand ''Next 'Else 'pnlBandEntries.Controls.Clear() 'For i As Integer = 1 To CInt(ViewState("nb")) ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.FrequencyRangeNumber = i ' pnlBandEntries.Controls.Add(ctrl) ' AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand 'Next 'End If 'Dim nbp As Integer = CInt(Request.QueryString("nbp")) 'For i As Integer = 1 To nbp ' Dim ctrlPairedFrequency As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") ' ctrlPairedFrequency.PairedFrequencyNumber = i ' pnlBandEntries.Controls.Add(ctrlPairedFrequency) 'Next 'Dim nf As Integer = CInt(Request.QueryString("nf")) 'For i As Integer = 1 To nf ' Dim ctrlFrequency As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") ' ctrlFrequency.FrequencyNumber = i ' pnlBandEntries.Controls.Add(ctrlFrequency) 'Next 'Dim nfp As Integer = CInt(Request.QueryString("nfp")) 'For i As Integer = 1 To nfp ' Dim ctrlPairFrequency As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") ' ctrlPairFrequency.PairedNumber = i ' pnlBandEntries.Controls.Add(ctrlPairFrequency) 'Next 'Dim nc As Integer = CInt(Request.QueryString("nc")) 'For i As Integer = 1 To nc ' Dim ctrlChannel As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ' ctrlChannel.ChannelizedFrequencyNumber = i ' pnlBandEntries.Controls.Add(ctrlChannel) 'Next 'Dim ncp As Integer = CInt(Request.QueryString("ncp")) 'For i As Integer = 1 To ncp ' Dim ctrlChannelPairFrequency As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ' ctrlChannelPairFrequency.ChannelPairNumber = i ' pnlBandEntries.Controls.Add(ctrlChannelPairFrequency) 'Next 'Dim nbc As Integer = CInt(Request.QueryString("nbc")) 'For i As Integer = 1 To nbc ' Dim ctrlChannelBand As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ' ctrlChannelBand.ChannelizedBandNumber = i ' pnlBandEntries.Controls.Add(ctrlChannelBand) 'Next 'Dim nbcp As Integer = CInt(Request.QueryString("nbcp")) 'For i As Integer = 1 To nbcp ' Dim ctrlPairedChannelFrequency As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ' ctrlPairedChannelFrequency.PairedChannelNumber = i ' pnlBandEntries.Controls.Add(ctrlPairedChannelFrequency) 'Next 'Restore the value on Corresponding Place On Click the AddEditPicture BACK Button ' wiki_text_id = Convert.ToInt32(Request.QueryString("WikiId")) 'If Not String.IsNullOrEmpty(Request.QueryString("Mode")) AndAlso Request.QueryString("Mode") = "Edit" Then If Not String.IsNullOrEmpty(Session("id")) Then wiki_text_id = Session("id") End If editWikiId = CInt(Request.QueryString("EditWikiId")) If editWikiId <> Nothing Then Session("id") = editWikiId wiki_text_id = Session("id") End If 'If Not String.IsNullOrEmpty(Session("TempWikiID")) Then ' temp_wiki_text_id = Session("TempWikiID") ' 'Convert.ToInt32(Request.QueryString("TempWikiId")) 'End If If Not String.IsNullOrEmpty(Request.QueryString("Id")) Then temp_wiki_text_id = Convert.ToInt32(Request.QueryString("Id")) 'Convert.ToInt32(Request.QueryString("TempWikiId")) End If 'End If If Not IsPostBack Then If (wiki_text_id > 0) Then Dim dt As DataTable = WikiTextBLL.GetWikiText(wiki_text_id) txtMainHeading.Text = dt.Rows(0)("head") txtDescription.Text = dt.Rows(0)("description") ElseIf (temp_wiki_text_id > 0) Then Dim dt As DataTable = WikiTextBLL.TempGetWikiText(temp_wiki_text_id) If dt.Rows.Count > 0 Then txtMainHeading.Text = dt.Rows(0)("head") txtDescription.Text = dt.Rows(0)("description") End If End If End If 'If (wiki_text_id > 0) Then ' Dim dt As DataTable = WikiTextBLL.GetWikiText(wiki_text_id) ' txtMainHeading.Text = dt.Rows(0)("head") ' txtDescription.Text = dt.Rows(0)("description") ' Dim ib As Integer = 1 ' Dim ibp As Integer = 1 ' Dim if1 As Integer = 1 ' Dim ifp As Integer = 1 ' Dim ic As Integer = 1 ' Dim icp As Integer = 1 ' Dim ibc As Integer = 1 ' Dim ibcp As Integer = 1 ' Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetAllFrequencies(wiki_text_id) ' Dim count As Integer = frequency.Count ' For i As Integer = 0 To count - 1 ' Select Case frequency(i).FrequencyType.ToString() ' Case "b" ' 'Done ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrl.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrl.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrl.BriefDescription = frequency(i).Description1.ToString() ' ctrl.RadioService1 = frequency(i).Service1.ToString() ' ctrl.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrl.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' Dim bfrequencyType As String = frequency(i).FrequencyType ' If bfrequencyType = "b" Then ' ctrl.FrequencyRangeNumber = ib ' ib = ib + 1 ' End If ' AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand ' pnlBandEntries.Controls.Add(ctrl) ' Case "bp" ' 'Done ' Dim ctrlPairedFrequency As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") ' ctrlPairedFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bpfrequencyType As String = frequency(i).FrequencyType ' If bpfrequencyType = "bp" Then ' ctrlPairedFrequency.PairedFrequencyNumber = ibp ' ibp = ibp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedFrequency) ' Case "f" ' 'Done ' Dim ctrlFrequency As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") ' ctrlFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlFrequency.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim f1frequencyType As String = frequency(i).FrequencyType ' If f1frequencyType = "f" Then ' ctrlFrequency.FrequencyNumber = if1 ' if1 = if1 + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlFrequency) ' Case "fp" ' 'Done ' Dim ctrlPairFrequency As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") ' ctrlPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairFrequency.BriefDescription1 = frequency(i).Description1.ToString() ' ctrlPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim fpfrequencyType As String = frequency(i).FrequencyType ' If fpfrequencyType = "fp" Then ' ctrlPairFrequency.PairedNumber = ifp ' ifp = ifp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairFrequency) ' Case "c" ' 'Done ' Dim ctrlChannel As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ' ctrlChannel.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannel.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannel.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannel.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannel.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim cfrequencyType As String = frequency(i).FrequencyType ' If cfrequencyType = "c" Then ' ctrlChannel.ChannelizedFrequencyNumber = ic ' ic = ic + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannel) ' Case "cp" ' 'Done ' Dim ctrlChannelPairFrequency As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ' ctrlChannelPairFrequency.ChannelFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.ChannelBriefDescription = frequency(i).Description1.ToString() ' ctrlChannelPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlChannelPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlChannelPairFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelPairFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlChannelPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlChannelPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim cpfrequencyType As String = frequency(i).FrequencyType ' If cpfrequencyType = "cp" Then ' ctrlChannelPairFrequency.ChannelPairNumber = icp ' icp = icp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelPairFrequency) ' Case "bc" ' 'Done ' Dim ctrlChannelBand As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ' ctrlChannelBand.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelBand.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlChannelBand.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannelBand.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelBand.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelBand.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim bcfrequencyType As String = frequency(i).FrequencyType ' If bcfrequencyType = "bc" Then ' ctrlChannelBand.ChannelizedBandNumber = ibc ' ibc = ibc + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelBand) ' Case "bcp" ' 'Done ' Dim ctrlPairedChannelFrequency As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ' ctrlPairedChannelFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedChannelFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedChannelFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedChannelFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedChannelFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlPairedChannelFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlPairedChannelFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedChannelFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedChannelFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedChannelFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedChannelFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bcpfrequencyType As String = frequency(i).FrequencyType ' If bcpfrequencyType = "bcp" Then ' ctrlPairedChannelFrequency.PairedChannelNumber = ibcp ' ibcp = ibcp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedChannelFrequency) ' End Select ' Next 'ElseIf (temp_wiki_text_id > 0) Then ' Dim dt As DataTable = WikiTextBLL.TempGetWikiText(temp_wiki_text_id) ' If dt.Rows.Count > 0 Then ' txtMainHeading.Text = dt.Rows(0)("head") ' txtDescription.Text = dt.Rows(0)("description") ' End If ' Dim ib As Integer = 1 ' Dim ibp As Integer = 1 ' Dim if1 As Integer = 1 ' Dim ifp As Integer = 1 ' Dim ic As Integer = 1 ' Dim icp As Integer = 1 ' Dim ibc As Integer = 1 ' Dim ibcp As Integer = 1 ' Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetAllFrequencies(temp_wiki_text_id) ' Dim count As Integer = frequency.Count ' For i As Integer = 0 To count - 1 ' Select Case frequency(i).FrequencyType.ToString() ' Case "b" ' 'Done ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrl.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrl.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrl.BriefDescription = frequency(i).Description1.ToString() ' ctrl.RadioService1 = frequency(i).Service1.ToString() ' ctrl.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrl.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrl.wikiFrequencyId = frequency(i).WikiFrequencyId ' Dim bfrequencyType As String = frequency(i).FrequencyType ' If bfrequencyType = "b" Then ' ctrl.FrequencyRangeNumber = ib ' ib = ib + 1 ' End If ' AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand ' pnlBandEntries.Controls.Add(ctrl) ' Case "bp" ' 'Done ' Dim ctrlPairedFrequency As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") ' ctrlPairedFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bpfrequencyType As String = frequency(i).FrequencyType ' If bpfrequencyType = "bp" Then ' ctrlPairedFrequency.PairedFrequencyNumber = ibp ' ibp = ibp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedFrequency) ' Case "f" ' 'Done ' Dim ctrlFrequency As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") ' ctrlFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlFrequency.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim f1frequencyType As String = frequency(i).FrequencyType ' If f1frequencyType = "f" Then ' ctrlFrequency.FrequencyNumber = if1 ' if1 = if1 + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlFrequency) ' Case "fp" ' 'Done ' Dim ctrlPairFrequency As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") ' ctrlPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairFrequency.BriefDescription1 = frequency(i).Description1.ToString() ' ctrlPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim fpfrequencyType As String = frequency(i).FrequencyType ' If fpfrequencyType = "fp" Then ' ctrlPairFrequency.PairedNumber = ifp ' ifp = ifp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairFrequency) ' Case "c" ' 'Done ' Dim ctrlChannel As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ' ctrlChannel.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannel.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannel.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannel.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannel.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim cfrequencyType As String = frequency(i).FrequencyType ' If cfrequencyType = "c" Then ' ctrlChannel.ChannelizedFrequencyNumber = ic ' ic = ic + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannel) ' Case "cp" ' 'Done ' Dim ctrlChannelPairFrequency As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ' ctrlChannelPairFrequency.ChannelFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.ChannelBriefDescription = frequency(i).Description1.ToString() ' ctrlChannelPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlChannelPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlChannelPairFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelPairFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlChannelPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlChannelPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim cpfrequencyType As String = frequency(i).FrequencyType ' If cpfrequencyType = "cp" Then ' ctrlChannelPairFrequency.ChannelPairNumber = icp ' icp = icp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelPairFrequency) ' Case "bc" ' 'Done ' Dim ctrlChannelBand As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ' ctrlChannelBand.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelBand.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlChannelBand.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannelBand.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelBand.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelBand.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim bcfrequencyType As String = frequency(i).FrequencyType ' If bcfrequencyType = "bc" Then ' ctrlChannelBand.ChannelizedBandNumber = ibc ' ibc = ibc + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelBand) ' Case "bcp" ' 'Done ' Dim ctrlPairedChannelFrequency As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ' ctrlPairedChannelFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedChannelFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedChannelFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedChannelFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedChannelFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlPairedChannelFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlPairedChannelFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedChannelFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedChannelFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedChannelFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedChannelFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bcpfrequencyType As String = frequency(i).FrequencyType ' If bcpfrequencyType = "bcp" Then ' ctrlPairedChannelFrequency.PairedChannelNumber = ibcp ' ibcp = ibcp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedChannelFrequency) ' End Select ' Next 'End If 'If Not String.IsNullOrEmpty(Session("update_wiki_text_id") > 0) Then 'BindGrid(CInt(Session("update_wiki_text_id"))) 'ViewState("FileCategory") = Nothing 'End If 'If temp_wiki_text_id > 0 Then BindGrid(temp_wiki_text_id) ViewState("FileCategory") = Nothing 'Edit nbcCount = Convert.ToInt32(Request.QueryString("nbcCount")) nbCount = Convert.ToInt32(Request.QueryString("nbCount")) nbcpCount = Convert.ToInt32(Request.QueryString("nbcpCount")) nbpCount = Convert.ToInt32(Request.QueryString("nbpCount")) ncCount = Convert.ToInt32(Request.QueryString("ncCount")) ncpCount = Convert.ToInt32(Request.QueryString("ncpCount")) nfCount = Convert.ToInt32(Request.QueryString("nfCount")) nfpCount = Convert.ToInt32(Request.QueryString("nfpCount")) If editWikiId <> Nothing Then Dim frequencytype As String Dim Rowcount As Integer Dim dt As DataTable Dim wiki_id As Integer = editWikiId 'wiki_id = Session("wiki_id").ToString() dt = WikiFrequencyBLL.GetWikiFrequency(wiki_id) If dt.Rows.Count > 0 Then Rowcount = dt.Rows.Count.ToString() For i = 0 To (Rowcount - 1) frequencytype = dt.Rows(i)("frequency_type").ToString() If frequencytype.ToString() = "b" Then nbCount = nbCount + 1 ElseIf frequencytype.ToString() = "bp" Then nbpCount = nbpCount + 1 ElseIf frequencytype.ToString() = "f" Then nfCount = nfCount + 1 ElseIf frequencytype.ToString() = "fp" Then nfpCount = nfpCount + 1 ElseIf frequencytype.ToString() = "c" Then ncCount = ncCount + 1 ElseIf frequencytype.ToString() = "bc" Then nbcCount = nbcCount + 1 ElseIf frequencytype.ToString() = "cp" Then ncpCount = ncpCount + 1 ElseIf frequencytype.ToString() = "bcp" Then nbcpCount = nbcpCount + 1 End If Next i End If End If AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() Dim nbpRangeCount As Integer = 0 'For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim lblPairedFrequencyNumber As Label = ucNb.FindControl("lblPairedFrequencyNumber") ' nbpRangeCount = nbpRangeCount + 1 ' lblPairedFrequencyNumber.Text = nbpRangeCount ' End If 'Next 'If nbpRangeCount = 1 Then ' For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim btnPairedFrequencyBandRemove As Button = ucNb.FindControl("btnPairedFrequencyBandRemove") ' btnPairedFrequencyBandRemove.Visible = False ' End If ' Next 'Else ' For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim btnPairedFrequencyBandRemove As Button = ucNb.FindControl("btnPairedFrequencyBandRemove") ' btnPairedFrequencyBandRemove.Visible = True ' End If ' Next 'End If 'Dim nbRangeCount As Integer = 0 'For Each stNb As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNb, UserControl) ' Dim lblFrequencyRangeNumber As Label = ucNb.FindControl("lblFrequencyRangeNumber") ' nbRangeCount = nbRangeCount + 1 ' lblFrequencyRangeNumber.Text = nbRangeCount ' End If 'Next 'If nbRangeCount = 1 Then ' For Each stNb As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNb, UserControl) ' Dim btnFrequencyBandRemove As Button = ucNb.FindControl("btnRemove") ' btnFrequencyBandRemove.Visible = False ' End If ' Next 'Else ' For Each stNb As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNb, UserControl) ' Dim btnFrequencyBandRemove As Button = ucNb.FindControl("btnRemove") ' btnFrequencyBandRemove.Visible = True ' End If ' Next 'End If ''specific frequency range 'Dim nfRangeCount As Integer = 0 'For Each stNf As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNf, UserControl) ' Dim lblFrequencyNumber As Label = ucNf.FindControl("lblFrequencyNumber") ' nfRangeCount = nfRangeCount + 1 ' lblFrequencyNumber.Text = nfRangeCount ' End If 'Next 'If nfRangeCount = 1 Then ' For Each stNf As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNf, UserControl) ' Dim btnSpecificFrequencyRemove As Button = ucNf.FindControl("btnSpecificFrequencyRemove") ' btnSpecificFrequencyRemove.Visible = False ' End If ' Next 'Else ' For Each stNf As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNf, UserControl) ' Dim btnSpecificFrequencyRemove As Button = ucNf.FindControl("btnSpecificFrequencyRemove") ' btnSpecificFrequencyRemove.Visible = True ' End If ' Next 'End If ''Paired frequency 'Dim nfpRangeCount As Integer = 0 'For Each stNfp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNfp, UserControl) ' Dim lblPairedNumber As Label = ucNf.FindControl("lblPairedNumber") ' nfpRangeCount = nfpRangeCount + 1 ' lblPairedNumber.Text = nfpRangeCount ' End If 'Next 'If nfpRangeCount = 1 Then ' For Each stNfp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNfp, UserControl) ' Dim btnPairedFrequencyRemove As Button = ucNf.FindControl("btnPairedFrequencyRemove") ' btnPairedFrequencyRemove.Visible = False ' End If ' Next 'Else ' For Each stNfp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNfp, UserControl) ' Dim btnPairedFrequencyRemove As Button = ucNf.FindControl("btnPairedFrequencyRemove") ' btnPairedFrequencyRemove.Visible = True ' End If ' Next 'End If ''channelized specific frequency 'Dim ncRangeCount As Integer = 0 'For Each stnc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then ' Dim ucNc As UserControl = CType(stnc, UserControl) ' Dim lblChannelizedFrequencyNumber As Label = ucNc.FindControl("lblChannelizedFrequencyNumber") ' ncRangeCount = ncRangeCount + 1 ' lblChannelizedFrequencyNumber.Text = ncRangeCount ' End If 'Next 'If ncRangeCount = 1 Then ' For Each stnc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then ' Dim ucNc As UserControl = CType(stnc, UserControl) ' Dim btnchannelizedspecificfrequencyRemove As Button = ucNc.FindControl("btnChannelizedSpecificFrequencyRemove") ' btnchannelizedspecificfrequencyRemove.Visible = False ' End If ' Next 'Else ' For Each stnc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then ' Dim ucNc As UserControl = CType(stnc, UserControl) ' Dim btnchannelizedspecificfrequencyRemove As Button = ucNc.FindControl("btnChannelizedSpecificFrequencyRemove") ' btnchannelizedspecificfrequencyRemove.Visible = True ' End If ' Next 'End If ''channelized paired frequency 'Dim ncpRangeCount As Integer = 0 'For Each stncp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then ' Dim ucncp As UserControl = CType(stncp, UserControl) ' Dim lblChannelpairFrequency As Label = ucncp.FindControl("lblChannelpairFrequency") ' ncpRangeCount = ncpRangeCount + 1 ' lblChannelpairFrequency.Text = ncpRangeCount ' End If 'Next 'If ncpRangeCount = 1 Then ' For Each stncp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then ' Dim ucncp As UserControl = CType(stncp, UserControl) ' Dim btnChannelizedPairedFrequencyRemove As Button = ucncp.FindControl("btnChannelizedPairedFrequencyRemove") ' btnChannelizedPairedFrequencyRemove.Visible = False ' End If ' Next 'Else ' For Each stncp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then ' Dim ucncp As UserControl = CType(stncp, UserControl) ' Dim btnChannelizedPairedFrequencyRemove As Button = ucncp.FindControl("btnChannelizedPairedFrequencyRemove") ' btnChannelizedPairedFrequencyRemove.Visible = True ' End If ' Next 'End If ''channelized frequency band 'Dim nbcRangeCount As Integer = 0 'For Each stnbc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then ' Dim ucnbc As UserControl = CType(stnbc, UserControl) ' Dim lblChannelizedBandNumber As Label = ucnbc.FindControl("lblChannelizedBandNumber") ' nbcRangeCount = nbcRangeCount + 1 ' lblChannelizedBandNumber.Text = nbcRangeCount ' End If 'Next 'If nbcRangeCount = 1 Then ' For Each stnbc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then ' Dim ucnbc As UserControl = CType(stnbc, UserControl) ' Dim btnChannelizedFrequencyBandRemove As Button = ucnbc.FindControl("btnChannelizedFrequencyBandRemove") ' btnChannelizedFrequencyBandRemove.Visible = False ' End If ' Next 'Else ' For Each stnbc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then ' Dim ucnbc As UserControl = CType(stnbc, UserControl) ' Dim btnChannelizedFrequencyBandRemove As Button = ucnbc.FindControl("btnChannelizedFrequencyBandRemove") ' btnChannelizedFrequencyBandRemove.Visible = True ' End If ' Next 'End If ''channelized paired frequency band 'Dim nbcpRangeCount As Integer = 0 'For Each stnbcp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then ' Dim ucnbcp As UserControl = CType(stnbcp, UserControl) ' Dim lblPairedChannelNumber As Label = ucnbcp.FindControl("lblPairedChannelNumber") ' nbcpRangeCount = nbcpRangeCount + 1 ' lblPairedChannelNumber.Text = nbcpRangeCount ' End If 'Next 'If nbcpRangeCount = 1 Then ' For Each stnbcp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then ' Dim ucnbcp As UserControl = CType(stnbcp, UserControl) ' Dim btnChannelizedPairedFrequencyBandRemove As Button = ucnbcp.FindControl("btnChannelizedPairedFrequencyBandRemove") ' btnChannelizedPairedFrequencyBandRemove.Visible = False ' End If ' Next 'Else ' For Each stnbcp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then ' Dim ucnbcp As UserControl = CType(stnbcp, UserControl) ' Dim btnChannelizedPairedFrequencyBandRemove As Button = ucnbcp.FindControl("btnChannelizedPairedFrequencyBandRemove") ' btnChannelizedPairedFrequencyBandRemove.Visible = True ' End If ' Next 'End If '_validFileFormat = _fileFormat.Split(_seperator) 'GetPostBackControl(Page) 'mainHeading = txtMainHeading.Text 'descrp = txtDescription.Text 'If ViewState("nb") = Nothing Then ' Dim nb As Integer = CInt(Request.QueryString("nb")) ' For i As Integer = 1 To nb ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.FrequencyRangeNumber = i ' pnlBandEntries.Controls.Add(ctrl) ' AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand ' Next 'Else ' ' pnlBandEntries.Controls.Clear() ' For i As Integer = 1 To CInt(ViewState("nb")) ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.FrequencyRangeNumber = i ' pnlBandEntries.Controls.Add(ctrl) ' AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand ' Next 'End If 'Dim nbp As Integer = CInt(Request.QueryString("nbp")) 'For i As Integer = 1 To nbp ' Dim ctrlPairedFrequency As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") ' ctrlPairedFrequency.PairedFrequencyNumber = i ' pnlBandEntries.Controls.Add(ctrlPairedFrequency) 'Next 'Dim nf As Integer = CInt(Request.QueryString("nf")) 'For i As Integer = 1 To nf ' Dim ctrlFrequency As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") ' ctrlFrequency.FrequencyNumber = i ' pnlBandEntries.Controls.Add(ctrlFrequency) 'Next 'Dim nfp As Integer = CInt(Request.QueryString("nfp")) 'For i As Integer = 1 To nfp ' Dim ctrlPairFrequency As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") ' ctrlPairFrequency.PairedNumber = i ' pnlBandEntries.Controls.Add(ctrlPairFrequency) 'Next 'Dim nc As Integer = CInt(Request.QueryString("nc")) 'For i As Integer = 1 To nc ' Dim ctrlChannel As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ' ctrlChannel.ChannelizedFrequencyNumber = i ' pnlBandEntries.Controls.Add(ctrlChannel) 'Next 'Dim ncp As Integer = CInt(Request.QueryString("ncp")) 'For i As Integer = 1 To ncp ' Dim ctrlChannelPairFrequency As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ' ctrlChannelPairFrequency.ChannelPairNumber = i ' pnlBandEntries.Controls.Add(ctrlChannelPairFrequency) 'Next 'Dim nbc As Integer = CInt(Request.QueryString("nbc")) 'For i As Integer = 1 To nbc ' Dim ctrlChannelBand As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ' ctrlChannelBand.ChannelizedBandNumber = i ' pnlBandEntries.Controls.Add(ctrlChannelBand) 'Next 'Dim nbcp As Integer = CInt(Request.QueryString("nbcp")) 'For i As Integer = 1 To nbcp ' Dim ctrlPairedChannelFrequency As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ' ctrlPairedChannelFrequency.PairedChannelNumber = i ' pnlBandEntries.Controls.Add(ctrlPairedChannelFrequency) 'Next ''Restore the value on Corresponding Place On Click the AddEditPicture BACK Button '' wiki_text_id = Convert.ToInt32(Request.QueryString("WikiId")) ''If Not String.IsNullOrEmpty(Request.QueryString("Mode")) AndAlso Request.QueryString("Mode") = "Edit" Then 'If Not String.IsNullOrEmpty(Session("id")) Then ' wiki_text_id = Session("id") 'End If ''If Not String.IsNullOrEmpty(Session("TempWikiID")) Then '' temp_wiki_text_id = Session("TempWikiID") '' 'Convert.ToInt32(Request.QueryString("TempWikiId")) ''End If 'If Not String.IsNullOrEmpty(Request.QueryString("Id")) Then ' temp_wiki_text_id = Convert.ToInt32(Request.QueryString("Id")) ' 'Convert.ToInt32(Request.QueryString("TempWikiId")) 'End If ''End If 'If (wiki_text_id > 0) Then ' Dim dt As DataTable = WikiTextBLL.GetWikiText(wiki_text_id) ' txtMainHeading.Text = dt.Rows(0)("head") ' txtDescription.Text = dt.Rows(0)("description") ' Dim ib As Integer = 1 ' Dim ibp As Integer = 1 ' Dim if1 As Integer = 1 ' Dim ifp As Integer = 1 ' Dim ic As Integer = 1 ' Dim icp As Integer = 1 ' Dim ibc As Integer = 1 ' Dim ibcp As Integer = 1 ' Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetAllFrequencies(wiki_text_id) ' Dim count As Integer = frequency.Count ' For i As Integer = 0 To count - 1 ' Select Case frequency(i).FrequencyType.ToString() ' Case "b" ' 'Done ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrl.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrl.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrl.BriefDescription = frequency(i).Description1.ToString() ' ctrl.RadioService1 = frequency(i).Service1.ToString() ' ctrl.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrl.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' Dim bfrequencyType As String = frequency(i).FrequencyType ' If bfrequencyType = "b" Then ' ctrl.FrequencyRangeNumber = ib ' ib = ib + 1 ' End If ' pnlBandEntries.Controls.Add(ctrl) ' Case "bp" ' 'Done ' Dim ctrlPairedFrequency As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") ' ctrlPairedFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bpfrequencyType As String = frequency(i).FrequencyType ' If bpfrequencyType = "bp" Then ' ctrlPairedFrequency.PairedFrequencyNumber = ibp ' ibp = ibp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedFrequency) ' Case "f" ' 'Done ' Dim ctrlFrequency As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") ' ctrlFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlFrequency.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim f1frequencyType As String = frequency(i).FrequencyType ' If f1frequencyType = "f" Then ' ctrlFrequency.FrequencyNumber = if1 ' if1 = if1 + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlFrequency) ' Case "fp" ' 'Done ' Dim ctrlPairFrequency As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") ' ctrlPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairFrequency.BriefDescription1 = frequency(i).Description1.ToString() ' ctrlPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim fpfrequencyType As String = frequency(i).FrequencyType ' If fpfrequencyType = "fp" Then ' ctrlPairFrequency.PairedNumber = ifp ' ifp = ifp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairFrequency) ' Case "c" ' 'Done ' Dim ctrlChannel As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ' ctrlChannel.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannel.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannel.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannel.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannel.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim cfrequencyType As String = frequency(i).FrequencyType ' If cfrequencyType = "c" Then ' ctrlChannel.ChannelizedFrequencyNumber = ic ' ic = ic + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannel) ' Case "cp" ' 'Done ' Dim ctrlChannelPairFrequency As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ' ctrlChannelPairFrequency.ChannelFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.ChannelBriefDescription = frequency(i).Description1.ToString() ' ctrlChannelPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlChannelPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlChannelPairFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelPairFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlChannelPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlChannelPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim cpfrequencyType As String = frequency(i).FrequencyType ' If cpfrequencyType = "cp" Then ' ctrlChannelPairFrequency.ChannelPairNumber = icp ' icp = icp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelPairFrequency) ' Case "bc" ' 'Done ' Dim ctrlChannelBand As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ' ctrlChannelBand.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelBand.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlChannelBand.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannelBand.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelBand.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelBand.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim bcfrequencyType As String = frequency(i).FrequencyType ' If bcfrequencyType = "bc" Then ' ctrlChannelBand.ChannelizedBandNumber = ibc ' ibc = ibc + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelBand) ' Case "bcp" ' 'Done ' Dim ctrlPairedChannelFrequency As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ' ctrlPairedChannelFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedChannelFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedChannelFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedChannelFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedChannelFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlPairedChannelFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlPairedChannelFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedChannelFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedChannelFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedChannelFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedChannelFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bcpfrequencyType As String = frequency(i).FrequencyType ' If bcpfrequencyType = "bcp" Then ' ctrlPairedChannelFrequency.PairedChannelNumber = ibcp ' ibcp = ibcp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedChannelFrequency) ' End Select ' Next 'ElseIf (temp_wiki_text_id > 0) Then ' Dim dt As DataTable = WikiTextBLL.TempGetWikiText(temp_wiki_text_id) ' If dt.Rows.Count > 0 Then ' txtMainHeading.Text = dt.Rows(0)("head") ' txtDescription.Text = dt.Rows(0)("description") ' End If ' Dim ib As Integer = 1 ' Dim ibp As Integer = 1 ' Dim if1 As Integer = 1 ' Dim ifp As Integer = 1 ' Dim ic As Integer = 1 ' Dim icp As Integer = 1 ' Dim ibc As Integer = 1 ' Dim ibcp As Integer = 1 ' Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetAllFrequencies(temp_wiki_text_id) ' Dim count As Integer = frequency.Count ' For i As Integer = 0 To count - 1 ' Select Case frequency(i).FrequencyType.ToString() ' Case "b" ' 'Done ' Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") ' ctrl.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrl.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrl.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrl.BriefDescription = frequency(i).Description1.ToString() ' ctrl.RadioService1 = frequency(i).Service1.ToString() ' ctrl.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrl.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' Dim bfrequencyType As String = frequency(i).FrequencyType ' If bfrequencyType = "b" Then ' ctrl.FrequencyRangeNumber = ib ' ib = ib + 1 ' End If ' pnlBandEntries.Controls.Add(ctrl) ' Case "bp" ' 'Done ' Dim ctrlPairedFrequency As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") ' ctrlPairedFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bpfrequencyType As String = frequency(i).FrequencyType ' If bpfrequencyType = "bp" Then ' ctrlPairedFrequency.PairedFrequencyNumber = ibp ' ibp = ibp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedFrequency) ' Case "f" ' 'Done ' Dim ctrlFrequency As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") ' ctrlFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlFrequency.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim f1frequencyType As String = frequency(i).FrequencyType ' If f1frequencyType = "f" Then ' ctrlFrequency.FrequencyNumber = if1 ' if1 = if1 + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlFrequency) ' Case "fp" ' 'Done ' Dim ctrlPairFrequency As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") ' ctrlPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairFrequency.BriefDescription1 = frequency(i).Description1.ToString() ' ctrlPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairFrequency.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim fpfrequencyType As String = frequency(i).FrequencyType ' If fpfrequencyType = "fp" Then ' ctrlPairFrequency.PairedNumber = ifp ' ifp = ifp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairFrequency) ' Case "c" ' 'Done ' Dim ctrlChannel As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ' ctrlChannel.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannel.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannel.Frequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannel.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannel.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannel.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim cfrequencyType As String = frequency(i).FrequencyType ' If cfrequencyType = "c" Then ' ctrlChannel.ChannelizedFrequencyNumber = ic ' ic = ic + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannel) ' Case "cp" ' 'Done ' Dim ctrlChannelPairFrequency As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ' ctrlChannelPairFrequency.ChannelFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.PairedWithFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.ChannelBriefDescription = frequency(i).Description1.ToString() ' ctrlChannelPairFrequency.PairedWithBriefDescription = frequency(i).Description2.ToString() ' ctrlChannelPairFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelPairFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlChannelPairFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelPairFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlChannelPairFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelPairFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelPairFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlChannelPairFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlChannelPairFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim cpfrequencyType As String = frequency(i).FrequencyType ' If cpfrequencyType = "cp" Then ' ctrlChannelPairFrequency.ChannelPairNumber = icp ' icp = icp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelPairFrequency) ' Case "bc" ' 'Done ' Dim ctrlChannelBand As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ' ctrlChannelBand.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlChannelBand.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlChannelBand.BriefDescription = frequency(i).Description1.ToString() ' ctrlChannelBand.ChannelName = frequency(i).Channel1.ToString() ' ctrlChannelBand.RadioService1 = frequency(i).Service1.ToString() ' ctrlChannelBand.RadioFrequency = CDbl(frequency(i).Frequency1Low) ' ctrlChannelBand.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' Dim bcfrequencyType As String = frequency(i).FrequencyType ' If bcfrequencyType = "bc" Then ' ctrlChannelBand.ChannelizedBandNumber = ibc ' ibc = ibc + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlChannelBand) ' Case "bcp" ' 'Done ' Dim ctrlPairedChannelFrequency As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ' ctrlPairedChannelFrequency.FromFrequencyRange1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.ToFrequencyRange1 = CDbl(frequency(i).Frequency1High) ' ctrlPairedChannelFrequency.FromPairedFrequency = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.ToPairedFrequency = CDbl(frequency(i).Frequency2High) ' ctrlPairedChannelFrequency.BriefDescription = frequency(i).Description1.ToString() ' ctrlPairedChannelFrequency.PairedBriefDescription = frequency(i).Description2.ToString() ' ctrlPairedChannelFrequency.ChannelName = frequency(i).Channel1.ToString() ' ctrlPairedChannelFrequency.PairedWithChannelName = frequency(i).Channel2.ToString() ' ctrlPairedChannelFrequency.AllocationTable = frequency(i).AllocationTable.ToString() ' ctrlPairedChannelFrequency.RadioService1 = frequency(i).Service1.ToString() ' ctrlPairedChannelFrequency.RadioService2 = frequency(i).Service2.ToString() ' ctrlPairedChannelFrequency.RadioFrequency1 = CDbl(frequency(i).Frequency1Low) ' ctrlPairedChannelFrequency.RadioFrequency2 = CDbl(frequency(i).Frequency2Low) ' ctrlPairedChannelFrequency.RadioQualifier1 = frequency(i).Qualifier1.ToString() ' ctrlPairedChannelFrequency.RadioQualifier2 = frequency(i).Qualifier2.ToString() ' Dim bcpfrequencyType As String = frequency(i).FrequencyType ' If bcpfrequencyType = "bcp" Then ' ctrlPairedChannelFrequency.PairedChannelNumber = ibcp ' ibcp = ibcp + 1 ' End If ' pnlBandEntries.Controls.Add(ctrlPairedChannelFrequency) ' End Select ' Next 'End If ''If Not String.IsNullOrEmpty(Session("update_wiki_text_id") > 0) Then ''BindGrid(CInt(Session("update_wiki_text_id"))) ''ViewState("FileCategory") = Nothing ''End If ''If temp_wiki_text_id > 0 Then 'BindGrid(temp_wiki_text_id) 'ViewState("FileCategory") = Nothing ''End If End Sub Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click ltlValues.Text = "" For Each c As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If c.GetType.Name.ToLower = "controls_frequencyband_ascx" Then Dim uc As UserControl = CType(c, UserControl) Dim tbx1 As TextBox = uc.FindControl("txtFromFrequency") Dim sb As New System.Text.StringBuilder sb.Append("Textbox value: " & tbx1.Text & "
") 'sb.Append("Dropdown value: " & ddl1.SelectedValue & "
") 'sb.AppendLine("Checkbox values: ") 'For Each li As ListItem In cbx1.Items ' If li.Selected = True Then ' sb.Append(li.Value & "
") ' End If 'Next 'sb.Append("
") ltlValues.Text &= sb.ToString End If Next Dim id As Integer 'Dim heading As String = txtMainHeading.Text 'txtMainHeading.Text = mainHeading 'txtDescription.Text = descrp 'Dim wikiText As WikiText = New WikiText() 'wikiText.Head = heading 'wikiText.Description = description 'Dim dt As DataTable = WikiTextBLL.GetWikiText(wiki_text_id) 'If (temp_wiki_text_id = 0) Then 'If (Request.QueryString.Count > 0) Then 'If wiki_text_id = 0 Then 'commented on aug 1,2011 'Try ' WikiTextBLL.TempDeleteWikiText(temp_wiki_text_id) ' WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) 'Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If 'End Try Dim heading As String = mainHeading Dim description As String = descrp Dim wikiText As WikiText = New WikiText() wikiText.Head = heading wikiText.Description = description If (temp_wiki_text_id = 0) Then Try id = WikiTextBLL.TempInsertWikiText(wikiText) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try Else wikiText.WikiTextId = temp_wiki_text_id Try WikiTextBLL.TempUpdateWikiText(wikiText) 'WikiTextBLL.TempDeleteWikiText(temp_wiki_text_id) WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) 'WikiTextBLL.TempInsertWikiText(wikiText) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'End If 'Else 'wikiText.WikiTextId = temp_wiki_text_id 'Try ' WikiTextBLL.TempUpdateWikiText(wikiText) ' 'WikiTextBLL.TempDeleteWikiText(temp_wiki_text_id) ' WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) ' 'WikiTextBLL.TempInsertWikiText(wikiText) 'Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If 'End Try 'End If 'txtMainHeading.Text = String.Empty 'txtDescription.Text = String.Empty For Each c As Control In pnlBandEntries.Controls 'frequency band nb If (TryCast(c, FrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim table As String Dim fb As FrequencyBand = TryCast(c, FrequencyBand) Dim txtBriefDescription As String = fb.BriefDescription Dim allocationTable As String = fb.AllocationTable Dim frequencyUnit As String = fb.RadioFrequency Dim radioService As String = fb.RadioService1 Dim radioQualifier As String = fb.RadioQualifier1 'createradioqualifier If (fb.FromFrequencyRange1 <> "0.0") Then If (frequencyUnit = "kHz") Then fromFrequency = CLng(fb.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(fb.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(fb.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(fb.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "b" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If End If 'inserting values of paired frequency band nbp If (TryCast(c, PairedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim fromPairedFrequency As Long Dim toPairedFrequency As Long Dim table As String Dim bp As PairedFrequencyBand = TryCast(c, PairedFrequencyBand) Dim txtBriefDescription As String = bp.BriefDescription Dim radioCommunicationService As String = bp.RadioService1 Dim radioQualifier1 As String = bp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bp.AllocationTable Dim frequencyUnit As String = bp.RadioFrequency1 Dim pairedToFrequency As Integer = bp.ToPairedFrequency Dim pairedBreifDescription As String = bp.PairedBriefDescription Dim radioCommunicationService2 As String = bp.RadioService2 Dim radioQualifier2 As String = bp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = bp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(bp.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bp.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bp.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bp.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000) Else fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000000) End If If (frequencyUnit2 = "kHz") Then toPairedFrequency = CLng(bp.ToPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000) Else toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.Frequency2Low = fromPairedFrequency wikiFrequency.Frequency2High = toPairedFrequency wikiFrequency.Description2 = pairedBreifDescription wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in specific frequency nf If (TryCast(c, SpecificFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim table As String Dim f As SpecificFrequency = TryCast(c, SpecificFrequency) Dim txtBriefDescription As String = f.BriefDescription Dim radioCommunicationService As String = f.RadioService1 Dim radioQualifier As String = f.RadioQualifier1 'createradioqualifier Dim allocationTable As String = f.AllocationTable Dim frequencyUnit As String = f.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(f.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(f.Frequency * 1000000) Else fromFrequency = CLng(f.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "f" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in paired frequency nfp If (TryCast(c, PairedFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim pairedFromFrequency As Long Dim table As String Dim fp As PairedFrequency = TryCast(c, PairedFrequency) Dim txtBriefDescription As String = fp.BriefDescription1 Dim radioCommunicationService As String = fp.RadioService1 Dim radioQualifier1 As String = fp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = fp.AllocationTable Dim frequencyUnit As String = fp.RadioFrequency1 Dim txtBriefDescription2 As String = fp.PairedWithBriefDescription Dim radioCommunicationService2 As String = fp.RadioService2 Dim radioQualifier2 As String = fp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = fp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(fp.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(fp.Frequency * 1000000) Else fromFrequency = CLng(fp.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000) Else pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "fp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If wikiFrequency.Frequency2Low = pairedFromFrequency wikiFrequency.Description2 = txtBriefDescription2 wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in Channelizedspecificfrequency nc If (TryCast(c, ChannelizedSpecificFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim table As String Dim nc As ChannelizedSpecificFrequency = TryCast(c, ChannelizedSpecificFrequency) Dim txtBriefDescription As String = nc.BriefDescription Dim txtChannelName As String = nc.ChannelName Dim radioCommunicationService As String = nc.RadioService1 Dim radioQualifier As String = nc.RadioQualifier1 'createradioqualifier Dim allocationTable As String = nc.AllocationTable Dim frequencyUnit As String = nc.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(nc.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(nc.Frequency * 1000000) Else fromFrequency = CLng(nc.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "c" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in channelizedPairedfrequency ncp If (TryCast(c, ChannelizedPairedFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim pairedFromFrequency As Long Dim table As String Dim cp As ChannelizedPairedFrequency = TryCast(c, ChannelizedPairedFrequency) Dim txtBriefDescription As String = cp.ChannelBriefDescription Dim txtChannelName As String = cp.ChannelName Dim radioCommunicationService As String = cp.RadioService1 Dim radioQualifier1 As String = cp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = cp.AllocationTable Dim frequencyUnit As String = cp.RadioFrequency1 Dim txtBriefDescription2 As String = cp.PairedWithBriefDescription Dim pairedChannelName As String = cp.PairedWithChannelName Dim radioCommunicationService2 As String = cp.RadioService2 Dim radioQualifier2 As String = cp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = cp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(cp.ChannelFrequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(cp.ChannelFrequency * 1000000) Else fromFrequency = CLng(cp.ChannelFrequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000) Else pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "cp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If wikiFrequency.Frequency2Low = pairedFromFrequency wikiFrequency.Description2 = txtBriefDescription2 wikiFrequency.Channel2 = pairedChannelName wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'channelized frequency band nbc If (TryCast(c, ChannelizedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim table As String Dim bc As ChannelizedFrequencyBand = TryCast(c, ChannelizedFrequencyBand) Dim txtBriefDescription As String = bc.BriefDescription Dim txtChannelName As String = bc.ChannelName Dim radioCommunicationService As String = bc.RadioService1 Dim radioQualifier As String = bc.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bc.AllocationTable Dim frequencyUnit As String = bc.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(bc.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bc.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bc.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bc.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bc" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'inserting values of channelized paired frequency band nbcp If (TryCast(c, ChannelizedPairedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim fromPairedFrequency As Long Dim toPairedFrequency As Long Dim table As String Dim bcp As ChannelizedPairedFrequencyBand = TryCast(c, ChannelizedPairedFrequencyBand) Dim txtBriefDescription As String = bcp.BriefDescription Dim txtChannelName As String = bcp.ChannelName Dim radioCommunicationService As String = bcp.RadioService1 Dim radioQualifier1 As String = bcp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bcp.AllocationTable Dim frequencyUnit As String = bcp.RadioFrequency1 Dim pairedBreifDescription As String = bcp.PairedBriefDescription Dim pairedChannelName As String = bcp.PairedWithChannelName Dim radioCommunicationService2 As String = bcp.RadioService2 Dim radioQualifier2 As String = bcp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = bcp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bcp.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000) Else fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000000) End If If (frequencyUnit2 = "kHz") Then toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000) Else toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bcp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.Frequency2Low = fromPairedFrequency wikiFrequency.Frequency2High = toPairedFrequency wikiFrequency.Description2 = pairedBreifDescription wikiFrequency.Channel2 = pairedChannelName wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier wikiFrequency.AllocationTable = table If (temp_wiki_text_id > 0) Then wikiFrequency.WikiTextId = temp_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.TempInsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If Next Session.Remove("id") If (id > 0) Then Response.Redirect("~/wiki/AddEditPicture.aspx?TempWikiId=" + id.ToString() & "&nbCount=" & nbCount & "&nbpCount=" & nbpCount & "&nfCount=" & nfCount & "&nfpCount=" & nfpCount & "&ncCount=" & ncCount & "&ncpCount=" & ncpCount & "&nbcCount=" & nbcCount & "&nbcpCount=" & nbcpCount) ElseIf (temp_wiki_text_id > 0) Then Response.Redirect("~/wiki/AddEditPicture.aspx?TempWikiId=" + temp_wiki_text_id.ToString() & "&nbCount=" & nbCount & "&nbpCount=" & nbpCount & "&nfCount=" & nfCount & "&nfpCount=" & nfpCount & "&ncCount=" & ncCount & "&ncpCount=" & ncpCount & "&nbcCount=" & nbcCount & "&nbcpCount=" & nbcpCount) End If 'Else ' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + wiki_text_id.ToString()) 'End If End Sub 'Protected Sub BindGrid(ByVal wiki_text_id As Integer) ' Try ' gvAddEditPicture.DataSource = WikiGraphicsBLL.GetWikiGraphics(wiki_text_id) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' gvAddEditPicture.DataBind() 'End Sub Protected Sub BindGrid(ByVal wiki_text_id As Integer) Try gvAddEditPicture.DataSource = WikiGraphicsBLL.GetTempWikiGraphics(wiki_text_id) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try gvAddEditPicture.DataBind() End Sub Protected Sub gvAddEditPicture_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvAddEditPicture.RowDataBound _validFileFormat = _fileFormat.Split(_seperator) If (e.Row.RowType = DataControlRowType.DataRow) Then Dim fileName As String = DataBinder.Eval(e.Row.DataItem, "file_name").ToString() Dim fileExt As String = DataBinder.Eval(e.Row.DataItem, "file_extension").ToString() Dim pictureId As String = DataBinder.Eval(e.Row.DataItem, "wiki_graphic_id").ToString() Dim lblFileCategory As System.Web.UI.WebControls.Label = CType(e.Row.FindControl("lblFileCategory"), System.Web.UI.WebControls.Label) Dim strval As String = DirectCast(lblFileCategory, Label).Text Dim title As String = DirectCast(ViewState("FileCategory"), String) If title = strval Then lblFileCategory.Visible = False lblFileCategory.Text = String.Empty Else title = strval ViewState("FileCategory") = title lblFileCategory.Visible = True lblFileCategory.Text = title End If 'Dim imageFile As System.Web.UI.WebControls.Image = CType(e.Row.FindControl("imgPicture"), System.Web.UI.WebControls.Image) 'imageFile.ImageUrl = _thumbNailPath & fileName + fileExt End If 'If (e.Row.RowType = DataControlRowType.DataRow) Then ' Dim lblFileCategory As Label = DirectCast(e.Row.FindControl("lblFileCategory"), Label) ' 'Dim lnkImageName As LinkButton = DirectCast(e.Row.FindControl("lnkImageName"), LinkButton) ' 'Dim lbtnRemove As LinkButton = DirectCast(e.Row.FindControl("lbtnRemove"), LinkButton) 'End If End Sub Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click Dim id As Integer Dim heading As String = txtMainHeading.Text Dim description As String = txtDescription.Text wiki_text_id = Convert.ToInt32(Request.QueryString("WikiId")) Dim update_wiki_text_id As Integer = 0 Dim wikiText As WikiText = New WikiText() 'wikiText.Head = heading 'wikiText.Description = description wikiText.Head = mainHeading wikiText.Description = descrp txtDescription.Text = descrp txtMainHeading.Text = mainHeading If String.IsNullOrEmpty(Session("update_wiki_text_id")) Then 'If (wiki_text_id = 0) Then 'If (Request.QueryString.Count > 0) Then Try id = WikiTextBLL.InsertWikiText(wikiText) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try 'End If Else update_wiki_text_id = Session("update_wiki_text_id") wikiText.WikiTextId = update_wiki_text_id Try WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(update_wiki_text_id) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'txtMainHeading.Text = String.Empty 'txtDescription.Text = String.Empty For Each c As Control In pnlBandEntries.Controls 'frequency band nb If (TryCast(c, FrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim table As String Dim fb As FrequencyBand = TryCast(c, FrequencyBand) Dim txtBriefDescription As String = fb.BriefDescription Dim allocationTable As String = fb.AllocationTable Dim frequencyUnit As String = fb.RadioFrequency Dim radioService As String = fb.RadioService1 Dim radioQualifier As String = fb.RadioQualifier1 'createradioqualifier If (fb.FromFrequencyRange1 <> "0.0") Then If (frequencyUnit = "kHz") Then fromFrequency = CLng(fb.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(fb.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(fb.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(fb.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "b" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If End If 'inserting values of paired frequency band nbp If (TryCast(c, PairedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim fromPairedFrequency As Long Dim toPairedFrequency As Long Dim table As String Dim bp As PairedFrequencyBand = TryCast(c, PairedFrequencyBand) Dim txtBriefDescription As String = bp.BriefDescription Dim radioCommunicationService As String = bp.RadioService1 Dim radioQualifier1 As String = bp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bp.AllocationTable Dim frequencyUnit As String = bp.RadioFrequency1 Dim pairedToFrequency As Integer = bp.ToPairedFrequency Dim pairedBreifDescription As String = bp.PairedBriefDescription Dim radioCommunicationService2 As String = bp.RadioService2 Dim radioQualifier2 As String = bp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = bp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(bp.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bp.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bp.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bp.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000) Else fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000000) End If If (frequencyUnit2 = "kHz") Then toPairedFrequency = CLng(bp.ToPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000) Else toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.Frequency2Low = fromPairedFrequency wikiFrequency.Frequency2High = toPairedFrequency wikiFrequency.Description2 = pairedBreifDescription wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in specific frequency nf If (TryCast(c, SpecificFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim table As String Dim f As SpecificFrequency = TryCast(c, SpecificFrequency) Dim txtBriefDescription As String = f.BriefDescription Dim radioCommunicationService As String = f.RadioService1 Dim radioQualifier As String = f.RadioQualifier1 'createradioqualifier Dim allocationTable As String = f.AllocationTable Dim frequencyUnit As String = f.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(f.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(f.Frequency * 1000000) Else fromFrequency = CLng(f.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "f" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in paired frequency nfp If (TryCast(c, PairedFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim pairedFromFrequency As Long Dim table As String Dim fp As PairedFrequency = TryCast(c, PairedFrequency) Dim txtBriefDescription As String = fp.BriefDescription1 Dim radioCommunicationService As String = fp.RadioService1 Dim radioQualifier1 As String = fp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = fp.AllocationTable Dim frequencyUnit As String = fp.RadioFrequency1 Dim txtBriefDescription2 As String = fp.PairedWithBriefDescription Dim radioCommunicationService2 As String = fp.RadioService2 Dim radioQualifier2 As String = fp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = fp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(fp.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(fp.Frequency * 1000000) Else fromFrequency = CLng(fp.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000) Else pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "fp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If wikiFrequency.Frequency2Low = pairedFromFrequency wikiFrequency.Description2 = txtBriefDescription2 wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in Channelizedspecificfrequency nc If (TryCast(c, ChannelizedSpecificFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim table As String Dim nc As ChannelizedSpecificFrequency = TryCast(c, ChannelizedSpecificFrequency) Dim txtBriefDescription As String = nc.BriefDescription Dim txtChannelName As String = nc.ChannelName Dim radioCommunicationService As String = nc.RadioService1 Dim radioQualifier As String = nc.RadioQualifier1 'createradioqualifier Dim allocationTable As String = nc.AllocationTable Dim frequencyUnit As String = nc.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(nc.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(nc.Frequency * 1000000) Else fromFrequency = CLng(nc.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "c" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in channelizedPairedfrequency ncp If (TryCast(c, ChannelizedPairedFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim pairedFromFrequency As Long Dim table As String Dim cp As ChannelizedPairedFrequency = TryCast(c, ChannelizedPairedFrequency) Dim txtBriefDescription As String = cp.ChannelBriefDescription Dim txtChannelName As String = cp.ChannelName Dim radioCommunicationService As String = cp.RadioService1 Dim radioQualifier1 As String = cp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = cp.AllocationTable Dim frequencyUnit As String = cp.RadioFrequency1 Dim txtBriefDescription2 As String = cp.PairedWithBriefDescription Dim pairedChannelName As String = cp.PairedWithChannelName Dim radioCommunicationService2 As String = cp.RadioService2 Dim radioQualifier2 As String = cp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = cp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(cp.ChannelFrequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(cp.ChannelFrequency * 1000000) Else fromFrequency = CLng(cp.ChannelFrequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000) Else pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "cp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If wikiFrequency.Frequency2Low = pairedFromFrequency wikiFrequency.Description2 = txtBriefDescription2 wikiFrequency.Channel2 = pairedChannelName wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'channelized frequency band nbc If (TryCast(c, ChannelizedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim table As String Dim bc As ChannelizedFrequencyBand = TryCast(c, ChannelizedFrequencyBand) Dim txtBriefDescription As String = bc.BriefDescription Dim txtChannelName As String = bc.ChannelName Dim radioCommunicationService As String = bc.RadioService1 Dim radioQualifier As String = bc.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bc.AllocationTable Dim frequencyUnit As String = bc.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(bc.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bc.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bc.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bc.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bc" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'inserting values of channelized paired frequency band nbcp If (TryCast(c, ChannelizedPairedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim fromPairedFrequency As Long Dim toPairedFrequency As Long Dim table As String Dim bcp As ChannelizedPairedFrequencyBand = TryCast(c, ChannelizedPairedFrequencyBand) Dim txtBriefDescription As String = bcp.BriefDescription Dim txtChannelName As String = bcp.ChannelName Dim radioCommunicationService As String = bcp.RadioService1 Dim radioQualifier1 As String = bcp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bcp.AllocationTable Dim frequencyUnit As String = bcp.RadioFrequency1 Dim pairedBreifDescription As String = bcp.PairedBriefDescription Dim pairedChannelName As String = bcp.PairedWithChannelName Dim radioCommunicationService2 As String = bcp.RadioService2 Dim radioQualifier2 As String = bcp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = bcp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bcp.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000) Else fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000000) End If If (frequencyUnit2 = "kHz") Then toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000) Else toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bcp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.Frequency2Low = fromPairedFrequency wikiFrequency.Frequency2High = toPairedFrequency wikiFrequency.Description2 = pairedBreifDescription wikiFrequency.Channel2 = pairedChannelName wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If Next If temp_wiki_text_id > 0 Then Try If id > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id) WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, id) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id) WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, update_wiki_text_id) End If 'WikiGraphicsBLL.TempDeleteWikiGraphics(temp_wiki_text_id) 'ToDo: use bindgrid function 'BindGrid(temp_wiki_text_id) 'Session("WikiID") = temp_wiki_text_id 'WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) 'WikiTextBLL.TempDeleteWikiText(temp_wiki_text_id) 'WikiGraphicsBLL.TempDeleteWikiGraphics(temp_wiki_text_id) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If If (id > 0) Then Session("update_wiki_text_id") = id End If 'Dim isreadonly As PropertyInfo = GetType(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance Or BindingFlags.NonPublic) '' make collection editable 'isreadonly.SetValue(Me.Request.QueryString, False, Nothing) '' remove 'Me.Request.QueryString.Remove("TempWikiId") 'Me.Request.QueryString.Remove("TempWikiId") 'If (id > 0) Then ' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + id.ToString()) 'ElseIf (wiki_text_id > 0) Then ' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + wiki_text_id.ToString()) 'End If 'BindGrid(temp_wiki_text_id) 'If id > 0 Then ' BindGrid(id) 'Else ' BindGrid(Convert.ToInt32(Session("update_wiki_text_id"))) 'End If temp_wiki_text_id BindGrid(temp_wiki_text_id) End Sub Protected Sub gvAddEditPicture_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvAddEditPicture.RowCommand 'If e.CommandName = "RemovePicture" Then ' Dim wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ' Dim wikiGraphic As WikiGraphic = Nothing ' Try ' wikiGraphic = WikiGraphicsBLL.GetByWikiGraphicId(wikiGraphicId) ' WikiGraphicsBLL.DeleteWikiGraphics(wikiGraphicId) ' Catch ex As Exception ' 'TODO: Show user friendly error here ' ' Log here ' If ex.InnerException IsNot Nothing Then ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' Else ' Logger.WriteToErrorLog(ex.Message) ' End If ' End Try ' If wikiGraphic IsNot Nothing Then ' Dim fileName As String = wikiGraphic.FileName ' Dim fileExtension As String = wikiGraphic.FileExtension ' Dim imagePath As String = Server.MapPath(_imgPath & fileName + fileExtension) ' Dim thumbNailPath As String = Server.MapPath(_thumbNailPath & fileName + fileExtension) ' If System.IO.File.Exists(imagePath) Then ' System.IO.File.Delete(imagePath) ' End If ' If System.IO.File.Exists(thumbNailPath) Then ' System.IO.File.Delete(thumbNailPath) ' End If ' End If 'ElseIf e.CommandName = "Download" Then ' Dim wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ' Dim wikiGraphic As WikiGraphic = Nothing ' Try ' wikiGraphic = WikiGraphicsBLL.GetByWikiGraphicId(wikiGraphicId) ' Catch ex As Exception ' 'TODO: Show user friendly error here ' ' Log here ' If ex.InnerException IsNot Nothing Then ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' Else ' Logger.WriteToErrorLog(ex.Message) ' End If ' End Try ' Dim fileName As String = wikiGraphic.FileName ' Dim fileExtension As String = wikiGraphic.FileExtension ' Dim imagePath As String = Server.MapPath(_imgPath & fileName + fileExtension) ' Dim thumbNailPath As String = Server.MapPath(_thumbNailPath & fileName + fileExtension) ' If System.IO.File.Exists(imagePath) Then ' ' System.IO.File.Delete(imagePath) ' 'End If ' 'If System.IO.File.Exists(thumbNailPath) Then ' ' System.IO.File.Delete(thumbNailPath) ' Dim strRequest As String = imagePath '-- if something was passed to the file querystring ' If strRequest <> "" Then 'get absolute path of the file ' 'Dim path As String = Server.MapPath(strRequest) 'get file object as FileInfo ' Dim file As System.IO.FileInfo = New System.IO.FileInfo(strRequest) '-- if the file exists on the server ' If file.Exists Then 'set appropriate headers ' Response.Clear() ' Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name) ' Response.AddHeader("Content-Length", file.Length.ToString()) ' Response.ContentType = ReturnExtension(file.Extension.ToLower()) ' Response.WriteFile(file.FullName) ' Response.End() 'if file does not exist ' Else ' Response.Write("This file does not exist.") ' End If 'nothing in the URL as HTTP GET ' Else ' Response.Write("Please provide a file to download.") ' End If ' End If 'End If '' BindGrid(temp_wiki_text_id) 'BindGrid(Convert.ToInt32(Session("update_wiki_text_id"))) 'If e.CommandName = "RemovePicture" Then ' Dim wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ' Dim wikiGraphic As WikiGraphic = Nothing ' Try ' wikiGraphic = WikiGraphicsBLL.GetByTempWikiGraphicId(wikiGraphicId) ' WikiGraphicsBLL.TempDeleteWikiGraphicsbyGraphicID(wikiGraphicId) ' Catch ex As Exception ' 'TODO: Show user friendly error here ' ' Log here ' If ex.InnerException IsNot Nothing Then ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' Else ' Logger.WriteToErrorLog(ex.Message) ' End If ' End Try ' If wikiGraphic IsNot Nothing Then ' Dim fileName As String = wikiGraphic.FileName ' Dim fileExtension As String = wikiGraphic.FileExtension ' Dim imagePath As String = Server.MapPath(_imgPath & fileName + fileExtension) ' Dim thumbNailPath As String = Server.MapPath(_thumbNailPath & fileName + fileExtension) ' If System.IO.File.Exists(imagePath) Then ' System.IO.File.Delete(imagePath) ' End If ' If System.IO.File.Exists(thumbNailPath) Then ' System.IO.File.Delete(thumbNailPath) ' End If ' End If 'ElseIf e.CommandName = "Download" Then ' Dim wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ' Dim wikiGraphic As WikiGraphic = Nothing ' Try ' wikiGraphic = WikiGraphicsBLL.GetByTempWikiGraphicId(wikiGraphicId) ' Catch ex As Exception ' 'TODO: Show user friendly error here ' ' Log here ' If ex.InnerException IsNot Nothing Then ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' Else ' Logger.WriteToErrorLog(ex.Message) ' End If ' End Try ' Dim fullFileName As String ' fullFileName = wikiGraphic.FileName ' Dim toDownload As FileInfo = New FileInfo(fullFileName) ' Dim userAgent As String = Request.Headers.Get("User-Agent") ' Dim filename As String = toDownload.Name ' 'If userAgent.Contains("MSIE 7.0") Then ' ' filename = toDownload.Name.Replace(" ", "%20") ' 'End If ' 'Dim fileName As String = wikiGraphic.FileName ' Dim fileExtension As String = wikiGraphic.FileExtension ' Dim imagePath As String = Server.MapPath(_imgPath & filename + fileExtension) ' Dim thumbNailPath As String = Server.MapPath(_thumbNailPath & filename + fileExtension) ' If System.IO.File.Exists(imagePath) Then ' ' System.IO.File.Delete(imagePath) ' 'End If ' 'If System.IO.File.Exists(thumbNailPath) Then ' ' System.IO.File.Delete(thumbNailPath) ' Dim strRequest As String = imagePath '-- if something was passed to the file querystring ' If strRequest <> "" Then 'get absolute path of the file ' 'Dim path As String = Server.MapPath(strRequest) 'get file object as FileInfo ' Dim file As System.IO.FileInfo = New System.IO.FileInfo(strRequest) '-- if the file exists on the server ' If file.Exists Then 'set appropriate headers ' Response.Clear() ' 'Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename + "\""); ' Response.AddHeader("Content-Disposition", "attachment; filename=""" & file.Name & """") ' 'Response.AddHeader("Content-Disposition", "attachment; filename=\"" & file.Name & " \ "") ' Response.AddHeader("Content-Length", file.Length.ToString()) ' Response.ContentType = ReturnExtension(file.Extension.ToLower()) ' Response.WriteFile(file.FullName) ' Response.End() 'if file does not exist ' Else ' Response.Write("This file does not exist.") ' End If 'nothing in the URL as HTTP GET ' Else ' Response.Write("Please provide a file to download.") ' End If ' End If ' End If If e.CommandName = "RemovePicture" Then Dim wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) Dim wikiGraphic As WikiGraphic = Nothing Try wikiGraphic = WikiGraphicsBLL.GetByTempWikiGraphicId(wikiGraphicId) WikiGraphicsBLL.TempDeleteWikiGraphicsbyGraphicID(wikiGraphicId) Catch ex As Exception 'TODO: Show user friendly error here ' Log here If ex.InnerException IsNot Nothing Then Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) Else Logger.WriteToErrorLog(ex.Message) End If End Try If wikiGraphic IsNot Nothing Then Dim fileName As String = wikiGraphic.FileName Dim fileExtension As String = wikiGraphic.FileExtension Dim physicalFileName As String = wikiGraphic.PhysicalFileName Dim imagePath As String = Server.MapPath(_imgPath & physicalFileName + fileExtension) Dim thumbNailPath As String = Server.MapPath(_thumbNailPath & physicalFileName + fileExtension) If System.IO.File.Exists(imagePath) Then System.IO.File.Delete(imagePath) End If If System.IO.File.Exists(thumbNailPath) Then System.IO.File.Delete(thumbNailPath) End If End If ElseIf e.CommandName = "Download" Then Dim wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) Dim wikiGraphic As WikiGraphic = Nothing Try wikiGraphic = WikiGraphicsBLL.GetByTempWikiGraphicId(wikiGraphicId) Catch ex As Exception 'TODO: Show user friendly error here ' Log here If ex.InnerException IsNot Nothing Then Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) Else Logger.WriteToErrorLog(ex.Message) End If End Try Dim fileName As String = wikiGraphic.FileName Dim fileExtension As String = wikiGraphic.FileExtension Dim physicalFileName As String = wikiGraphic.PhysicalFileName Dim imagePath As String = Server.MapPath(_imgPath & physicalFileName + fileExtension) Dim thumbNailPath As String = Server.MapPath(_thumbNailPath & physicalFileName + fileExtension) If System.IO.File.Exists(imagePath) Then ' System.IO.File.Delete(imagePath) 'End If 'If System.IO.File.Exists(thumbNailPath) Then ' System.IO.File.Delete(thumbNailPath) Dim strRequest As String = imagePath '-- if something was passed to the file querystring If strRequest <> "" Then 'get absolute path of the file 'Dim path As String = Server.MapPath(strRequest) 'get file object as FileInfo Dim file As System.IO.FileInfo = New System.IO.FileInfo(strRequest) '-- if the file exists on the server If file.Exists Then 'set appropriate headers Response.Clear() Response.AddHeader("Content-Disposition", "attachment;filename=""" & fileName & fileExtension & """") Response.AddHeader("Content-Length", file.Length.ToString()) Response.ContentType = ReturnExtension(file.Extension.ToLower()) Response.WriteFile(file.FullName) Response.End() 'if file does not exist Else Response.Write("This file does not exist.") End If 'nothing in the URL as HTTP GET Else Response.Write("Please provide a file to download.") End If End If End If 'End If 'If Not String.IsNullOrEmpty(Session("update_wiki_text_id")) Then 'BindGridFromOrg(CInt(Session("update_wiki_text_id"))) 'Else BindGrid(temp_wiki_text_id) End Sub Private Function ReturnExtension(ByVal fileExtension As String) As String Select Case fileExtension Case ".htm", ".html", ".log" Return "text/HTML" Case ".txt" Return "text/plain" Case ".doc", ".docx" Return "application/ms-word" Case ".docx" Return "application/octet-stream" Case ".tiff", ".tif" Return "image/tiff" Case ".png", ".png" Return "image/png" Case ".asf" Return "video/x-ms-asf" Case ".avi" Return "video/avi" Case ".zip" Return "application/zip" Case ".xls", ".csv" Return "application/vnd.ms-excel" Case ".gif" Return "image/gif" Case ".jpg", "jpeg" Return "image/jpeg" Case ".bmp" Return "image/bmp" Case ".wav" Return "audio/wav" Case ".mp3" Return "audio/mpeg3" Case ".mpg", "mpeg" Return "video/mpeg" Case ".rtf" Return "application/rtf" Case ".asp" Return "text/asp" Case ".pdf" Return "application/pdf" Case ".fdf" Return "application/vnd.fdf" Case ".ppt" Return "application/mspowerpoint" Case ".dwg" Return "image/vnd.dwg" Case ".msg" Return "application/msoutlook" Case ".xml", ".sdxl" Return "application/xml" Case ".xdp" Return "application/vnd.adobe.xdp+xml" Case Else Return "application/octet-stream" End Select End Function Protected Sub btnSavePreview_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSavePreview.Click 'Dim id As Integer 'Dim heading As String = txtMainHeading.Text 'Dim description As String = txtDescription.Text 'Dim wikiText As WikiText = New WikiText() ''wikiText.Head = heading ''wikiText.Description = description 'wikiText.Head = mainHeading 'wikiText.Description = descrp 'txtDescription.Text = descrp 'txtMainHeading.Text = mainHeading 'If (wiki_text_id = 0) Then ' 'If (Request.QueryString.Count > 0) Then ' Try ' id = WikiTextBLL.InsertWikiText(wikiText) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' 'End If 'Else ' wikiText.WikiTextId = wiki_text_id ' Try ' WikiTextBLL.UpdateWikiText(wikiText) ' WikiFrequencyBLL.DeleteWikiFrequency(wiki_text_id) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try 'End If ''txtMainHeading.Text = String.Empty ''txtDescription.Text = String.Empty 'For Each c As Control In pnlBandEntries.Controls ' 'frequency band nb ' If (TryCast(c, FrequencyBand) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim toFrequency As Long ' Dim table As String ' Dim fb As FrequencyBand = TryCast(c, FrequencyBand) ' Dim txtBriefDescription As String = fb.BriefDescription ' Dim allocationTable As String = fb.AllocationTable ' Dim frequencyUnit As String = fb.RadioFrequency ' Dim radioService As String = fb.RadioService1 ' Dim radioQualifier As String = fb.RadioQualifier1 'createradioqualifier ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(fb.FromFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000) ' Else ' fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000000) ' End If ' If (frequencyUnit = "kHz") Then ' toFrequency = CLng(fb.ToFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' toFrequency = CLng(fb.ToFrequencyRange1 * 1000000) ' Else ' toFrequency = CLng(fb.ToFrequencyRange1 * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "b" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Frequency1High = toFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Service1 = radioService ' wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'inserting values of paired frequency band nbp ' If (TryCast(c, PairedFrequencyBand) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim toFrequency As Long ' Dim fromPairedFrequency As Long ' Dim toPairedFrequency As Long ' Dim table As String ' Dim bp As PairedFrequencyBand = TryCast(c, PairedFrequencyBand) ' Dim txtBriefDescription As String = bp.BriefDescription ' Dim radioCommunicationService As String = bp.RadioService1 ' Dim radioQualifier1 As String = bp.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = bp.AllocationTable ' Dim frequencyUnit As String = bp.RadioFrequency1 ' Dim pairedToFrequency As Integer = bp.ToPairedFrequency ' Dim pairedBreifDescription As String = bp.PairedBriefDescription ' Dim radioCommunicationService2 As String = bp.RadioService2 ' Dim radioQualifier2 As String = bp.RadioQualifier2 'createradioqualifier ' Dim frequencyUnit2 As String = bp.RadioFrequency2 ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(bp.FromFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000) ' Else ' fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000000) ' End If ' If (frequencyUnit = "kHz") Then ' toFrequency = CLng(bp.ToFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' toFrequency = CLng(bp.ToFrequencyRange1 * 1000000) ' Else ' toFrequency = CLng(bp.ToFrequencyRange1 * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' If (frequencyUnit2 = "kHz") Then ' fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000) ' ElseIf (frequencyUnit2 = "MHz") Then ' fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000) ' Else ' fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000000) ' End If ' If (frequencyUnit2 = "kHz") Then ' toPairedFrequency = CLng(bp.ToPairedFrequency * 1000) ' ElseIf (frequencyUnit2 = "MHz") Then ' toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000) ' Else ' toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000000) ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "bp" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Frequency1High = toFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier ' wikiFrequency.Frequency2Low = fromPairedFrequency ' wikiFrequency.Frequency2High = toPairedFrequency ' wikiFrequency.Description2 = pairedBreifDescription ' wikiFrequency.Service2 = radioCommunicationService2 ' wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'insert values in specific frequency nf ' If (TryCast(c, SpecificFrequency) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim table As String ' Dim f As SpecificFrequency = TryCast(c, SpecificFrequency) ' Dim txtBriefDescription As String = f.BriefDescription ' Dim radioCommunicationService As String = f.RadioService1 ' Dim radioQualifier As String = f.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = f.AllocationTable ' Dim frequencyUnit As String = f.RadioFrequency ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(f.Frequency * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(f.Frequency * 1000000) ' Else ' fromFrequency = CLng(f.Frequency * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "f" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'insert values in paired frequency nfp ' If (TryCast(c, PairedFrequency) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim pairedFromFrequency As Long ' Dim table As String ' Dim fp As PairedFrequency = TryCast(c, PairedFrequency) ' Dim txtBriefDescription As String = fp.BriefDescription1 ' Dim radioCommunicationService As String = fp.RadioService1 ' Dim radioQualifier1 As String = fp.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = fp.AllocationTable ' Dim frequencyUnit As String = fp.RadioFrequency1 ' Dim txtBriefDescription2 As String = fp.PairedWithBriefDescription ' Dim radioCommunicationService2 As String = fp.RadioService2 ' Dim radioQualifier2 As String = fp.RadioQualifier2 'createradioqualifier ' Dim frequencyUnit2 As String = fp.RadioFrequency2 ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(fp.Frequency * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(fp.Frequency * 1000000) ' Else ' fromFrequency = CLng(fp.Frequency * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' If (frequencyUnit2 = "kHz") Then ' pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000) ' ElseIf (frequencyUnit2 = "MHz") Then ' pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000) ' Else ' pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000000) ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "fp" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' wikiFrequency.Frequency2Low = pairedFromFrequency ' wikiFrequency.Description2 = txtBriefDescription2 ' wikiFrequency.Service2 = radioCommunicationService2 ' wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'insert values in Channelizedspecificfrequency nc ' If (TryCast(c, ChannelizedSpecificFrequency) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim table As String ' Dim nc As ChannelizedSpecificFrequency = TryCast(c, ChannelizedSpecificFrequency) ' Dim txtBriefDescription As String = nc.BriefDescription ' Dim txtChannelName As String = nc.ChannelName ' Dim radioCommunicationService As String = nc.RadioService1 ' Dim radioQualifier As String = nc.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = nc.AllocationTable ' Dim frequencyUnit As String = nc.RadioFrequency ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(nc.Frequency * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(nc.Frequency * 1000000) ' Else ' fromFrequency = CLng(nc.Frequency * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "c" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Channel1 = txtChannelName ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'insert values in channelizedPairedfrequency ncp ' If (TryCast(c, ChannelizedPairedFrequency) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim pairedFromFrequency As Long ' Dim table As String ' Dim cp As ChannelizedPairedFrequency = TryCast(c, ChannelizedPairedFrequency) ' Dim txtBriefDescription As String = cp.ChannelBriefDescription ' Dim txtChannelName As String = cp.ChannelName ' Dim radioCommunicationService As String = cp.RadioService1 ' Dim radioQualifier1 As String = cp.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = cp.AllocationTable ' Dim frequencyUnit As String = cp.RadioFrequency1 ' Dim txtBriefDescription2 As String = cp.PairedWithBriefDescription ' Dim pairedChannelName As String = cp.PairedWithChannelName ' Dim radioCommunicationService2 As String = cp.RadioService2 ' Dim radioQualifier2 As String = cp.RadioQualifier2 'createradioqualifier ' Dim frequencyUnit2 As String = cp.RadioFrequency2 ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(cp.ChannelFrequency * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(cp.ChannelFrequency * 1000000) ' Else ' fromFrequency = CLng(cp.ChannelFrequency * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' If (frequencyUnit2 = "kHz") Then ' pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000) ' ElseIf (frequencyUnit2 = "MHz") Then ' pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000) ' Else ' pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000000) ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "cp" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Channel1 = txtChannelName ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' wikiFrequency.Frequency2Low = pairedFromFrequency ' wikiFrequency.Description2 = txtBriefDescription2 ' wikiFrequency.Channel2 = pairedChannelName ' wikiFrequency.Service2 = radioCommunicationService2 ' wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'channelized frequency band nbc ' If (TryCast(c, ChannelizedFrequencyBand) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim toFrequency As Long ' Dim table As String ' Dim bc As ChannelizedFrequencyBand = TryCast(c, ChannelizedFrequencyBand) ' Dim txtBriefDescription As String = bc.BriefDescription ' Dim txtChannelName As String = bc.ChannelName ' Dim radioCommunicationService As String = bc.RadioService1 ' Dim radioQualifier As String = bc.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = bc.AllocationTable ' Dim frequencyUnit As String = bc.RadioFrequency ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(bc.FromFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000) ' Else ' fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000000) ' End If ' If (frequencyUnit = "kHz") Then ' toFrequency = CLng(bc.ToFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' toFrequency = CLng(bc.ToFrequencyRange1 * 1000000) ' Else ' toFrequency = CLng(bc.ToFrequencyRange1 * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "bc" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Frequency1High = toFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Channel1 = txtChannelName ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If ' 'inserting values of channelized paired frequency band nbcp ' If (TryCast(c, ChannelizedPairedFrequencyBand) IsNot Nothing) Then ' Dim fromFrequency As Long ' Dim toFrequency As Long ' Dim fromPairedFrequency As Long ' Dim toPairedFrequency As Long ' Dim table As String ' Dim bcp As ChannelizedPairedFrequencyBand = TryCast(c, ChannelizedPairedFrequencyBand) ' Dim txtBriefDescription As String = bcp.BriefDescription ' Dim txtChannelName As String = bcp.ChannelName ' Dim radioCommunicationService As String = bcp.RadioService1 ' Dim radioQualifier1 As String = bcp.RadioQualifier1 'createradioqualifier ' Dim allocationTable As String = bcp.AllocationTable ' Dim frequencyUnit As String = bcp.RadioFrequency1 ' Dim pairedBreifDescription As String = bcp.PairedBriefDescription ' Dim pairedChannelName As String = bcp.PairedWithChannelName ' Dim radioCommunicationService2 As String = bcp.RadioService2 ' Dim radioQualifier2 As String = bcp.RadioQualifier2 'createradioqualifier ' Dim frequencyUnit2 As String = bcp.RadioFrequency2 ' If (frequencyUnit = "kHz") Then ' fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000) ' Else ' fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000000) ' End If ' If (frequencyUnit = "kHz") Then ' toFrequency = CLng(bcp.ToFrequencyRange1 * 1000) ' ElseIf (frequencyUnit = "MHz") Then ' toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000) ' Else ' toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000000) ' End If ' If (allocationTable = "NonFederal") Then ' table = "N" ' ElseIf (allocationTable = "Federal") Then ' table = "F" ' Else ' table = String.Empty ' End If ' If (frequencyUnit2 = "kHz") Then ' fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000) ' ElseIf (frequencyUnit2 = "MHz") Then ' fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000) ' Else ' fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000000) ' End If ' If (frequencyUnit2 = "kHz") Then ' toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000) ' ElseIf (frequencyUnit2 = "MHz") Then ' toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000) ' Else ' toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000000) ' End If ' Dim wikiFrequency As WikiFrequency = New WikiFrequency() ' wikiFrequency.FrequencyType = "bcp" ' wikiFrequency.Frequency1Low = fromFrequency ' wikiFrequency.Frequency1High = toFrequency ' wikiFrequency.Description1 = txtBriefDescription ' wikiFrequency.Channel1 = txtChannelName ' wikiFrequency.Service1 = radioCommunicationService ' wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier ' wikiFrequency.Frequency2Low = fromPairedFrequency ' wikiFrequency.Frequency2High = toPairedFrequency ' wikiFrequency.Description2 = pairedBreifDescription ' wikiFrequency.Channel2 = pairedChannelName ' wikiFrequency.Service2 = radioCommunicationService2 ' wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier ' wikiFrequency.AllocationTable = table ' If (wiki_text_id > 0) Then ' wikiFrequency.WikiTextId = wiki_text_id ' Else ' wikiFrequency.WikiTextId = id ' End If ' Try ' WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try ' End If 'Next 'If temp_wiki_text_id > 0 Then ' Try ' WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id) ' WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, id) ' 'WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) ' 'WikiTextBLL.TempDeleteWikiText(temp_wiki_text_id) ' 'WikiGraphicsBLL.TempDeleteWikiGraphics(temp_wiki_text_id) ' Catch ex As Exception ' If ex.InnerException Is Nothing Then ' Logger.WriteToErrorLog(ex.Message) ' Else ' Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) ' End If ' End Try 'End If ''Session.Abandon() ''Session.Clear() 'Session("wiki_text_idd") = id ''Session.Remove("TempWikiID") '' Session("id") = id ''Dim isreadonly As PropertyInfo = GetType(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance Or BindingFlags.NonPublic) ' '' make collection editable ''isreadonly.SetValue(Me.Request.QueryString, False, Nothing) ' '' remove ''Me.Request.QueryString.Remove("TempWikiId") ''Me.Request.QueryString.Remove("TempWikiId") ''If (id > 0) Then '' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + id.ToString()) ''ElseIf (wiki_text_id > 0) Then '' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + wiki_text_id.ToString()) ''End If Dim id As Integer Dim heading As String = txtMainHeading.Text Dim description As String = txtDescription.Text wiki_text_id = Convert.ToInt32(Request.QueryString("WikiId")) Dim update_wiki_text_id As Integer = 0 Dim wikiText As WikiText = New WikiText() 'wikiText.Head = heading 'wikiText.Description = description wikiText.Head = mainHeading wikiText.Description = descrp txtDescription.Text = descrp txtMainHeading.Text = mainHeading If String.IsNullOrEmpty(Session("update_wiki_text_id")) Then 'If (wiki_text_id = 0) Then 'If (Request.QueryString.Count > 0) Then Try id = WikiTextBLL.InsertWikiText(wikiText) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try 'End If Else update_wiki_text_id = Session("update_wiki_text_id") wikiText.WikiTextId = update_wiki_text_id Try WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(update_wiki_text_id) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'txtMainHeading.Text = String.Empty 'txtDescription.Text = String.Empty For Each c As Control In pnlBandEntries.Controls 'frequency band nb If (TryCast(c, FrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim table As String Dim fb As FrequencyBand = TryCast(c, FrequencyBand) Dim txtBriefDescription As String = fb.BriefDescription Dim allocationTable As String = fb.AllocationTable Dim frequencyUnit As String = fb.RadioFrequency Dim radioService As String = fb.RadioService1 Dim radioQualifier As String = fb.RadioQualifier1 'createradioqualifier If (fb.FromFrequencyRange1 <> "0.0") Then If (frequencyUnit = "kHz") Then fromFrequency = CLng(fb.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(fb.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(fb.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(fb.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(fb.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "b" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioService 'If radioService = "NONE" Then 'wikiFrequency.Qualifier1 = "" ' Else wikiFrequency.Qualifier1 = radioQualifier 'End If 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If End If 'inserting values of paired frequency band nbp If (TryCast(c, PairedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim fromPairedFrequency As Long Dim toPairedFrequency As Long Dim table As String Dim bp As PairedFrequencyBand = TryCast(c, PairedFrequencyBand) Dim txtBriefDescription As String = bp.BriefDescription Dim radioCommunicationService As String = bp.RadioService1 Dim radioQualifier1 As String = bp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bp.AllocationTable Dim frequencyUnit As String = bp.RadioFrequency1 Dim pairedToFrequency As Integer = bp.ToPairedFrequency Dim pairedBreifDescription As String = bp.PairedBriefDescription Dim radioCommunicationService2 As String = bp.RadioService2 Dim radioQualifier2 As String = bp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = bp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(bp.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bp.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bp.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bp.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bp.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000) Else fromPairedFrequency = CLng(bp.FromPairedFrequency * 1000000000) End If If (frequencyUnit2 = "kHz") Then toPairedFrequency = CLng(bp.ToPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000) Else toPairedFrequency = CLng(bp.ToPairedFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.Frequency2Low = fromPairedFrequency wikiFrequency.Frequency2High = toPairedFrequency wikiFrequency.Description2 = pairedBreifDescription wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in specific frequency nf If (TryCast(c, SpecificFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim table As String Dim f As SpecificFrequency = TryCast(c, SpecificFrequency) Dim txtBriefDescription As String = f.BriefDescription Dim radioCommunicationService As String = f.RadioService1 Dim radioQualifier As String = f.RadioQualifier1 'createradioqualifier Dim allocationTable As String = f.AllocationTable Dim frequencyUnit As String = f.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(f.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(f.Frequency * 1000000) Else fromFrequency = CLng(f.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "f" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in paired frequency nfp If (TryCast(c, PairedFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim pairedFromFrequency As Long Dim table As String Dim fp As PairedFrequency = TryCast(c, PairedFrequency) Dim txtBriefDescription As String = fp.BriefDescription1 Dim radioCommunicationService As String = fp.RadioService1 Dim radioQualifier1 As String = fp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = fp.AllocationTable Dim frequencyUnit As String = fp.RadioFrequency1 Dim txtBriefDescription2 As String = fp.PairedWithBriefDescription Dim radioCommunicationService2 As String = fp.RadioService2 Dim radioQualifier2 As String = fp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = fp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(fp.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(fp.Frequency * 1000000) Else fromFrequency = CLng(fp.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000) Else pairedFromFrequency = CLng(fp.PairedWithFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "fp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If wikiFrequency.Frequency2Low = pairedFromFrequency wikiFrequency.Description2 = txtBriefDescription2 wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in Channelizedspecificfrequency nc If (TryCast(c, ChannelizedSpecificFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim table As String Dim nc As ChannelizedSpecificFrequency = TryCast(c, ChannelizedSpecificFrequency) Dim txtBriefDescription As String = nc.BriefDescription Dim txtChannelName As String = nc.ChannelName Dim radioCommunicationService As String = nc.RadioService1 Dim radioQualifier As String = nc.RadioQualifier1 'createradioqualifier Dim allocationTable As String = nc.AllocationTable Dim frequencyUnit As String = nc.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(nc.Frequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(nc.Frequency * 1000000) Else fromFrequency = CLng(nc.Frequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "c" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'insert values in channelizedPairedfrequency ncp If (TryCast(c, ChannelizedPairedFrequency) IsNot Nothing) Then Dim fromFrequency As Long Dim pairedFromFrequency As Long Dim table As String Dim cp As ChannelizedPairedFrequency = TryCast(c, ChannelizedPairedFrequency) Dim txtBriefDescription As String = cp.ChannelBriefDescription Dim txtChannelName As String = cp.ChannelName Dim radioCommunicationService As String = cp.RadioService1 Dim radioQualifier1 As String = cp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = cp.AllocationTable Dim frequencyUnit As String = cp.RadioFrequency1 Dim txtBriefDescription2 As String = cp.PairedWithBriefDescription Dim pairedChannelName As String = cp.PairedWithChannelName Dim radioCommunicationService2 As String = cp.RadioService2 Dim radioQualifier2 As String = cp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = cp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(cp.ChannelFrequency * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(cp.ChannelFrequency * 1000000) Else fromFrequency = CLng(cp.ChannelFrequency * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000) Else pairedFromFrequency = CLng(cp.PairedWithFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "cp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If wikiFrequency.Frequency2Low = pairedFromFrequency wikiFrequency.Description2 = txtBriefDescription2 wikiFrequency.Channel2 = pairedChannelName wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'channelized frequency band nbc If (TryCast(c, ChannelizedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim table As String Dim bc As ChannelizedFrequencyBand = TryCast(c, ChannelizedFrequencyBand) Dim txtBriefDescription As String = bc.BriefDescription Dim txtChannelName As String = bc.ChannelName Dim radioCommunicationService As String = bc.RadioService1 Dim radioQualifier As String = bc.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bc.AllocationTable Dim frequencyUnit As String = bc.RadioFrequency If (frequencyUnit = "kHz") Then fromFrequency = CLng(bc.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bc.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bc.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bc.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bc.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bc" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If 'inserting values of channelized paired frequency band nbcp If (TryCast(c, ChannelizedPairedFrequencyBand) IsNot Nothing) Then Dim fromFrequency As Long Dim toFrequency As Long Dim fromPairedFrequency As Long Dim toPairedFrequency As Long Dim table As String Dim bcp As ChannelizedPairedFrequencyBand = TryCast(c, ChannelizedPairedFrequencyBand) Dim txtBriefDescription As String = bcp.BriefDescription Dim txtChannelName As String = bcp.ChannelName Dim radioCommunicationService As String = bcp.RadioService1 Dim radioQualifier1 As String = bcp.RadioQualifier1 'createradioqualifier Dim allocationTable As String = bcp.AllocationTable Dim frequencyUnit As String = bcp.RadioFrequency1 Dim pairedBreifDescription As String = bcp.PairedBriefDescription Dim pairedChannelName As String = bcp.PairedWithChannelName Dim radioCommunicationService2 As String = bcp.RadioService2 Dim radioQualifier2 As String = bcp.RadioQualifier2 'createradioqualifier Dim frequencyUnit2 As String = bcp.RadioFrequency2 If (frequencyUnit = "kHz") Then fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000) Else fromFrequency = CLng(bcp.FromFrequencyRange1 * 1000000000) End If If (frequencyUnit = "kHz") Then toFrequency = CLng(bcp.ToFrequencyRange1 * 1000) ElseIf (frequencyUnit = "MHz") Then toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000) Else toFrequency = CLng(bcp.ToFrequencyRange1 * 1000000000) End If If (allocationTable = "NonFederal") Then table = "N" ElseIf (allocationTable = "Federal") Then table = "F" Else table = String.Empty End If If (frequencyUnit2 = "kHz") Then fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000) Else fromPairedFrequency = CLng(bcp.FromPairedFrequency * 1000000000) End If If (frequencyUnit2 = "kHz") Then toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000) ElseIf (frequencyUnit2 = "MHz") Then toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000) Else toPairedFrequency = CLng(bcp.ToPairedFrequency * 1000000000) End If Dim wikiFrequency As WikiFrequency = New WikiFrequency() wikiFrequency.FrequencyType = "bcp" wikiFrequency.Frequency1Low = fromFrequency wikiFrequency.Frequency1High = toFrequency wikiFrequency.Description1 = txtBriefDescription wikiFrequency.Channel1 = txtChannelName wikiFrequency.Service1 = radioCommunicationService wikiFrequency.Qualifier1 = radioQualifier1 'for radio qualifier wikiFrequency.Frequency2Low = fromPairedFrequency wikiFrequency.Frequency2High = toPairedFrequency wikiFrequency.Description2 = pairedBreifDescription wikiFrequency.Channel2 = pairedChannelName wikiFrequency.Service2 = radioCommunicationService2 wikiFrequency.Qualifier2 = radioQualifier2 'for radio qualifier wikiFrequency.AllocationTable = table If (update_wiki_text_id > 0) Then wikiFrequency.WikiTextId = update_wiki_text_id Else wikiFrequency.WikiTextId = id End If Try WikiFrequencyBLL.InsertWikiFrequency(wikiFrequency) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If Next If temp_wiki_text_id > 0 Then Try If id > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id) WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, id) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id) WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, update_wiki_text_id) End If 'WikiGraphicsBLL.TempDeleteWikiGraphics(temp_wiki_text_id) 'ToDo: use bindgrid function 'BindGrid(temp_wiki_text_id) 'Session("WikiID") = temp_wiki_text_id 'WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) 'WikiTextBLL.TempDeleteWikiText(temp_wiki_text_id) 'WikiGraphicsBLL.TempDeleteWikiGraphics(temp_wiki_text_id) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try End If '______________________ 'commen on AUG 6 If (id > 0) Then Session("update_wiki_text_id") = id End If '______________________ 'Dim isreadonly As PropertyInfo = GetType(System.Collections.Specialized.NameValueCollection).GetProperty("IsReadOnly", BindingFlags.Instance Or BindingFlags.NonPublic) '' make collection editable 'isreadonly.SetValue(Me.Request.QueryString, False, Nothing) '' remove 'Me.Request.QueryString.Remove("TempWikiId") 'Me.Request.QueryString.Remove("TempWikiId") 'If (id > 0) Then ' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + id.ToString()) 'ElseIf (wiki_text_id > 0) Then ' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + wiki_text_id.ToString()) 'End If 'BindGrid(temp_wiki_text_id) 'If id > 0 Then ' BindGrid(id) 'Else ' BindGrid(Convert.ToInt32(Session("update_wiki_text_id"))) 'End If temp_wiki_text_id BindGrid(temp_wiki_text_id) If id > 0 Then Response.Redirect("~/wiki/Preview.aspx?WikiTextId=" + id.ToString() + "&Id=" + CStr(temp_wiki_text_id) & "&nbCount=" & nbCount & "&nbpCount=" & nbpCount & "&nfCount=" & nfCount & "&nfpCount=" & nfpCount & "&ncCount=" & ncCount & "&ncpCount=" & ncpCount & "&nbcCount=" & nbcCount & "&nbcpCount=" & nbcpCount) Else Response.Redirect("~/wiki/Preview.aspx?WikiTextId=" + update_wiki_text_id.ToString() + "&Id=" + CStr(temp_wiki_text_id) & "&nbCount=" & nbCount & "&nbpCount=" & nbpCount & "&nfCount=" & nfCount & "&nfpCount=" & nfpCount & "&ncCount=" & ncCount & "&ncpCount=" & ncpCount & "&nbcCount=" & nbcCount & "&nbcpCount=" & nbcpCount) End If End Sub Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click Try WikiFrequencyBLL.TempDeleteWikiFrequency(temp_wiki_text_id) WikiGraphicsBLL.TempDeleteWikiGraphics(temp_wiki_text_id) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try Session.Remove("TempWikiID") Session.Remove("id") Session.Remove("update_wiki_text_id") Response.Redirect("~/wiki/Start.aspx") End Sub Public Function GetPostBackControl(ByVal page As Page) As Control Dim control As Control = Nothing Dim ctrlname As String = page.Request.Params.[Get]("__EVENTTARGET") If Not IsNothing(ctrlname) And ctrlname <> String.Empty Then control = page.FindControl(ctrlname) Else For Each ctl As String In page.Request.Form Dim c As Control = page.FindControl(ctl) If TypeOf c Is System.Web.UI.WebControls.Button Then control = c Exit For End If Next End If Return control End Function Private Sub AddAndRemoveFrequencyBandControls() 'Determine which control fired the postback event. Dim nb As Integer = 0 Dim c As Control = GetPostBackControl(Page) nb = CInt(Request.QueryString("nb")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Frequency band" Then ltlNbCount.Text = Convert.ToInt16(ltlNbCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nb <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. nbCount = (Convert.ToInt16(ltlNbCount.Text) + nb) For i As Integer = 1 To (nbCount) Dim DynamicUserControl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") DynamicUserControl.FrequencyRangeNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedFrequencyBandList("uc" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. DynamicUserControl.ID = "uc" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler DynamicUserControl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(DynamicUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else nbCount = (Convert.ToInt16(ltlNbCount.Text)) + Convert.ToInt32(nbCount) For i As Integer = 1 To (nbCount) Dim ctrl As FrequencyBand = LoadControl("~/controls/FrequencyBand.ascx") If (wiki_text_id > 0) Then ctrl.FrequencyRangeNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "b") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "b" 'Done ctrl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ctrl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) ctrl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) ctrl.BriefDescription = frequency(i - 1).Description1.ToString() ctrl.RadioService1 = frequency(i - 1).Service1.ToString() ctrl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ctrl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) ctrl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId Dim bfrequencyType As String = frequency(i - 1).FrequencyType 'If bfrequencyType = "b" Then ' ctrl.FrequencyRangeNumber = ib ' ib = ib + 1 'End If End Select End If ElseIf (temp_wiki_text_id > 0) Then ctrl.FrequencyRangeNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "b") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "b" 'Done ctrl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ctrl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) ctrl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) ctrl.BriefDescription = frequency(i - 1).Description1.ToString() ctrl.RadioService1 = frequency(i - 1).Service1.ToString() ctrl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ctrl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) ctrl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId Dim bfrequencyType As String = frequency(i - 1).FrequencyType 'If bfrequencyType = "b" Then ' ctrl.FrequencyRangeNumber = ib ' ib = ib + 1 'End If End Select End If End If While InDeletedFrequencyBandList("uc" & ControlID) = True ControlID += 1 End While ctrl.ID = "uc" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ctrl.RemoveFrequencyBand, AddressOf Me.HandleRemoveFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ctrl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cNb As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then freqRangecount = freqRangecount + 1 ctrl.FrequencyRangeNumber = freqRangecount End If Next Next End If End Sub Sub HandleRemoveFrequencyBand(ByVal sender As Object, ByVal e As EventArgs) 'Dim nbRangeCount As Integer = 0 'For Each stNb As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNb, UserControl) ' Dim lblFrequencyBand As Label = ucNb.FindControl("lblFrequencyRangeNumber") ' nbRangeCount = nbRangeCount + 1 ' lblFrequencyBand.Text = nbRangeCount ' End If 'Next 'If nbRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nb As Integer = CInt(Request.QueryString("nb")) If (nb <> Nothing) Then 'Get the user control that fired this event, and remove it Dim DynamicUserControll As FrequencyBand = sender.parent pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will increase the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small increase in size that it shouldn't be an issue. ltlNbRemoved.Text &= DynamicUserControll.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlNbCount.Text = Convert.ToInt16(ltlNbCount.Text) - 1 Else Dim DynamicUserControll As FrequencyBand = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(DynamicUserControll.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(DynamicUserControll.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlNbRemoved.Text &= DynamicUserControll.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlNbCount.Text = Convert.ToInt16(ltlNbCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cNb As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then Dim ucNb As UserControl = CType(cNb, UserControl) Dim lblFreqRangeNumber As Label = ucNb.FindControl("lblFrequencyRangeNumber") freqRangecount = freqRangecount + 1 lblFreqRangeNumber.Text = freqRangecount End If Next 'If freqRangecount = 1 Then ' For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_frequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim btnFrequencyBandRemove As Button = ucNb.FindControl("btnRemove") ' btnFrequencyBandRemove.Visible = False ' End If ' Next 'End If 'Else ' For Each stNb As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNb.GetType.Name.ToLower = "controls_frequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNb, UserControl) ' Dim btnFrequencyBandRemove As Button = ucNb.FindControl("btnRemove") ' btnFrequencyBandRemove.Visible = False ' End If ' Next 'End If End Sub Private Function InDeletedFrequencyBandList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlNbRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Private Sub AddAndRemovePairedFrequencyBandControls() 'Determine which control fired the postback event. Dim nbp As Integer = 0 Dim c As Control = GetPostBackControl(Page) nbp = CInt(Request.QueryString("nbp")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Paired frequency band" Then ltlnbpCount.Text = Convert.ToInt16(ltlnbpCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nbp <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. nbpCount = (Convert.ToInt16(ltlnbpCount.Text) + nbp) For i As Integer = 1 To (nbpCount) Dim pairedFrequencyUserControl As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") pairedFrequencyUserControl.PairedFrequencyNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedPairedFrequencyBandList("ucPairedFrequencyBand" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. pairedFrequencyUserControl.ID = "ucPairedFrequencyBand" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler pairedFrequencyUserControl.RemovePairedFrequencyBand, AddressOf Me.HandleRemovePairedFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(pairedFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else nbpCount = (Convert.ToInt16(ltlnbpCount.Text)) + Convert.ToInt32(nbpCount) For i As Integer = 1 To (nbpCount) Dim pairedFrequencyUserControl As PairedFrequencyBand = LoadControl("~/controls/PairedFrequencyBand.ascx") If (wiki_text_id > 0) Then pairedFrequencyUserControl.PairedFrequencyNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "bp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "bp" 'Done pairedFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() pairedFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() pairedFrequencyUserControl.RadioService2 = frequency(i - 1).Service2.ToString() pairedFrequencyUserControl.BriefDescription = frequency(i - 1).Description1.ToString() pairedFrequencyUserControl.PairedBriefDescription = frequency(i - 1).Description2.ToString() pairedFrequencyUserControl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) pairedFrequencyUserControl.FromPairedFrequency = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.ToPairedFrequency = CDbl(frequency(i - 1).Frequency2High) pairedFrequencyUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() pairedFrequencyUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() pairedFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "bp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "bp" 'Done pairedFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() pairedFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() pairedFrequencyUserControl.RadioService2 = frequency(i - 1).Service2.ToString() pairedFrequencyUserControl.BriefDescription = frequency(i - 1).Description1.ToString() pairedFrequencyUserControl.PairedBriefDescription = frequency(i - 1).Description2.ToString() pairedFrequencyUserControl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) pairedFrequencyUserControl.FromPairedFrequency = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.ToPairedFrequency = CDbl(frequency(i - 1).Frequency2High) pairedFrequencyUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() pairedFrequencyUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() pairedFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedPairedFrequencyBandList("ucPairedFrequencyBand" & ControlID) = True ControlID += 1 End While pairedFrequencyUserControl.ID = "ucPairedFrequencyBand" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler pairedFrequencyUserControl.RemovePairedFrequencyBand, AddressOf Me.HandleRemovePairedFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(pairedFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cNbp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then freqRangecount = freqRangecount + 1 pairedFrequencyUserControl.PairedFrequencyNumber = freqRangecount End If Next Next End If End Sub Sub HandleRemovePairedFrequencyBand(ByVal sender As Object, ByVal e As EventArgs) 'Dim nbpRangeCount As Integer = 0 'For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim lblPairedFrequencyNumber As Label = ucNb.FindControl("lblPairedFrequencyNumber") ' nbpRangeCount = nbpRangeCount + 1 ' lblPairedFrequencyNumber.Text = nbpRangeCount ' End If 'Next 'If nbpRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nbp As Integer = CInt(Request.QueryString("nbp")) If (nbp <> Nothing) Then 'Get the user control that fired this event, and remove it Dim pairedFrequencyUserControl As PairedFrequencyBand = sender.parent ' If pairedFrequencyUserControl.PairedFrequencyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will increase the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small increase in size that it shouldn't be an issue. ltlnbpRemoved.Text &= pairedFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnbpCount.Text = Convert.ToInt16(ltlnbpCount.Text) - 1 'End If Else Dim pairedFrequencyUserControl As PairedFrequencyBand = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(pairedFrequencyUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(pairedFrequencyUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlnbpRemoved.Text &= pairedFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnbpCount.Text = Convert.ToInt16(ltlnbpCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cNbp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then Dim ucNb As UserControl = CType(cNbp, UserControl) Dim lblPairedFrequencyNumber As Label = ucNb.FindControl("lblPairedFrequencyNumber") freqRangecount = freqRangecount + 1 lblPairedFrequencyNumber.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim btnPairedFrequencyBandRemove As Button = ucNb.FindControl("btnPairedFrequencyBandRemove") ' btnPairedFrequencyBandRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stNbp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNbp.GetType.Name.ToLower = "controls_pairedfrequencyband_ascx" Then ' Dim ucNb As UserControl = CType(stNbp, UserControl) ' Dim btnPairedFrequencyBandRemove As Button = ucNb.FindControl("btnPairedFrequencyBandRemove") ' btnPairedFrequencyBandRemove.Visible = False ' End If ' Next 'End If End Sub Private Function InDeletedPairedFrequencyBandList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlnbpRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Private Function InDeletedSpecificFrequencyList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlnfRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Sub HandleRemoveSpecificFrequency(ByVal sender As Object, ByVal e As EventArgs) 'Dim nfRangeCount As Integer = 0 'For Each stNf As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNf, UserControl) ' Dim lblFrequencyNumber As Label = ucNf.FindControl("lblFrequencyNumber") ' nfRangeCount = nfRangeCount + 1 ' lblFrequencyNumber.Text = nfRangeCount ' End If 'Next 'If nfRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nf As Integer = CInt(Request.QueryString("nf")) If (nf <> Nothing) Then 'Get the user control that fired this event, and remove it Dim specificFrequencyUserControl As SpecificFrequency = sender.parent ' If specificFrequencyUserControl.PairedFrequencyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will increase the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small increase in size that it shouldn't be an issue. ltlnfRemoved.Text &= specificFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnfCount.Text = Convert.ToInt16(ltlnfCount.Text) - 1 'End If Else Dim specificFrequencyUserControl As SpecificFrequency = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(specificFrequencyUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(specificFrequencyUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlnfRemoved.Text &= specificFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnfCount.Text = Convert.ToInt16(ltlnfCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cnf As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then Dim ucNf As UserControl = CType(cnf, UserControl) Dim lblFrequencyNumber As Label = ucNf.FindControl("lblFrequencyNumber") freqRangecount = freqRangecount + 1 lblFrequencyNumber.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stNf As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNf, UserControl) ' Dim btnSpecificFrequencyRemove As Button = ucNf.FindControl("btnSpecificFrequencyRemove") ' btnSpecificFrequencyRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stNf As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then ' Dim ucNf As UserControl = CType(stNf, UserControl) ' Dim btnSpecificFrequencyRemove As Button = ucNf.FindControl("btnSpecificFrequencyRemove") ' btnSpecificFrequencyRemove.Visible = False ' End If ' Next 'End If End Sub Private Sub AddAndRemoveSpecificFrequencyControls() 'Determine which control fired the postback event. Dim nf As Integer = 0 Dim c As Control = GetPostBackControl(Page) nf = CInt(Request.QueryString("nf")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Frequency" Then ltlnfCount.Text = Convert.ToInt16(ltlnfCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nf <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. nfCount = (Convert.ToInt16(ltlnfCount.Text) + nf) For i As Integer = 1 To (nfCount) Dim specificFrequencyUserControl As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") specificFrequencyUserControl.FrequencyNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedSpecificFrequencyList("ucSpecificFrequency" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. specificFrequencyUserControl.ID = "ucSpecificFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler specificFrequencyUserControl.RemoveSpecificFrequency, AddressOf Me.HandleRemoveSpecificFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(specificFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else nfCount = (Convert.ToInt16(ltlnfCount.Text)) + Convert.ToInt32(nfCount) For i As Integer = 1 To (nfCount) Dim specificFrequencyUserControl As SpecificFrequency = LoadControl("~/controls/SpecificFrequency.ascx") If (wiki_text_id > 0) Then specificFrequencyUserControl.FrequencyNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "f") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "f" 'Done specificFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() specificFrequencyUserControl.Frequency = CDbl(frequency(i - 1).Frequency1Low) specificFrequencyUserControl.BriefDescription = frequency(i - 1).Description1.ToString() specificFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() specificFrequencyUserControl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) specificFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() specificFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "f") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "f" 'Done specificFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() specificFrequencyUserControl.Frequency = CDbl(frequency(i - 1).Frequency1Low) specificFrequencyUserControl.BriefDescription = frequency(i - 1).Description1.ToString() specificFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() specificFrequencyUserControl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) specificFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() specificFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedSpecificFrequencyList("ucSpecificFrequency" & ControlID) = True ControlID += 1 End While specificFrequencyUserControl.ID = "ucSpecificFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler specificFrequencyUserControl.RemoveSpecificFrequency, AddressOf Me.HandleRemoveSpecificFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(specificFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cnf As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnf.GetType.Name.ToLower = "controls_specificfrequency_ascx" Then freqRangecount = freqRangecount + 1 specificFrequencyUserControl.FrequencyNumber = freqRangecount End If Next Next End If End Sub Private Function InDeletedPairedFrequencyList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlnfpRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Sub HandleRemovePairedFrequency(ByVal sender As Object, ByVal e As EventArgs) 'Dim nfpRangeCount As Integer = 0 'For Each stNfp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then ' Dim ucNb As UserControl = CType(stNfp, UserControl) ' Dim lblPairedNumber As Label = ucNb.FindControl("lblPairedNumber") ' nfpRangeCount = nfpRangeCount + 1 ' lblPairedNumber.Text = nfpRangeCount ' End If 'Next ' If nfpRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nfp As Integer = CInt(Request.QueryString("nfp")) If (nfp <> Nothing) Then 'Get the user control that fired this event, and remove it Dim pairedFrequencyUserControl As PairedFrequency = sender.parent ' If pairedFrequencyUserControl.PairedFrequencyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will increase the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small increase in size that it shouldn't be an issue. ltlnfpRemoved.Text &= pairedFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnfpCount.Text = Convert.ToInt16(ltlnfpCount.Text) - 1 'End If Else Dim pairedFrequencyUserControl As PairedFrequency = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(pairedFrequencyUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(pairedFrequencyUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlnfpRemoved.Text &= pairedFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnfpCount.Text = Convert.ToInt16(ltlnfpCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cnfp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then Dim ucNb As UserControl = CType(cnfp, UserControl) Dim lblPairedNumber As Label = ucNb.FindControl("lblPairedNumber") freqRangecount = freqRangecount + 1 lblPairedNumber.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stNfp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then ' Dim ucNb As UserControl = CType(stNfp, UserControl) ' Dim btnPairedFrequencyRemove As Button = ucNb.FindControl("btnPairedFrequencyRemove") ' btnPairedFrequencyRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stNfp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stNfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then ' Dim ucNb As UserControl = CType(stNfp, UserControl) ' Dim btnPairedFrequencyRemove As Button = ucNb.FindControl("btnPairedFrequencyRemove") ' btnPairedFrequencyRemove.Visible = False ' End If ' Next 'End If End Sub Private Sub AddAndRemovePairedFrequencyControls() 'Determine which control fired the postback event. Dim nfp As Integer = 0 Dim c As Control = GetPostBackControl(Page) nfp = CInt(Request.QueryString("nfp")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Paired frequency" Then ltlnfpCount.Text = Convert.ToInt16(ltlnfpCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nfp <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. nfpCount = (Convert.ToInt16(ltlnfpCount.Text) + nfp) For i As Integer = 1 To (nfpCount) Dim pairedFrequencyUserControl As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") pairedFrequencyUserControl.PairedNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedPairedFrequencyList("ucPairedFrequency" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. pairedFrequencyUserControl.ID = "ucPairedFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler pairedFrequencyUserControl.RemovePairedFrequency, AddressOf Me.HandleRemovePairedFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(pairedFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else nfpCount = (Convert.ToInt16(ltlnfpCount.Text)) + Convert.ToInt32(nfpCount) For i As Integer = 1 To (nfpCount) Dim pairedFrequencyUserControl As PairedFrequency = LoadControl("~/controls/PairedFrequency.ascx") If (wiki_text_id > 0) Then pairedFrequencyUserControl.PairedNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "fp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "fp" 'Done pairedFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() pairedFrequencyUserControl.BriefDescription1 = frequency(i - 1).Description1.ToString() pairedFrequencyUserControl.PairedWithBriefDescription = frequency(i - 1).Description2.ToString() pairedFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() pairedFrequencyUserControl.RadioService2 = frequency(i - 1).Service2.ToString() pairedFrequencyUserControl.Frequency = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.PairedWithFrequency = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() pairedFrequencyUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() pairedFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "fp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "fp" 'Done pairedFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() pairedFrequencyUserControl.BriefDescription1 = frequency(i - 1).Description1.ToString() pairedFrequencyUserControl.PairedWithBriefDescription = frequency(i - 1).Description2.ToString() pairedFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() pairedFrequencyUserControl.RadioService2 = frequency(i - 1).Service2.ToString() pairedFrequencyUserControl.Frequency = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.PairedWithFrequency = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) pairedFrequencyUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) pairedFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() pairedFrequencyUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() pairedFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedPairedFrequencyList("ucPairedFrequency" & ControlID) = True ControlID += 1 End While pairedFrequencyUserControl.ID = "ucPairedFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler pairedFrequencyUserControl.RemovePairedFrequency, AddressOf Me.HandleRemovePairedFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(pairedFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cnfp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnfp.GetType.Name.ToLower = "controls_pairedfrequency_ascx" Then freqRangecount = freqRangecount + 1 pairedFrequencyUserControl.PairedNumber = freqRangecount End If Next Next End If End Sub Private Function InDeletedChannelizedSpecificFrequencyList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlncRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Sub HandleRemoveChannelizedSpecificFrequency(ByVal sender As Object, ByVal e As EventArgs) 'Dim ncRangeCount As Integer = 0 'For Each stnc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then ' Dim ucnc As UserControl = CType(stnc, UserControl) ' Dim lblChannelizedFrequencyNumber As Label = ucnc.FindControl("lblChannelizedFrequencyNumber") ' ncRangeCount = ncRangeCount + 1 ' lblChannelizedFrequencyNumber.Text = ncRangeCount ' End If 'Next 'If ncRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nc As Integer = CInt(Request.QueryString("nc")) If (nc <> Nothing) Then 'Get the user control that fired this event, and remove it Dim ChannelizedSpecificFrequencyUserControl As ChannelizedSpecificFrequency = sender.parent ' If ChannelizedSpecificFrequencyUserControl.PairedFrequencyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will increase the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small increase in size that it shouldn't be an issue. ltlncRemoved.Text &= ChannelizedSpecificFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlncCount.Text = Convert.ToInt16(ltlncCount.Text) - 1 'End If Else Dim ChannelizedSpecificFrequencyUserControl As ChannelizedSpecificFrequency = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(ChannelizedSpecificFrequencyUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(ChannelizedSpecificFrequencyUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlncRemoved.Text &= ChannelizedSpecificFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlncCount.Text = Convert.ToInt16(ltlncCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cnc As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then Dim ucnc As UserControl = CType(cnc, UserControl) Dim lblChannelizedFrequencyNumber As Label = ucnc.FindControl("lblChannelizedFrequencyNumber") freqRangecount = freqRangecount + 1 lblChannelizedFrequencyNumber.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stnc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then ' Dim ucnc As UserControl = CType(stnc, UserControl) ' Dim btnChannelizedSpecificFrequencyRemove As Button = ucnc.FindControl("btnChannelizedSpecificFrequencyRemove") ' btnChannelizedSpecificFrequencyRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stnc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then ' Dim ucnc As UserControl = CType(stnc, UserControl) ' Dim btnChannelizedSpecificFrequencyRemove As Button = ucnc.FindControl("btnChannelizedSpecificFrequencyRemove") ' btnChannelizedSpecificFrequencyRemove.Visible = False ' End If ' Next ' End If End Sub Private Sub AddAndRemoveChannelizedSpecificFrequencyControls() 'Determine which control fired the postback event. Dim nc As Integer = 0 Dim c As Control = GetPostBackControl(Page) nc = CInt(Request.QueryString("nc")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Channelized Frequency" Then ltlncCount.Text = Convert.ToInt16(ltlncCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nc <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. ncCount = (Convert.ToInt16(ltlncCount.Text) + nc) For i As Integer = 1 To (ncCount) Dim ChannelizedSpecificFrequencyUserControl As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") ChannelizedSpecificFrequencyUserControl.ChannelizedFrequencyNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering incormation in the viewstate. While InDeletedChannelizedSpecificFrequencyList("ucChannelizedSpecificFrequency" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate incormation of the user control 'for us. ChannelizedSpecificFrequencyUserControl.ID = "ucChannelizedSpecificFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedSpecificFrequencyUserControl.RemoveChannelizedSpecificFrequency, AddressOf Me.HandleRemoveChannelizedSpecificFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedSpecificFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else ncCount = (Convert.ToInt16(ltlncCount.Text)) + Convert.ToInt32(ncCount) For i As Integer = 1 To (ncCount) Dim ChannelizedSpecificFrequencyUserControl As ChannelizedSpecificFrequency = LoadControl("~/controls/ChannelizedSpecificFrequency.ascx") If (wiki_text_id > 0) Then ChannelizedSpecificFrequencyUserControl.ChannelizedFrequencyNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "c") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "c" 'Done ChannelizedSpecificFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedSpecificFrequencyUserControl.BriefDescription = frequency(i - 1).Description1.ToString() ChannelizedSpecificFrequencyUserControl.Frequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedSpecificFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedSpecificFrequencyUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedSpecificFrequencyUserControl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedSpecificFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedSpecificFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "c") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "c" 'Done ChannelizedSpecificFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedSpecificFrequencyUserControl.BriefDescription = frequency(i - 1).Description1.ToString() ChannelizedSpecificFrequencyUserControl.Frequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedSpecificFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedSpecificFrequencyUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedSpecificFrequencyUserControl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedSpecificFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedSpecificFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedChannelizedSpecificFrequencyList("ucChannelizedSpecificFrequency" & ControlID) = True ControlID += 1 End While ChannelizedSpecificFrequencyUserControl.ID = "ucChannelizedSpecificFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedSpecificFrequencyUserControl.RemoveChannelizedSpecificFrequency, AddressOf Me.HandleRemoveChannelizedSpecificFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedSpecificFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cnc As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnc.GetType.Name.ToLower = "controls_channelizedspecificfrequency_ascx" Then freqRangecount = freqRangecount + 1 ChannelizedSpecificFrequencyUserControl.ChannelizedFrequencyNumber = freqRangecount End If Next Next End If End Sub Private Function InDeletedChannelizedPairedFrequencyList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlncpRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Sub HandleRemoveChannelizedPairedFrequency(ByVal sender As Object, ByVal e As EventArgs) 'Dim ncpRangeCount As Integer = 0 'For Each stncp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then ' Dim ucncp As UserControl = CType(stncp, UserControl) ' Dim lblChannelpairFrequency As Label = ucncp.FindControl("lblChannelpairFrequency") ' ncpRangeCount = ncpRangeCount + 1 ' lblChannelpairFrequency.Text = ncpRangeCount ' End If 'Next 'If ncpRangeCount <> 1 Then 'This handles delete event fired from the user control Dim ncp As Integer = CInt(Request.QueryString("ncp")) If (ncp <> Nothing) Then 'Get the user control that fired this event, and remove it Dim ChannelizedPairedFrequencyUserControl As ChannelizedPairedFrequency = sender.parent ' If ChannelizedSpecificFrequencpyUserControl.PairedFrequencpyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will incprease the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small incprease in size that it shouldn't be an issue. ltlncpRemoved.Text &= ChannelizedPairedFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlncpCount.Text = Convert.ToInt16(ltlncpCount.Text) - 1 'End If Else Dim ChannelizedPairedFrequencyUserControl As ChannelizedPairedFrequency = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(ChannelizedPairedFrequencyUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(ChannelizedPairedFrequencyUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlncpRemoved.Text &= ChannelizedPairedFrequencyUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlncpCount.Text = Convert.ToInt16(ltlncpCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cncp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then Dim ucncp As UserControl = CType(cncp, UserControl) Dim lblChannelpairFrequency As Label = ucncp.FindControl("lblChannelpairFrequency") freqRangecount = freqRangecount + 1 lblChannelpairFrequency.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stncp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then ' Dim ucncp As UserControl = CType(stncp, UserControl) ' Dim btnChannelizedPairedFrequencyRemove As Button = ucncp.FindControl("btnChannelizedPairedFrequencyRemove") ' btnChannelizedPairedFrequencyRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stncp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stncp.GetType.Name.ToLower = "controls_channelizedpairedfrequencpy_ascx" Then ' Dim ucncp As UserControl = CType(stncp, UserControl) ' Dim btnChannelizedPairedFrequencyRemove As Button = ucncp.FindControl("btnChannelizedPairedFrequencyRemove") ' btnChannelizedPairedFrequencyRemove.Visible = False ' End If ' Next 'End If End Sub Private Sub AddAndRemoveChannelizedPairedFrequencyControls() 'Determine which control fired the postback event. Dim ncp As Integer = 0 Dim c As Control = GetPostBackControl(Page) ncp = CInt(Request.QueryString("ncp")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Channelized paired frequency" Then ltlncpCount.Text = Convert.ToInt16(ltlncpCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If ncp <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. ncpCount = (Convert.ToInt16(ltlncpCount.Text) + ncp) For i As Integer = 1 To (ncpCount) Dim ChannelizedPairedFrequencyUserControl As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") ChannelizedPairedFrequencyUserControl.ChannelPairNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedChannelizedPairedFrequencyList("ucChannelizedPairedFrequency" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. ChannelizedPairedFrequencyUserControl.ID = "ucChannelizedPairedFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedPairedFrequencyUserControl.RemoveChannelizedPairedFrequency, AddressOf Me.HandleRemoveChannelizedPairedFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedPairedFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else ncpCount = (Convert.ToInt16(ltlncpCount.Text)) + Convert.ToInt32(ncpCount) For i As Integer = 1 To (ncpCount) Dim ChannelizedPairedFrequencyUserControl As ChannelizedPairedFrequency = LoadControl("~/controls/ChannelizedPairedFrequency.ascx") If (wiki_text_id > 0) Then ChannelizedPairedFrequencyUserControl.ChannelPairNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "cp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "cp" 'Done ChannelizedPairedFrequencyUserControl.ChannelFrequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyUserControl.PairedWithFrequency = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyUserControl.ChannelBriefDescription = frequency(i - 1).Description1.ToString() ChannelizedPairedFrequencyUserControl.PairedWithBriefDescription = frequency(i - 1).Description2.ToString() ChannelizedPairedFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedPairedFrequencyUserControl.RadioService2 = frequency(i - 1).Service2.ToString() ChannelizedPairedFrequencyUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedPairedFrequencyUserControl.PairedWithChannelName = frequency(i - 1).Channel2.ToString() ChannelizedPairedFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedPairedFrequencyUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedPairedFrequencyUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() ChannelizedPairedFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "cp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "cp" 'Done ChannelizedPairedFrequencyUserControl.ChannelFrequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyUserControl.PairedWithFrequency = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyUserControl.ChannelBriefDescription = frequency(i - 1).Description1.ToString() ChannelizedPairedFrequencyUserControl.PairedWithBriefDescription = frequency(i - 1).Description2.ToString() ChannelizedPairedFrequencyUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedPairedFrequencyUserControl.RadioService2 = frequency(i - 1).Service2.ToString() ChannelizedPairedFrequencyUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedPairedFrequencyUserControl.PairedWithChannelName = frequency(i - 1).Channel2.ToString() ChannelizedPairedFrequencyUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedPairedFrequencyUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedPairedFrequencyUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() ChannelizedPairedFrequencyUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedChannelizedPairedFrequencyList("ucChannelizedPairedFrequency" & ControlID) = True ControlID += 1 End While ChannelizedPairedFrequencyUserControl.ID = "ucChannelizedPairedFrequency" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedPairedFrequencyUserControl.RemoveChannelizedPairedFrequency, AddressOf Me.HandleRemoveChannelizedPairedFrequency 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedPairedFrequencyUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cncp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cncp.GetType.Name.ToLower = "controls_channelizedpairedfrequency_ascx" Then freqRangecount = freqRangecount + 1 ChannelizedPairedFrequencyUserControl.ChannelPairNumber = freqRangecount End If Next Next End If End Sub Private Function InDeletedChannelizedFrequencyBandList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlnbcRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Sub HandleRemoveChannelizedFrequencyBand(ByVal sender As Object, ByVal e As EventArgs) 'Dim nbcRangeCount As Integer = 0 'For Each stnbc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then ' Dim ucnbc As UserControl = CType(stnbc, UserControl) ' Dim lblChannelizedBandNumber As Label = ucnbc.FindControl("lblChannelizedBandNumber") ' nbcRangeCount = nbcRangeCount + 1 ' lblChannelizedBandNumber.Text = nbcRangeCount ' End If 'Next 'If nbcRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nbc As Integer = CInt(Request.QueryString("nbc")) If (nbc <> Nothing) Then 'Get the user control that fired this event, and remove it Dim ChannelizedFrequencyBandUserControl As ChannelizedFrequencyBand = sender.parent ' If ChannelizedSpecificFrequenbcyUserControl.PairedFrequenbcyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will inbcrease the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small inbcrease in size that it shouldn't be an issue. ltlnbcRemoved.Text &= ChannelizedFrequencyBandUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnbcCount.Text = Convert.ToInt16(ltlnbcCount.Text) - 1 'End If Else Dim ChannelizedFrequencyBandUserControl As ChannelizedFrequencyBand = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(ChannelizedFrequencyBandUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(ChannelizedFrequencyBandUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlnbcRemoved.Text &= ChannelizedFrequencyBandUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnbcCount.Text = Convert.ToInt16(ltlnbcCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cnbc As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then Dim ucnbc As UserControl = CType(cnbc, UserControl) Dim lblChannelizedBandNumber As Label = ucnbc.FindControl("lblChannelizedBandNumber") freqRangecount = freqRangecount + 1 lblChannelizedBandNumber.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stnbc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then ' Dim ucnbc As UserControl = CType(stnbc, UserControl) ' Dim btnChannelizedFrequencyBandRemove As Button = ucnbc.FindControl("btnChannelizedFrequencyBandRemove") ' btnChannelizedFrequencyBandRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stnbc As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then ' Dim ucnbc As UserControl = CType(stnbc, UserControl) ' Dim btnChannelizedFrequencyBandRemove As Button = ucnbc.FindControl("btnChannelizedFrequencyBandRemove") ' btnChannelizedFrequencyBandRemove.Visible = False ' End If ' Next 'End If End Sub Private Sub AddAndRemoveChannelizedFrequencyBand() 'Determine which control fired the postback event. Dim nbc As Integer = 0 Dim c As Control = GetPostBackControl(Page) nbc = CInt(Request.QueryString("nbc")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Channelized frequency band" Then ltlnbcCount.Text = Convert.ToInt16(ltlnbcCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nbc <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. nbcCount = (Convert.ToInt16(ltlnbcCount.Text) + nbc) For i As Integer = 1 To (nbcCount) Dim ChannelizedFrequencyBandUserControl As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") ChannelizedFrequencyBandUserControl.ChannelizedBandNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedChannelizedFrequencyBandList("ucChannelizedFrequencyBand" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. ChannelizedFrequencyBandUserControl.ID = "ucChannelizedFrequencyBand" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedFrequencyBandUserControl.RemoveChannelizedFrequencyBand, AddressOf Me.HandleRemoveChannelizedFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedFrequencyBandUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else nbcCount = (Convert.ToInt16(ltlnbcCount.Text)) + Convert.ToInt32(nbcCount) For i As Integer = 1 To (nbcCount) Dim ChannelizedFrequencyBandUserControl As ChannelizedFrequencyBand = LoadControl("~/controls/ChannelizedFrequencyBand.ascx") If (wiki_text_id > 0) Then ChannelizedFrequencyBandUserControl.ChannelizedBandNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "bc") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "bc" 'Done ChannelizedFrequencyBandUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedFrequencyBandUserControl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedFrequencyBandUserControl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) ChannelizedFrequencyBandUserControl.BriefDescription = frequency(i - 1).Description1.ToString() ChannelizedFrequencyBandUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedFrequencyBandUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedFrequencyBandUserControl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedFrequencyBandUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedFrequencyBandUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "bc") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "bc" 'Done ChannelizedFrequencyBandUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedFrequencyBandUserControl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedFrequencyBandUserControl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) ChannelizedFrequencyBandUserControl.BriefDescription = frequency(i - 1).Description1.ToString() ChannelizedFrequencyBandUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedFrequencyBandUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedFrequencyBandUserControl.RadioFrequency = CDbl(frequency(i - 1).Frequency1Low) ChannelizedFrequencyBandUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedFrequencyBandUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedChannelizedFrequencyBandList("ucChannelizedFrequencyBand" & ControlID) = True ControlID += 1 End While ChannelizedFrequencyBandUserControl.ID = "ucChannelizedFrequencyBand" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedFrequencyBandUserControl.RemoveChannelizedFrequencyBand, AddressOf Me.HandleRemoveChannelizedFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedFrequencyBandUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cnbc As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnbc.GetType.Name.ToLower = "controls_channelizedfrequencyband_ascx" Then freqRangecount = freqRangecount + 1 ChannelizedFrequencyBandUserControl.ChannelizedBandNumber = freqRangecount End If Next Next End If End Sub Private Function InDeletedChannelizedPairedFrequencyBandList(ByVal ControlID As String) As Boolean 'Determine if the passed in user control id has been stored in the list of controls that 'were previously deleted off the page Dim DeletedList() As String = ltlnbcpRemoved.Text.Split("|") For i As Integer = 0 To DeletedList.GetLength(0) - 1 If ControlID.ToLower = DeletedList(i).ToLower Then Return True End If Next Return False End Function Sub HandleRemoveChannelizedPairedFrequencyBand(ByVal sender As Object, ByVal e As EventArgs) 'Dim nbcpRangeCount As Integer = 0 'For Each stnbcp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then ' Dim ucnbcp As UserControl = CType(stnbcp, UserControl) ' Dim lblPairedChannelNumber As Label = ucnbcp.FindControl("lblPairedChannelNumber") ' nbcpRangeCount = nbcpRangeCount + 1 ' lblPairedChannelNumber.Text = nbcpRangeCount ' End If 'Next 'If nbcpRangeCount <> 1 Then 'This handles delete event fired from the user control Dim nbcp As Integer = CInt(Request.QueryString("nbcp")) If (nbcp <> Nothing) Then 'Get the user control that fired this event, and remove it Dim ChannelizedPairedFrequencyBandUserControl As ChannelizedPairedFrequencyBand = sender.parent ' If ChannelizedSpecificFrequenbcpyUserControl.PairedFrequenbcpyNumber <> 1 Then pnlBandEntries.Controls.Remove(sender.parent) 'Keep a pipe delimited list of which user controls were removed. This will inbcprease the 'viewstate size if the user keeps removing dynamic controls, but under normal use 'this is such a small inbcprease in size that it shouldn't be an issue. ltlnbcpRemoved.Text &= ChannelizedPairedFrequencyBandUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnbcpCount.Text = Convert.ToInt16(ltlnbcpCount.Text) - 1 'End If Else Dim ChannelizedPairedFrequencyBandUserControl As ChannelizedPairedFrequencyBand = sender.parent pnlBandEntries.Controls.Remove(sender.parent) Try WikiFrequencyBLL.TempDeleteWikiFrequencyId(ChannelizedPairedFrequencyBandUserControl.wikiFrequencyId) WikiFrequencyBLL.DeleteWikiFrequencyId(ChannelizedPairedFrequencyBandUserControl.wikiFrequencyId) Catch ex As Exception If ex.InnerException Is Nothing Then Logger.WriteToErrorLog(ex.Message) Else Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) End If End Try ltlnbcpRemoved.Text &= ChannelizedPairedFrequencyBandUserControl.ID & "|" 'Also, now that we've removed a user control decrement the count of total user controls on the page ltlnbcpCount.Text = Convert.ToInt16(ltlnbcpCount.Text) - 1 End If Dim freqRangecount As Integer = 0 Response.Clear() For Each cnbcp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then Dim ucnbcp As UserControl = CType(cnbcp, UserControl) Dim lblPairedChannelNumber As Label = ucnbcp.FindControl("lblPairedChannelNumber") freqRangecount = freqRangecount + 1 lblPairedChannelNumber.Text = freqRangecount End If Next ' If freqRangecount = 1 Then ' For Each stnbcp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then ' Dim ucnbcp As UserControl = CType(stnbcp, UserControl) ' Dim btnChannelizedPairedFrequencyBandRemove As Button = ucnbcp.FindControl("btnChannelizedPairedFrequencyBandRemove") ' btnChannelizedPairedFrequencyBandRemove.Visible = False ' End If ' Next ' End If 'Else ' For Each stnbcp As Control In pnlBandEntries.Controls ' 'Find the specific user control that we added to this placeholder, and then get the selected values ' 'for the dropdownlist, checkbox, and textbox and print them to the screen. ' If stnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then ' Dim ucnbcp As UserControl = CType(stnbcp, UserControl) ' Dim btnChannelizedPairedFrequencyBandRemove As Button = ucnbcp.FindControl("btnChannelizedPairedFrequencyBandRemove") ' btnChannelizedPairedFrequencyBandRemove.Visible = False ' End If ' Next 'End If End Sub Private Sub AddAndRemoveChannelizedPairedFrequencyBand() 'Determine which control fired the postback event. Dim nbcp As Integer = 0 Dim c As Control = GetPostBackControl(Page) nbcp = CInt(Request.QueryString("nbcp")) If Not IsNothing(c) Then 'If the add button was clicked, increase the count to let the page know we want 'to display an additional user control If c.ID.ToString = "btnAdd" Then If ddlAdd.Text = "Channelized paired frequency band" Then ltlnbcpCount.Text = Convert.ToInt16(ltlnbcpCount.Text) + 1 End If End If End If 'Be sure everything in the placeholder control is cleared out ' pnlBandEntries.Controls.Clear() Dim ControlID As Integer = 0 If nbcp <> Nothing Then 'Since these are dynamic user controls, re-add them every time the page loads. nbcpCount = (Convert.ToInt16(ltlnbcpCount.Text) + nbcp) For i As Integer = 1 To (nbcpCount) Dim ChannelizedPairedFrequencyBandUserControl As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") ChannelizedPairedFrequencyBandUserControl.PairedChannelNumber = i 'If this particular control id has been deleted from the page, DO NOT use it again. If we do, it will 'pick up the viewstate data from the old item that had this control id, instead of generating 'a completely new control. Instead, increment the control id so we're guaranteed to get a "new" 'control that doesn't have any lingering information in the viewstate. While InDeletedChannelizedPairedFrequencyBandList("ucChannelizedPairedFrequencyBand" & ControlID) = True ControlID += 1 End While 'Note that if the item has not been deleted from the page, we DO want it to use the same control id 'as it used before, so it will automatically maintain the viewstate information of the user control 'for us. ChannelizedPairedFrequencyBandUserControl.ID = "ucChannelizedPairedFrequencyBand" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedPairedFrequencyBandUserControl.RemoveChannelizedPairedFrequencyBand, AddressOf Me.HandleRemoveChannelizedPairedFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedPairedFrequencyBandUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Next Else nbcpCount = (Convert.ToInt16(ltlnbcpCount.Text)) + Convert.ToInt32(nbcpCount) For i As Integer = 1 To (nbcpCount) Dim ChannelizedPairedFrequencyBandUserControl As ChannelizedPairedFrequencyBand = LoadControl("~/controls/ChannelizedPairedFrequencyBand.ascx") If (wiki_text_id > 0) Then ChannelizedPairedFrequencyBandUserControl.PairedChannelNumber = i Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.GetFrequencies_Type(wiki_text_id, "bcp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "bcp" 'Done ChannelizedPairedFrequencyBandUserControl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyBandUserControl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) ChannelizedPairedFrequencyBandUserControl.FromPairedFrequency = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyBandUserControl.ToPairedFrequency = CDbl(frequency(i - 1).Frequency2High) ChannelizedPairedFrequencyBandUserControl.BriefDescription = frequency(i - 1).Description1.ToString() ChannelizedPairedFrequencyBandUserControl.PairedBriefDescription = frequency(i - 1).Description2.ToString() ChannelizedPairedFrequencyBandUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedPairedFrequencyBandUserControl.PairedWithChannelName = frequency(i - 1).Channel2.ToString() ChannelizedPairedFrequencyBandUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedPairedFrequencyBandUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedPairedFrequencyBandUserControl.RadioService2 = frequency(i - 1).Service2.ToString() ChannelizedPairedFrequencyBandUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyBandUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyBandUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedPairedFrequencyBandUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() ChannelizedPairedFrequencyBandUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If ElseIf (temp_wiki_text_id > 0) Then Dim count = 0 Dim frequency As List(Of WikiFrequency) = WikiFrequencyBLL.TempGetFrequencies_Type(temp_wiki_text_id, "bcp") count = frequency.Count If count > i - 1 Then Select Case frequency(i - 1).FrequencyType.ToString() Case "bcp" 'Done ChannelizedPairedFrequencyBandUserControl.FromFrequencyRange1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyBandUserControl.ToFrequencyRange1 = CDbl(frequency(i - 1).Frequency1High) ChannelizedPairedFrequencyBandUserControl.FromPairedFrequency = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyBandUserControl.ToPairedFrequency = CDbl(frequency(i - 1).Frequency2High) ChannelizedPairedFrequencyBandUserControl.BriefDescription = frequency(i - 1).Description1.ToString() ChannelizedPairedFrequencyBandUserControl.PairedBriefDescription = frequency(i - 1).Description2.ToString() ChannelizedPairedFrequencyBandUserControl.ChannelName = frequency(i - 1).Channel1.ToString() ChannelizedPairedFrequencyBandUserControl.PairedWithChannelName = frequency(i - 1).Channel2.ToString() ChannelizedPairedFrequencyBandUserControl.AllocationTable = frequency(i - 1).AllocationTable.ToString() ChannelizedPairedFrequencyBandUserControl.RadioService1 = frequency(i - 1).Service1.ToString() ChannelizedPairedFrequencyBandUserControl.RadioService2 = frequency(i - 1).Service2.ToString() ChannelizedPairedFrequencyBandUserControl.RadioFrequency1 = CDbl(frequency(i - 1).Frequency1Low) ChannelizedPairedFrequencyBandUserControl.RadioFrequency2 = CDbl(frequency(i - 1).Frequency2Low) ChannelizedPairedFrequencyBandUserControl.RadioQualifier1 = frequency(i - 1).Qualifier1.ToString() ChannelizedPairedFrequencyBandUserControl.RadioQualifier2 = frequency(i - 1).Qualifier2.ToString() ChannelizedPairedFrequencyBandUserControl.wikiFrequencyId = frequency(i - 1).WikiFrequencyId End Select End If End If While InDeletedChannelizedPairedFrequencyBandList("ucChannelizedPairedFrequencyBand" & ControlID) = True ControlID += 1 End While ChannelizedPairedFrequencyBandUserControl.ID = "ucChannelizedPairedFrequencyBand" & ControlID 'Add an event handler to this control to raise an event when the delete button is clicked 'on the user control AddHandler ChannelizedPairedFrequencyBandUserControl.RemoveChannelizedPairedFrequencyBand, AddressOf Me.HandleRemoveChannelizedPairedFrequencyBand 'Finally, add the user control to the panel pnlBandEntries.Controls.Add(ChannelizedPairedFrequencyBandUserControl) 'Increment the control id for the next round through the loop ControlID += 1 Dim freqRangecount As Integer = 0 Response.Clear() For Each cnbcp As Control In pnlBandEntries.Controls 'Find the specific user control that we added to this placeholder, and then get the selected values 'for the dropdownlist, checkbox, and textbox and print them to the screen. If cnbcp.GetType.Name.ToLower = "controls_channelizedpairedfrequencyband_ascx" Then freqRangecount = freqRangecount + 1 ChannelizedPairedFrequencyBandUserControl.PairedChannelNumber = freqRangecount End If Next Next End If End Sub End Class