Imports SpectrumWiki.BusinessComponent Imports System Imports System.Collections Imports System.Collections.Generic Imports System.Reflection Imports System.IO Imports SpectrumWiki.Web.UI.MultiSelectDropDown 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 Dim edit As Integer = 0 Dim eguid 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 Private dtTempExternalLink As DataTable Dim tempID As Integer = 0 Dim orgID As Integer = 0 #End Region Protected Sub Page_Init(ByVal Sender As Object, ByVal e As EventArgs) Handles Me.Init 'End If End Sub Private Sub LoadCountryControlBindings() Dim dtCountry As New DataTable Try dtCountry = WikiCountry.GetCountryList() 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 dr As DataRow = Nothing dtCountry.Columns.AddRange(New DataColumn() {New DataColumn("selected")}) Dim count = dtCountry.Rows.Count Dim dtSelectedCountry As New DataTable If (wiki_text_id > 0) Then dtSelectedCountry = WikiTextBLL.GetWikiText(wiki_text_id) Dim cntCount As Integer cntCount = 0 For i As Integer = 0 To count - 1 Dim selCtry As String() = Nothing selCtry = dtSelectedCountry.Rows(0)("country").ToString().Split(",") Dim country As String For Each country In selCtry If country.Trim() = dtCountry.Rows(i)("country") Then dtCountry.Rows(i)("selected") = True ' cntCount = cntCount + 1 End If Next If IsDBNull(dtCountry.Rows(i)("selected")) Then dtCountry.Rows(i)("selected") = False End If Next If dtSelectedCountry.Rows(0)("country").ToString() = "Worldwide" Then Multiselectdropdown2.checkSelectAll = True 'chkSelectAll.Checked = True Else Multiselectdropdown2.checkSelectAll = False ' chkSelectAll.Checked = False End If ElseIf (temp_wiki_text_id > 0) Then dtSelectedCountry = WikiTextBLL.TempGetWikiText(temp_wiki_text_id) Dim cntCount As Integer cntCount = 0 For i As Integer = 0 To count - 1 Dim selCtry As String() = Nothing selCtry = dtSelectedCountry.Rows(0)("country").ToString().Split(",") Dim country As String For Each country In selCtry If country.Trim() = dtCountry.Rows(i)("country") Then dtCountry.Rows(i)("selected") = True cntCount = cntCount + 1 End If Next If IsDBNull(dtCountry.Rows(i)("selected")) Then dtCountry.Rows(i)("selected") = False End If Next If dtSelectedCountry.Rows(0)("country").ToString() = "Worldwide" Then Multiselectdropdown2.checkSelectAll = True 'chkSelectAll.Checked = True Else Multiselectdropdown2.checkSelectAll = False ' chkSelectAll.Checked = False End If Else For i As Integer = 0 To count - 1 If dtCountry.Rows(i)("country") = "United States" Then dtCountry.Rows(i)("selected") = True Multiselectdropdown2.tbmCountry = "United States, " Else dtCountry.Rows(i)("selected") = False End If Next End If Me.Multiselectdropdown2.DataSource = dtCountry Me.Multiselectdropdown2.DataTextField = "country" Me.Multiselectdropdown2.DataValueField = "country" Me.Multiselectdropdown2.AutoPostBack = True Me.Multiselectdropdown2.DataBind() End Sub 'Private Sub Multiselectdropdown2_OnItemsSelected(ByVal sender As Object, ByVal args As MultiSelectDropDownItemSelectedEventArgs) ' 'Me.tbSelectedFullText.Text = String.Empty ' 'Me.tbSelectedOptionsValue.Text = String.Empty ' 'Me.lbSelectedItemList.Items.Clear() ' 'Me.tbSelectedOptionsValue.Text = args.SelectedOptionValueText ' 'Me.tbSelectedFullText.Text = args.SelectedOptionText ' 'For Each selectedOption As String In args.SelectedOptionList ' ' Me.lbSelectedItemList.Items.Add(selectedOption) ' 'Next 'End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load AddHandler Multiselectdropdown2.CheckedSelectAll, AddressOf Me.HandleCheckSelectAll ' Dim s As String = Multiselectdropdown2.SelectedOptionsValueList If Not IsPostBack Then 'MultiDropdown country LoadCountryControlBindings() Me.Multiselectdropdown2.CallingPage = Me 'AddHandler Multiselectdropdown2.OnItemsSelected, New MultiSelectDropDownDelegate(AddressOf Multiselectdropdown2_OnItemsSelected) If Convert.ToInt32(Request.QueryString("EditWikiId")) > 0 Then Try If SessionWrapper.UserRowID > 0 Then WikiUserEdit.WikiUserEditInsert(SessionWrapper.UserRowID, Convert.ToInt32(Request.QueryString("EditWikiId")), DateTime.Now.ToString()) End If 'WikiExternalLinkBLL.InsertExternalLinkOrgtoTemp(Convert.ToInt32(Request.QueryString("EditWikiId"))) 'WikiExternalLinkBLL.DeleteExternalLink_notsave(Convert.ToInt32(Request.QueryString("EditWikiId"))) 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 tempID = Convert.ToInt32(Request.QueryString("Id")) orgID = Convert.ToInt32(Request.QueryString("OrgId")) If tempID = 0 Then dtTempExternalLink = New DataTable("tblTest") Dim dc0 As New DataColumn() dc0.DataType = GetType(System.Int32) dc0.ColumnName = "AutoID" dc0.AutoIncrement = True dc0.AutoIncrementSeed = 1 dc0.[ReadOnly] = True dc0.Unique = True Dim dc1 As New DataColumn() dc1.DataType = GetType([String]) dc1.ColumnName = "Title" Dim dc2 As New DataColumn() dc2.DataType = GetType([String]) dc2.ColumnName = "Url" Dim dc3 As New DataColumn() dtTempExternalLink.Columns.Add(dc1) dtTempExternalLink.Columns.Add(dc2) dtTempExternalLink.Columns.Add(dc0) End If 'If Not IsPostBack Then 'End If If String.IsNullOrEmpty(SessionWrapper.UserName) Then If Convert.ToInt32(Request.QueryString("EditWikiId")) > 0 Then Dim current_Url As String = Request.RawUrl 'string Current_Url = this.Request.RawUrl; Response.Redirect("~/wiki/Login.aspx?Rawurl=" & current_Url) Else Response.Redirect("~/wiki/Login.aspx") End If End If mainHeading = txtMainHeading.Text descrp = txtDescription.Text 'Dim c As Control = GetPostBackControl(Page) If Not IsPostBack Then Dim lnkUserName As LinkButton = Master.FindControl("lnkUserName") lnkUserName.Text = SessionWrapper.UserName End If Dim nb As Integer = CInt(Request.QueryString("nb")) If Not String.IsNullOrEmpty(Session("id")) Then wiki_text_id = Session("id") End If editWikiId = CInt(Request.QueryString("EditWikiId")) If editWikiId <> Nothing Then Dim dtWikiFrequency As New DataTable Try dtWikiFrequency = WikiFrequencyBLL.GetWikiFrequency(editWikiId) 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 If dtWikiFrequency.Rows.Count > 0 Then edit = editWikiId Session("id") = editWikiId wiki_text_id = Session("id") Else Response.Redirect("~/Error/WikiEntryError.aspx") End If 'Session.Remove("id") 'Session("editWikiId") = editWikiId End If If edit = 0 Then If Not String.IsNullOrEmpty(Request.QueryString("Edit")) Then edit = Convert.ToInt32(Request.QueryString("Edit")) End If End If If edit > 0 Then Page.Title = "SpectrumWiki: Edit" btnDelete.Style.Add("display", "block") Else btnDelete.Style.Add("display", "none") End If 'If edit > 0 Then ' BindExternalLinks(edit) ' divExternal.Style.Add("display", "block") 'Else ' If tempID = 0 Then ' divTemp.Style.Add("display", "none") ' divExternal.Style.Add("display", "none") ' 'gvTempExteranlLink.Visible = True ' 'gvExternalLinks.Visible = False ' If orgID > 0 Then ' divExternal.Style.Add("display", "block") ' 'gvExternalLinks.Visible = True ' 'BindExternalLinksTempOrg(orgID, tempID) ' 'BindExternalLinksTempOrg(orgID, tempID) ' BindExternalLinks(orgID) ' Else ' BindExternalLinksTempOrg(orgID, tempID) ' End If ' Else ' divTemp.Style.Add("display", "none") ' divExternal.Style.Add("display", "block") ' 'gvTempExteranlLink.Visible = False ' 'gvExternalLinks.Visible = True ' If orgID > 0 Then ' BindExternalLinks(orgID) ' Else ' BindExternalLinksTempOrg(orgID, tempID) ' End If ' ' BindExternalLinksTempOrg(orgID, tempID) ' End If 'End If 'Feb 16,2012 at 5pm eguid = Request.QueryString("eguid") If editWikiId > 0 Then Try If CStr(Session("exGuid")) <> "" Then eguid = Session("exGuid") Else Dim eguidedit As String = Guid.NewGuid.ToString() Session("exGuid") = eguidedit eguid = eguidedit End If If Not IsPostBack Then WikiExternalLinkBLL.InsertExternalLink_o_to_t(editWikiId, Session("exGuid")) End If t_BindExternalLinks(eguid) divTemp.Style.Add("display", "block") 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 edit > 0 Then If Not String.IsNullOrEmpty(Request.QueryString("eguid")) Then Session("exGuid") = eguid t_BindExternalLinks(eguid) divTemp.Style.Add("display", "block") End If ElseIf orgID > 0 Then If Not String.IsNullOrEmpty(Request.QueryString("eguid")) Then Session("exGuid") = eguid t_BindExternalLinks(eguid) divTemp.Style.Add("display", "block") End If ElseIf tempID > 0 Then If Not String.IsNullOrEmpty(Request.QueryString("eguid")) Then Session("exGuid") = eguid t_BindExternalLinks(eguid) divTemp.Style.Add("display", "block") End If 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 LoadCountryControlBindings() Dim dt As DataTable = WikiTextBLL.GetWikiText(wiki_text_id) 'multiselect Multiselectdropdown2.tbmCountry = dt.Rows(0)("country") ' txtMainHeading.Text = dt.Rows(0)("head") txtDescription.Text = dt.Rows(0)("description") Dim rdobtnstatus As String rdobtnstatus = dt.Rows(0)("status") If rdobtnstatus.ToString() = "Proposed Use" Then rdoProposedUse.Checked = True ElseIf rdobtnstatus.ToString() = "Historical Use" Then rdoHistoricalUse.Checked = True Else rdoCurrentUse.Checked = True End If For Each item As ListItem In chkLstLicense.Items If item.Text = "Site licensed" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("site")) End If If item.Text = "Geographic licensing" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("geo")) End If If item.Text = "Licensed by rule" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("rule")) End If If item.Text = "Unlicensed" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("undefined")) End If Next ElseIf (temp_wiki_text_id > 0) Then LoadCountryControlBindings() Dim dt As DataTable = WikiTextBLL.TempGetWikiText(temp_wiki_text_id) If dt.Rows.Count > 0 Then 'multiselect Multiselectdropdown2.tbmCountry = dt.Rows(0)("country") ' txtMainHeading.Text = dt.Rows(0)("head") txtDescription.Text = dt.Rows(0)("description") Dim rdobtnstatus As String rdobtnstatus = dt.Rows(0)("status") If rdobtnstatus.ToString() = "Proposed Use" Then rdoProposedUse.Checked = True ElseIf rdobtnstatus.ToString() = "Historical Use" Then rdoHistoricalUse.Checked = True Else rdoCurrentUse.Checked = True End If For Each item As ListItem In chkLstLicense.Items If item.Text = "Site licensed" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("site")) End If If item.Text = "Geographic licensing" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("geo")) End If If item.Text = "Licensed by rule" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("rule")) End If If item.Text = "Unlicensed" Then item.Selected = Convert.ToBoolean(dt.Rows(0)("undefined")) End If Next 'chkLstLicense.Items.FindByText("site licensed").Selected = Convert.ToBoolean(dt.Rows(0)("site")) 'chkLstLicense.Items.FindByText("Geographic licensing").Selected = Convert.ToBoolean(dt.Rows(0)("geo")) 'chkLstLicense.Items.FindByText("Licensed by rule").Selected = Convert.ToBoolean(dt.Rows(0)("rule")) 'chkLstLicense.Items.FindByText("Unlicensed").Selected = Convert.ToBoolean(dt.Rows(0)("undefined")) 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 If temp_wiki_text_id = 0 Then BindGridFromOrg(edit) Else BindGrid(temp_wiki_text_id) End If 'If edit > 0 Then ' BindExternalLinks(edit) 'Else ' BindExternalLinks(iki_text_id) 'End If 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 If Not IsPostBack Then ltlNbCount.Text = nbCount ltlnbpCount.Text = nbpCount ltlnfCount.Text = nfCount ltlnfpCount.Text = nfpCount ltlncCount.Text = ncCount ltlncpCount.Text = ncpCount ltlnbcCount.Text = nbcCount ltlnbcpCount.Text = nbcpCount End If End If If ddlAdd.Text = "Frequency band" Then AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemoveFrequencyBandControls() ElseIf ddlAdd.Text = "Paired frequency band" Then AddAndRemoveFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemovePairedFrequencyBandControls() ElseIf ddlAdd.Text = "Frequency" Then AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemoveSpecificFrequencyControls() ElseIf ddlAdd.Text = "Paired frequency" Then AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemovePairedFrequencyControls() ElseIf ddlAdd.Text = "Channelized Frequency" Then AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemoveChannelizedSpecificFrequencyControls() ElseIf ddlAdd.Text = "Channelized paired frequency" Then AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyControls() ElseIf ddlAdd.Text = "Channelized frequency band" Then AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedPairedFrequencyBand() AddAndRemoveChannelizedFrequencyBand() ElseIf ddlAdd.Text = "Channelized paired frequency band" Then AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() Else AddAndRemoveFrequencyBandControls() AddAndRemovePairedFrequencyBandControls() AddAndRemoveSpecificFrequencyControls() AddAndRemovePairedFrequencyControls() AddAndRemoveChannelizedSpecificFrequencyControls() AddAndRemoveChannelizedPairedFrequencyControls() AddAndRemoveChannelizedFrequencyBand() AddAndRemoveChannelizedPairedFrequencyBand() 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 = "" 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 status As String If rdoCurrentUse.Checked = True Then status = rdoCurrentUse.Text.ToString() ElseIf rdoProposedUse.Checked = True Then status = rdoProposedUse.Text.ToString() Else status = rdoHistoricalUse.Text.ToString() End If Dim heading As String = mainHeading Dim description As String = descrp Dim wikiText As WikiText = New WikiText() If chkLstLicense.Items.FindByText("Site licensed").Selected = True Then wikiText.Site = "1" Else wikiText.Site = "0" End If If chkLstLicense.Items.FindByText("Geographic licensing").Selected = True Then wikiText.Geo = "1" Else wikiText.Geo = "0" End If If chkLstLicense.Items.FindByText("Licensed by rule").Selected = True Then wikiText.Rule = "1" Else wikiText.Rule = "0" End If If chkLstLicense.Items.FindByText("Unlicensed").Selected = True Then wikiText.Undefined = "1" Else wikiText.Undefined = "0" End If wikiText.Head = heading wikiText.Description = description wikiText.Country = Multiselectdropdown2.tbmCountry Dim s As String = Multiselectdropdown2.SelectedOptionsText wikiText.Status = status.ToString() 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 rank As String = fb.Rank 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 Dim subCategory As String = fb.Subcategory 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory 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 Dim subCategory As String = bp.Subcategory Dim rank As String = bp.Rank 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.Rank = rank wikiFrequency.SubCategory = subCategory 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 Dim subcategory As String = f.Subcategory Dim rank As String = f.Rank 'bandwidth Dim bandwidth As Long Dim bandWidthUnit As String = f.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(f.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(f.Bandwidth * 1000000) Else bandwidth = CLng(f.Bandwidth * 1000000000) End If 'fromfrequency 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.Rank = rank wikiFrequency.SubCategory = subcategory 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 Dim rank As String = fp.Rank Dim subCategory As String = fp.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = fp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(fp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(fp.Bandwidth * 1000000) Else bandwidth = CLng(fp.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory wikiFrequency.Bandwidth = bandwidth 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 Dim rank As String = nc.Rank Dim subCategory As String = nc.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = nc.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(nc.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(nc.Bandwidth * 1000000) Else bandwidth = CLng(nc.Bandwidth * 1000000000) End If 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = cp.Rank Dim subCategory As String = cp.Subcategory 'bandwidth Dim bandwidth As Long Dim bandWidthUnit As String = cp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(cp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(cp.Bandwidth * 1000000) Else bandwidth = CLng(cp.Bandwidth * 1000000000) End If 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim subCategory As String = bc.Subcategory Dim rank As String = bc.Rank 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim subCategory As String = bcp.Subcategory Dim rank As String = bcp.Rank 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Not String.IsNullOrEmpty(Session("editWikiId")) Then ' Try ' WikiGraphicsBLL.InsertWikiGraphicsTemp(Convert.ToInt32(Session("editWikiId")), 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 Not IsPostBack Then If Convert.ToInt32(Request.QueryString("EditWikiId")) > 0 Then Try WikiGraphicsBLL.InsertWikiGraphicsTemp(Convert.ToInt32(Request.QueryString("EditWikiId")), id) WikiNotesBLL.InsertWikiNotesTemp(Convert.ToInt32(Request.QueryString("EditWikiId")), 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 ElseIf Convert.ToInt32(Request.QueryString("Preview")) = 1 Then Try WikiGraphicsBLL.InsertWikiGraphicsTemp(edit, id) WikiNotesBLL.InsertWikiNotesTemp(edit, 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 CStr(ViewState("ExternalLinkId")) <> "" Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.updatelink(Convert.ToInt32(ViewState("ExternalLinkId")), txtTitle.Text, txtUrl.Text) ' 'WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' ViewState("ExternalLinkId") = "" 'Else ' 'Feb 15,2012 at 4pm ' If CStr(ViewState("Title")) <> "" And CStr(ViewState("Url")) <> "" Then ' Dim sa1 As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb1 As String() = ViewState("Url").ToString().Split("|"c) ' Dim recordnum1 As Integer = sa1.Length ' For j1 As Integer = 0 To recordnum1 - 2 ' Dim dr As DataRow = dtTempExternalLink.NewRow() ' dr("Title") = sa1(j1).ToString() ' dr("Url") = sb1(j1).ToString() ' dtTempExternalLink.Rows.Add(dr) ' Next ' ViewState("Title") = "" ' ViewState("Url") = "" ' For i1 As Integer = 0 To dtTempExternalLink.Rows.Count - 1 ' If dtTempExternalLink.Rows(i1)("AutoID").ToString = ViewState("TempExternalLinkId") Then ' ViewState("Title") += txtTitle.Text & "|" ' ViewState("Url") += txtUrl.Text & "|" ' Else ' ViewState("Title") += dtTempExternalLink.Rows(i1)("Title").ToString() & "|" ' ViewState("Url") += dtTempExternalLink.Rows(i1)("Url").ToString() & "|" ' End If ' Next ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 'End ' If edit > 0 Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' If tempID = 0 Then ' If Not String.IsNullOrEmpty(ViewState("Url")) Then ' Dim sa As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb As String() = ViewState("Url").ToString().Split("|"c) ' 'string[] sc = ViewState["Add2"].ToString().Split('|'); ' Dim recordnum As Integer = sa.Length ' For j As Integer = 0 To recordnum - 2 ' If (temp_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), temp_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, temp_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' End If ' If txtUrl.Text <> "" Then ' Try ' If (temp_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, temp_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' If txtUrl.Text <> "" Then ' Try ' If (temp_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, temp_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' 'ToDo: ' End If ' End If ' End If 'End If 'Feb 16,2012 at 5pm If CStr(ViewState("TempExternalLinkId")) <> "" Then Try WikiExternalLinkBLL.t_updatelink(Convert.ToInt32(ViewState("TempExternalLinkId")), txtTitle.Text, txtUrl.Text) txtUrl.Text = "" txtTitle.Text = "" 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 ViewState("TempExternalLinkId") = "" 't_BindExternalLinks(Session("exGuid")) btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") End If 'End If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Else Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If End If divTemp.Style.Add("display", "block") t_BindExternalLinks(Session("exGuid")) 'Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 'divExternal.Style.Add("display", "block") '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 orgID = 0 Then orgID = Convert.ToInt32(Session("update_wiki_text_id")) End If 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 & "&EditWikiId=" & edit & "&Edit=" & edit & "&OrgId=" & orgID & "&eguid=" & Session("exGuid")) 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 & "&EditWikiId=" & edit & "&Edit=" & edit & "&OrgId=" & orgID & "&eguid=" & Session("exGuid")) 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 BindGridFromOrg(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 BindExternalLinks(ByVal wiki_text_id As Integer) ' Try ' gvExternalLinks.DataSource = WikiExternalLinkBLL.tempSelectWikiExterlink(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 ' gvExternalLinks.DataBind() 'End Sub 'Protected Sub BindExternalLinksTempOrg(ByVal wiki_text_id As Integer, ByVal temp_wiki_text_id As Integer) ' Try ' gvExternalLinks.DataSource = WikiExternalLinkBLL.SelectExterlinkOrgTemp(wiki_text_id, 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 ' gvExternalLinks.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 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 img_guid As String = DataBinder.Eval(e.Row.DataItem, "physical_file_name").ToString() 'Dim imageFile As System.Web.UI.WebControls.Image = CType(e.Row.FindControl("imgPicture"), System.Web.UI.WebControls.Image) Dim lnkImage As System.Web.UI.WebControls.HyperLink = CType(e.Row.FindControl("lnkImage"), System.Web.UI.WebControls.HyperLink) Dim lblFileCategory As System.Web.UI.WebControls.Label = CType(e.Row.FindControl("lblFileCategory"), System.Web.UI.WebControls.Label) Dim imgview As System.Web.UI.WebControls.Image = CType(e.Row.FindControl("imgview"), System.Web.UI.WebControls.Image) _validPhotoFormats = _photoformat.Split(_seperator) For Each ext As String In _validPhotoFormats If ext = fileExt Then _isflag = True Exit For Else _isflag = False End If Next If _isflag = True Then imgview.ImageUrl = _thumbNailPath.ToString() + img_guid.ToString() + fileExt.ToString() Else imgview.ImageUrl = String.Empty imgview.Style.Add("display", "none") End If lnkImage.NavigateUrl = "~\wiki\ViewPicture.aspx?PictureId=" & img_guid.ToString() & "&Extn=" & fileExt.ToString() 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 ' imageFile.ImageUrl = _thumbNailPath & fileName + fileExt 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 status As String If rdoCurrentUse.Checked = True Then status = rdoCurrentUse.Text.ToString() ElseIf rdoProposedUse.Checked = True Then status = rdoProposedUse.Text.ToString() Else status = rdoHistoricalUse.Text.ToString() End If Dim wikiText As WikiText = New WikiText() 'License If chkLstLicense.Items.FindByText("Site licensed").Selected = True Then wikiText.Site = "1" Else wikiText.Site = "0" End If If chkLstLicense.Items.FindByText("Geographic licensing").Selected = True Then wikiText.Geo = "1" Else wikiText.Geo = "0" End If If chkLstLicense.Items.FindByText("Licensed by rule").Selected = True Then wikiText.Rule = "1" Else wikiText.Rule = "0" End If If chkLstLicense.Items.FindByText("Unlicensed").Selected = True Then wikiText.Undefined = "1" Else wikiText.Undefined = "0" End If 'wikiText.Head = heading 'wikiText.Description = description wikiText.Head = mainHeading wikiText.Description = descrp wikiText.Status = status.ToString() wikiText.Country = Multiselectdropdown2.tbmCountry 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 If editWikiId <> Nothing Then id = editWikiId wikiText.WikiTextId = id WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(id) ElseIf edit > 0 Then id = edit wikiText.WikiTextId = id WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(id) Else id = WikiTextBLL.InsertWikiText(wikiText, SessionWrapper.UserRowID, DateTime.Now.ToString()) 'Dim wikitextid As Integer 'Dim dt As DataTable 'dt = WikiTextBLL.WikiTextSelectMaxId() 'wikitextid = dt.Rows(0)("id").ToString() 'WikiHistory.CreateHistory(SessionWrapper.UserName, DateTime.Now.ToString(), wikitextid) 'End If 'WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("UserName"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserName, DateTime.Now.ToString(), edit) End If '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 Dim rank As String = fb.Rank Dim subCategory As String = fb.Subcategory 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim subCategory As String = bp.Subcategory Dim rank As String = bp.Rank 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.SubCategory = subCategory wikiFrequency.AllocationTable = table wikiFrequency.Rank = rank 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 Dim rank As String = f.Rank Dim subCategory As String = f.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = f.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(f.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(f.Bandwidth * 1000000) Else bandwidth = CLng(f.Bandwidth * 1000000000) End If 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = fp.Rank Dim subCategory As String = fp.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = fp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(fp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(fp.Bandwidth * 1000000) Else bandwidth = CLng(fp.Bandwidth * 1000000000) End If 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = nc.Rank Dim subCategory As String = nc.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = nc.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(nc.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(nc.Bandwidth * 1000000) Else bandwidth = CLng(nc.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim subCategory As String = cp.Subcategory Dim rank As String = cp.Rank Dim bandwidth As Long Dim bandWidthUnit As String = cp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(cp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(cp.Bandwidth * 1000000) Else bandwidth = CLng(cp.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim subCategory As String = bc.Subcategory Dim rank As String = bc.Rank 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = bcp.Rank Dim subCategory As String = bcp.Subcategory 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 If edit > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiNotesBLL.DeleteWikiNotesByTextId(temp_wiki_text_id) End If 'Feb 20,2012 WikiGraphicsBLL.DeleteWikiGraphicsByTextId(id) 'End WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id, id) 'WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, id) 'Insert notes WikiNotesBLL.InsertTempToOriginal(temp_wiki_text_id, id) Else If edit > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiNotesBLL.DeleteWikiNotesByTextId(update_wiki_text_id) End If 'Feb 20,2012 WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) 'End 'WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id, update_wiki_text_id) ' WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, update_wiki_text_id) 'Insert notes WikiNotesBLL.InsertTempToOriginal(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 'Feb 15,2012 'If CStr(ViewState("ExternalLinkId")) <> "" Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.updatelink(Convert.ToInt32(ViewState("ExternalLinkId")), txtTitle.Text, txtUrl.Text) ' 'WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' If edit > 0 Then ' BindExternalLinks(edit) ' ElseIf update_wiki_text_id > 0 Then ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' ElseIf id > 0 Then ' BindExternalLinksTempOrg(id, tempID) ' End If ' End If ' 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 ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' ViewState("ExternalLinkId") = "" 'Else ' 'Feb 15,2012 at 4pm ' If CStr(ViewState("Title")) <> "" And CStr(ViewState("Url")) <> "" Then ' Dim sa1 As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb1 As String() = ViewState("Url").ToString().Split("|"c) ' Dim recordnum1 As Integer = sa1.Length ' For j1 As Integer = 0 To recordnum1 - 2 ' Dim dr As DataRow = dtTempExternalLink.NewRow() ' dr("Title") = sa1(j1).ToString() ' dr("Url") = sb1(j1).ToString() ' dtTempExternalLink.Rows.Add(dr) ' Next ' ViewState("Title") = "" ' ViewState("Url") = "" ' For i1 As Integer = 0 To dtTempExternalLink.Rows.Count - 1 ' If dtTempExternalLink.Rows(i1)("AutoID").ToString = ViewState("TempExternalLinkId") Then ' ViewState("Title") += txtTitle.Text & "|" ' ViewState("Url") += txtUrl.Text & "|" ' Else ' ViewState("Title") += dtTempExternalLink.Rows(i1)("Title").ToString() & "|" ' ViewState("Url") += dtTempExternalLink.Rows(i1)("Url").ToString() & "|" ' End If ' Next ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 'End ' 'Feb 16,2012 ' 'End ' If edit > 0 Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, edit) ' WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinks(edit) ' End If ' 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 ' If tempID = 0 Then ' If Not String.IsNullOrEmpty(ViewState("Url")) Then ' Dim sa As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb As String() = ViewState("Url").ToString().Split("|"c) ' 'string[] sc = ViewState["Add2"].ToString().Split('|'); ' Dim recordnum As Integer = sa.Length ' For j As Integer = 0 To recordnum - 2 ' If (update_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' 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 ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(id, tempID) ' 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 ' End If ' If txtUrl.Text <> "" Then ' Try ' If (update_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(id, tempID) ' End If ' 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 ' If (update_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink(update_wiki_text_id, tempID) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' 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 ' Try ' WikiExternalLinkBLL.UpdateExternalLink(id, tempID) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(id, tempID) ' 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 ' End If 'End If 'ViewState("Title") = "" 'ViewState("Url") = "" 'ViewState("TempExternalLinkId") = "" 'If id > 0 Then ' WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(id, SessionWrapper.UserRowID) ' BindExternalLinks(id) 'Else ' WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(update_wiki_text_id, SessionWrapper.UserRowID) ' BindExternalLinks(update_wiki_text_id) '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 'If temp_wiki_text_id = 0 Then ' BindGridFromOrg(edit) 'Else ' BindGrid(temp_wiki_text_id) 'End If 'If edit > 0 Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(edit) ' 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 'ElseIf update_wiki_text_id > 0 Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(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 'ElseIf id > 0 Then ' Try ' If orgID = 0 And edit = 0 Then ' WikiExternalLinkBLL.CreateExternalLinkOrgtoTemp(id) ' BindExternalLinks(id) ' End If ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(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 ''BindGrid(temp_wiki_text_id) 'divExternal.Style.Add("display", "block") 'divTemp.Style.Add("display", "none") 'btnAddAnother.Style.Add("display", "block") 'btnUpdateLink.Style.Add("display", "none") 'Feb 16,2012 If CStr(ViewState("TempExternalLinkId")) <> "" Then Try WikiExternalLinkBLL.t_updatelink(Convert.ToInt32(ViewState("TempExternalLinkId")), txtTitle.Text, txtUrl.Text) txtUrl.Text = "" txtTitle.Text = "" 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 ViewState("TempExternalLinkId") = "" 't_BindExternalLinks(Session("exGuid")) btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") End If If edit > 0 Then If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 If CStr(Session("update_wiki_text_id")) <> "" Then 'click save button on firsttime origional id If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 ElseIf orgID > 0 Then 'After user click save and preview origional id If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(orgID, Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(orgID, Session("exGuid")) 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 ElseIf temp_wiki_text_id > 0 Then 'Temporary id End If End If t_BindExternalLinks(Session("exGuid")) divTemp.Style.Add("display", "block") ShowAlertMessage("Your entry has been saved.") 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 If temp_wiki_text_id = 0 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 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 Else Dim d_physical_file_name As String = gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Values(1).ToString() Try WikiGraphicsBLL.DeleteWikiGraphicsPhysicalfilename(d_physical_file_name) 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 wikiGraphicId As Integer = Convert.ToInt32(gvAddEditPicture.DataKeys(Convert.ToInt32(e.CommandArgument)).Values(0).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 End If ElseIf e.CommandName = "Download" Then If temp_wiki_text_id = 0 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 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 Else 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 ElseIf e.CommandName = "Edit" Then Dim physicalfilename As String = Convert.ToString(gvAddEditPicture.DataKeys(Convert.ToString(e.CommandArgument)).Values(1).ToString()) Response.Redirect("~\wiki\AddEditPicture.aspx?physicalfilename=" & physicalfilename) End If 'End If 'If Not String.IsNullOrEmpty(Session("update_wiki_text_id")) Then 'BindGridFromOrg(CInt(Session("update_wiki_text_id"))) 'Else If temp_wiki_text_id = 0 Then BindGridFromOrg(edit) Else BindGrid(temp_wiki_text_id) End If '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 wiki_text_id = Convert.ToInt32(Request.QueryString("WikiId")) Dim update_wiki_text_id As Integer = 0 Dim status As String If rdoCurrentUse.Checked = True Then status = rdoCurrentUse.Text.ToString() ElseIf rdoProposedUse.Checked = True Then status = rdoProposedUse.Text.ToString() Else status = rdoHistoricalUse.Text.ToString() End If Dim wikiText As WikiText = New WikiText() If chkLstLicense.Items.FindByText("Site licensed").Selected = True Then wikiText.Site = "1" Else wikiText.Site = "0" End If If chkLstLicense.Items.FindByText("Geographic licensing").Selected = True Then wikiText.Geo = "1" Else wikiText.Geo = "0" End If If chkLstLicense.Items.FindByText("Licensed by rule").Selected = True Then wikiText.Rule = "1" Else wikiText.Rule = "0" End If If chkLstLicense.Items.FindByText("Unlicensed").Selected = True Then wikiText.Undefined = "1" Else wikiText.Undefined = "0" End If 'wikiText.Head = heading 'wikiText.Description = description wikiText.Head = mainHeading wikiText.Description = descrp wikiText.Status = status wikiText.Country = Multiselectdropdown2.tbmCountry 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 If editWikiId <> Nothing Then id = editWikiId wikiText.WikiTextId = id WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(id) WikiFrequencyBLL.DeleteWikiFrequency(id) '' Dim dtGetWikiText As DataTable = WikiTextBLL.GetWikiText(id) '' WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("userrowid"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserRowID, DateTime.Now.ToString(), id) ElseIf edit > 0 Then id = edit wikiText.WikiTextId = id WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(id) '' Dim dtGetWikiText As DataTable = WikiTextBLL.GetWikiText(id) ''WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("userrowid"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserRowID, DateTime.Now.ToString(), id) Else id = WikiTextBLL.InsertWikiText(wikiText, SessionWrapper.UserRowID, DateTime.Now.ToString()) '' WikiHistory.CreateHistory(SessionWrapper.UserRowID, DateTime.Now.ToString(), id) ' Dim wikitextid As Integer 'Dim dt As DataTable 'dt = WikiTextBLL.WikiTextSelectMaxId() 'wikitextid = dt.Rows(0)("id").ToString() ' WikiHistory.CreateHistory(SessionWrapper.UserName, DateTime.Now.ToString(), wikitextid) End If 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 If edit > 0 Then WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(update_wiki_text_id) Else WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(update_wiki_text_id) '' WikiHistory.CreateHistory(SessionWrapper.UserRowID, DateTime.Now.ToString(), update_wiki_text_id) End If 'WikiTextBLL.UpdateWikiText(wikiText) 'WikiFrequencyBLL.DeleteWikiFrequency(update_wiki_text_id) 'Dim dtGetWikiText As DataTable = WikiTextBLL.GetWikiText(update_wiki_text_id) 'WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("userrowid"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserRowID, DateTime.Now.ToString(), 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 Dim rank As String = fb.Rank Dim subCategory As String = fb.Subcategory 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.Rank = rank wikiFrequency.SubCategory = subCategory '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 Dim subCategory As String = bp.Subcategory Dim rank As String = bp.Rank 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.Rank = rank wikiFrequency.SubCategory = subCategory 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 Dim rank As String = f.Rank Dim subCategory As String = f.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = f.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(f.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(f.Bandwidth * 1000000) Else bandwidth = CLng(f.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory wikiFrequency.Bandwidth = bandwidth 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 Dim subCategory As String = fp.Subcategory Dim rank As String = fp.Rank Dim bandwidth As Long Dim bandWidthUnit As String = fp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(fp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(fp.Bandwidth * 1000000) Else bandwidth = CLng(fp.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory wikiFrequency.Bandwidth = bandwidth 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 Dim rank As String = nc.Rank Dim bandwidth As Long Dim subCategory As String = nc.Subcategory Dim bandWidthUnit As String = nc.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(nc.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(nc.Bandwidth * 1000000) Else bandwidth = CLng(nc.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory wikiFrequency.Bandwidth = bandwidth 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 Dim rank As String = cp.Rank Dim subCategory As String = cp.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = cp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(cp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(cp.Bandwidth * 1000000) Else bandwidth = CLng(cp.Bandwidth * 1000000000) End If 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth 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 Dim rank As String = bc.Rank Dim subCategory As String = bc.Subcategory 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 subCategory As String = bcp.Subcategory 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 Dim rank As String = bcp.Rank 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory 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 If edit > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) 'insert history ' Dim dtGetWikiText As DataTable = WikiTextBLL.GetWikiText(edit) 'WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("userrowid"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserRowID, DateTime.Now.ToString(), edit) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiNotesBLL.DeleteWikiNotesByTextId(temp_wiki_text_id) 'WikiHistory.InsertHistory(SessionWrapper.UserRowID, DateTime.Now.ToString(), SessionWrapper.UserRowID, DateTime.Now.ToString(), edit) End If 'Feb 20,2012 WikiGraphicsBLL.DeleteWikiGraphicsByTextId(id) 'End 'WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) 'WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(id, SessionWrapper.UserRowID) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id, id) ' WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, id) WikiNotesBLL.InsertTempToOriginal(temp_wiki_text_id, id) Else If edit > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) 'Dim dtGetWikiText As DataTable = WikiTextBLL.GetWikiText(edit) 'WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("userrowid"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserRowID, DateTime.Now.ToString(), edit) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) WikiNotesBLL.DeleteWikiNotesByTextId(update_wiki_text_id) 'WikiHistory.InsertHistory(SessionWrapper.UserRowID, DateTime.Now.ToString(), SessionWrapper.UserRowID, DateTime.Now.ToString(), edit) End If 'Feb 20,2012 WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) 'End 'WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) 'WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(update_wiki_text_id, SessionWrapper.UserRowID) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id, update_wiki_text_id) 'WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, update_wiki_text_id) WikiNotesBLL.InsertTempToOriginal(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 CStr(ViewState("ExternalLinkId")) <> "" Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.updatelink(Convert.ToInt32(ViewState("ExternalLinkId")), txtTitle.Text, txtUrl.Text) ' 'WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' ViewState("ExternalLinkId") = "" 'Else ' 'Feb 15,2012 at 4pm ' If CStr(ViewState("Title")) <> "" And CStr(ViewState("Url")) <> "" And CStr(ViewState("TempExternalLinkId")) <> "" Then ' Dim sa1 As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb1 As String() = ViewState("Url").ToString().Split("|"c) ' Dim recordnum1 As Integer = sa1.Length ' For j1 As Integer = 0 To recordnum1 - 2 ' Dim dr As DataRow = dtTempExternalLink.NewRow() ' dr("Title") = sa1(j1).ToString() ' dr("Url") = sb1(j1).ToString() ' dtTempExternalLink.Rows.Add(dr) ' Next ' ViewState("Title") = "" ' ViewState("Url") = "" ' For i1 As Integer = 0 To dtTempExternalLink.Rows.Count - 1 ' If dtTempExternalLink.Rows(i1)("AutoID").ToString = ViewState("TempExternalLinkId") Then ' ViewState("Title") += txtTitle.Text & "|" ' ViewState("Url") += txtUrl.Text & "|" ' Else ' ViewState("Title") += dtTempExternalLink.Rows(i1)("Title").ToString() & "|" ' ViewState("Url") += dtTempExternalLink.Rows(i1)("Url").ToString() & "|" ' End If ' Next ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 'End ' If edit > 0 Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, edit) ' WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' BindExternalLinks(edit) ' End If ' 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 ' If tempID = 0 Then ' If Not String.IsNullOrEmpty(ViewState("Url")) Then ' Dim sa As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb As String() = ViewState("Url").ToString().Split("|"c) ' 'string[] sc = ViewState["Add2"].ToString().Split('|'); ' Dim recordnum As Integer = sa.Length ' For j As Integer = 0 To recordnum - 2 ' If (update_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' End If ' If txtUrl.Text <> "" Then ' Try ' If (update_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' If (update_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink(update_wiki_text_id, tempID) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' Try ' WikiExternalLinkBLL.UpdateExternalLink(id, tempID) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' End If 'End If 'If id > 0 Then ' WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(id, SessionWrapper.UserRowID) ' BindExternalLinks(id) 'Else ' WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(update_wiki_text_id, SessionWrapper.UserRowID) ' BindExternalLinks(update_wiki_text_id) 'End If 'If Convert.ToInt32(Request.QueryString("EditWikiId")) > 0 Then ' Try ' WikiGraphicsBLL.InsertWikiGraphicsTemp(Convert.ToInt32(Request.QueryString("EditWikiId")), 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 'If temp_wiki_text_id = 0 Then ' BindGridFromOrg(Convert.ToInt32(Session("editWikiId"))) 'Else ' BindGrid(temp_wiki_text_id) 'End If 'If edit > 0 Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(edit) ' 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 'ElseIf update_wiki_text_id > 0 Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(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 'ElseIf id > 0 Then ' Try ' If orgID = 0 And edit = 0 Then ' WikiExternalLinkBLL.CreateExternalLinkOrgtoTemp(id) ' End If ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(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 CStr(ViewState("TempExternalLinkId")) <> "" Then Try WikiExternalLinkBLL.t_updatelink(Convert.ToInt32(ViewState("TempExternalLinkId")), txtTitle.Text, txtUrl.Text) txtUrl.Text = "" txtTitle.Text = "" 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 ViewState("TempExternalLinkId") = "" 't_BindExternalLinks(Session("exGuid")) btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") End If If edit > 0 Then If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 If CStr(Session("update_wiki_text_id")) <> "" Then 'click save button on firsttime origional id If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 ElseIf orgID > 0 Then 'After user click save and preview origional id If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(orgID, Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(orgID, Session("exGuid")) 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 ElseIf temp_wiki_text_id > 0 Then 'Temporary id End If End If t_BindExternalLinks(Session("exGuid")) divTemp.Style.Add("display", "block") If Convert.ToInt32(Request.QueryString("EditWikiId")) > 0 Then 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 & "&EditWikiId=" & Request.QueryString("EditWikiId") & "&Edit=" & edit & "&Preview=1" & "&eguid=" & Session("exGuid")) 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 & "&EditWikiId=" & Request.QueryString("EditWikiId") & "&Edit=" & edit & "&Preview=1" & "&eguid=" & Session("exGuid")) End If Else 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 & "&EditWikiId=" & Request.QueryString("EditWikiId") & "&Edit=" & edit & "&eguid=" & Session("exGuid")) 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 & "&EditWikiId=" & Request.QueryString("EditWikiId") & "&Edit=" & edit & "&eguid=" & Session("exGuid")) End If 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") Session.Remove("exGuid") ViewState("TempExternalLinkId") = "" Response.Redirect("~/wiki/LoginOption.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 If ctl <> Nothing Then Dim c As Control = page.FindControl(ctl) If TypeOf c Is System.Web.UI.WebControls.Button Then control = c Exit For End If 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 If editWikiId > 0 Then nbCount = (Convert.ToInt16(ltlNbCount.Text)) Else nbCount = (Convert.ToInt16(ltlNbCount.Text)) + Convert.ToInt32(nbCount) End If '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 ctrl.Rank = frequency(i - 1).Rank ctrl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 ctrl.Rank = frequency(i - 1).Rank ctrl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then nbpCount = (Convert.ToInt16(ltlnbpCount.Text)) Else nbpCount = (Convert.ToInt16(ltlnbpCount.Text)) + Convert.ToInt32(nbpCount) End If 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 pairedFrequencyUserControl.Rank = frequency(i - 1).Rank pairedFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 pairedFrequencyUserControl.Rank = frequency(i - 1).Rank pairedFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then nfCount = (Convert.ToInt16(ltlnfCount.Text)) Else nfCount = (Convert.ToInt16(ltlnfCount.Text)) + Convert.ToInt32(nfCount) End If 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 specificFrequencyUserControl.Rank = frequency(i - 1).Rank specificFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then specificFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) specificFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 specificFrequencyUserControl.Rank = frequency(i - 1).Rank specificFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then specificFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) specificFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then nfpCount = (Convert.ToInt16(ltlnfpCount.Text)) Else nfpCount = (Convert.ToInt16(ltlnfpCount.Text)) + Convert.ToInt32(nfpCount) End If 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 pairedFrequencyUserControl.Rank = frequency(i - 1).Rank pairedFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then pairedFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) pairedFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 pairedFrequencyUserControl.Rank = frequency(i - 1).Rank pairedFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then pairedFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) pairedFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then ncCount = (Convert.ToInt16(ltlncCount.Text)) Else ncCount = (Convert.ToInt16(ltlncCount.Text)) + Convert.ToInt32(ncCount) End If 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 ChannelizedSpecificFrequencyUserControl.Rank = frequency(i - 1).Rank ChannelizedSpecificFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then ChannelizedSpecificFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) ChannelizedSpecificFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 ChannelizedSpecificFrequencyUserControl.Rank = frequency(i - 1).Rank ChannelizedSpecificFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then ChannelizedSpecificFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) ChannelizedSpecificFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then ncpCount = (Convert.ToInt16(ltlncpCount.Text)) Else ncpCount = (Convert.ToInt16(ltlncpCount.Text)) + Convert.ToInt32(ncpCount) End If 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 ChannelizedPairedFrequencyUserControl.Rank = frequency(i - 1).Rank ChannelizedPairedFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then ChannelizedPairedFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) ChannelizedPairedFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 ChannelizedPairedFrequencyUserControl.Rank = frequency(i - 1).Rank ChannelizedPairedFrequencyUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() If frequency(i - 1).Bandwidth <> 0.0 Then ChannelizedPairedFrequencyUserControl.BandWidthRadioFrequency = CDbl(frequency(i - 1).Bandwidth) ChannelizedPairedFrequencyUserControl.Bandwidth = CDbl(frequency(i - 1).Bandwidth) End If 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then nbcCount = (Convert.ToInt16(ltlnbcCount.Text)) Else nbcCount = (Convert.ToInt16(ltlnbcCount.Text)) + Convert.ToInt32(nbcCount) End If 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 ChannelizedFrequencyBandUserControl.Rank = frequency(i - 1).Rank ChannelizedFrequencyBandUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 ChannelizedFrequencyBandUserControl.Rank = frequency(i - 1).Rank ChannelizedFrequencyBandUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 pnlBandEntries.Controls.Count = 2 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 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 If editWikiId > 0 Then nbcpCount = (Convert.ToInt16(ltlnbcpCount.Text)) Else nbcpCount = (Convert.ToInt16(ltlnbcpCount.Text)) + Convert.ToInt32(nbcpCount) End If 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 ChannelizedPairedFrequencyBandUserControl.Rank = frequency(i - 1).Rank ChannelizedPairedFrequencyBandUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 ChannelizedPairedFrequencyBandUserControl.Rank = frequency(i - 1).Rank ChannelizedPairedFrequencyBandUserControl.Subcategory = frequency(i - 1).SubCategory.ToString() 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 Protected Sub t_BindExternalLinks(ByVal guid As String) Try gvTempExteranlLink.DataSource = WikiExternalLinkBLL.t_SelectWikiExterlink(guid) 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 gvTempExteranlLink.DataBind() End Sub Protected Sub o_BindExternalLinks(ByVal wikitextid As Integer) Try gvExternalLinks.DataSource = WikiExternalLinkBLL.o_SelectWikiExterlink(wikitextid) 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 gvExternalLinks.DataBind() End Sub Protected Sub btnAddAnother_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddAnother.Click Dim exGuid As String = Guid.NewGuid.ToString() If CStr(Session("exGuid")) = "" Then Session("exGuid") = Guid.NewGuid.ToString() End If If edit > 0 Then Else If CStr(Session("update_wiki_text_id")) <> "" Then 'click save button on firsttime origional id ElseIf orgID > 0 Then 'After user click save and preview origional id ElseIf temp_wiki_text_id > 0 Then 'Temporary id End If End If 'Insert external link into temp table Try If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" 't_BindExternalLinks(Session("exGuid")) End If 'divTemp.Style.Add("display", "block") 'divExternal.Style.Add("display", "none") 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 t_BindExternalLinks(Session("exGuid")) divTemp.Style.Add("display", "block") divExternal.Style.Add("display", "none") 'Dim edt As Integer = edit ' edit mode 'Dim update_id As Integer = Session("update_wiki_text_id") ' click save button generate id at firsttime 'Dim s As Integer = temp_wiki_text_id ' querystring from picture to new temporary id click addedit picture 'Dim og As Integer = orgID ' querystring from save 'ViewState("TempExternalLinkId") = "" 'ViewState("ExternalLinkId") = "" 'If edit > 0 Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, edit) ' 'WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' BindExternalLinks(edit) ' End If ' 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 ' If (tempID = 0) Then ' If txtUrl.Text <> "" Then ' If Convert.ToInt32(Session("update_wiki_text_id")) > 0 Then ' Try ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, Convert.ToInt32(Session("update_wiki_text_id"))) ' 'WikiExternalLinkBLL.UpdateExternalLink_issave(Convert.ToInt32(Session("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 ' divTemp.Style.Add("display", "none") ' divExternal.Style.Add("display", "block") ' 'gvTempExteranlLink.Visible = False ' 'gvExternalLinks.Visible = True ' BindExternalLinksTempOrg(Convert.ToInt32(Session("update_wiki_text_id")), tempID) ' Else ' ViewState("Title") += txtTitle.Text + "|" ' ViewState("Url") += txtUrl.Text + "|" ' CreateTable() ' If orgID > 0 Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, orgID) ' ViewState("Title") = "" ' ViewState("Url") = "" ' End If ' End If ' 'txtTitle.Text = "" ' 'txtUrl.Text = "" ' End If ' Else ' Try ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, tempID) ' 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 tempID = 0 Then ' divTemp.Style.Add("display", "block") ' divExternal.Style.Add("display", "none") ' 'gvTempExteranlLink.Visible = True ' 'gvExternalLinks.Visible = False ' If Convert.ToInt32(Session("update_wiki_text_id")) > 0 Then ' divTemp.Style.Add("display", "none") ' divExternal.Style.Add("display", "block") ' End If ' If orgID > 0 Then ' divTemp.Style.Add("display", "none") ' divExternal.Style.Add("display", "block") ' 'gvExternalLinks.Visible = True ' 'gvTempExteranlLink.Visible = False ' BindExternalLinksTempOrg(orgID, tempID) ' End If ' Else ' divTemp.Style.Add("display", "none") ' divExternal.Style.Add("display", "block") ' 'gvTempExteranlLink.Visible = False ' 'gvExternalLinks.Visible = True ' BindExternalLinksTempOrg(orgID, tempID) ' End If 'End If 'txtTitle.Text = "" 'txtUrl.Text = "" 'btnAddAnother.Style.Add("display", "block") 'btnUpdateLink.Style.Add("display", "none") ' btnAddAnother.Text = "Add another" End Sub Public Sub CreateTable() Dim sa As String() = ViewState("Title").ToString().Split("|"c) Dim sb As String() = ViewState("Url").ToString().Split("|"c) 'string[] sc = ViewState["Add2"].ToString().Split('|'); Dim recordnum As Integer = sa.Length For j As Integer = 0 To recordnum - 2 Dim dr As DataRow = dtTempExternalLink.NewRow() ' dr["AutoID"] = Convert.ToInt32(j+1); dr("Title") = sa(j).ToString() dr("Url") = sb(j).ToString() ' dr["Add2"] = sc[j].ToString(); dtTempExternalLink.Rows.Add(dr) Next gvTempExteranlLink.DataSource = dtTempExternalLink gvTempExteranlLink.DataBind() End Sub 'Protected Sub gvExternalLinks_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvExternalLinks.RowCommand ' If e.CommandName = "RemoveLink" Then ' Dim wikiExternalLinkId As Integer = Convert.ToInt32(gvExternalLinks.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ' 'check external link in edit mode , Feb 15,2012 ' If CStr(ViewState("ExternalLinkId")) <> "" Then ' If (Convert.ToInt32(ViewState("ExternalLinkId")) = wikiExternalLinkId) And CStr(ViewState("ExternalLinkId")) <> "" Then ' txtUrl.Text = "" ' txtTitle.Text = "" ' btnAddAnother.Style.Add("display", "block") ' btnUpdateLink.Style.Add("display", "none") ' End If ' End If ' 'end ' Try ' WikiExternalLinkBLL.DeleteExternalLinkby_textid(wikiExternalLinkId) ' 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 edit > 0 Then ' BindExternalLinks(edit) ' Try ' WikiExternalLinkBLL.InsertExternalLinkToOrg(edit) ' 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 ' If temp_wiki_text_id = 0 Then ' If orgID > 0 Then ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' 'divExternal.Style.Add("display", "none") ' 'divTemp.Style.Add("display", "") ' BindExternalLinksTempOrg(orgID, tempID) ' Try ' WikiExternalLinkBLL.InsertExternalLinkToOrg(orgID) ' 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 ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinks(Convert.ToInt32(Session("update_wiki_text_id"))) ' Try ' WikiExternalLinkBLL.InsertExternalLinkToOrg(Convert.ToInt32(Session("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 ' 'BindExternalLinks(edit) ' Else ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(orgID, tempID) ' If orgID > 0 Then ' Try ' WikiExternalLinkBLL.InsertExternalLinkToOrg(orgID) ' 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 ' End If ' 'Feb 14,2012 ' ElseIf e.CommandName = "EditLink" Then ' ViewState("ExternalLinkId") = "" ' 'btnAddAnother.Text = "Update" ' btnAddAnother.Style.Add("display", "none") ' btnUpdateLink.Style.Add("display", "block") ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' Dim wikiExternalLinkId As Integer = Convert.ToInt32(gvExternalLinks.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ' ViewState("ExternalLinkId") = wikiExternalLinkId ' Dim dtExternalLinkbyid As New DataTable ' Try ' dtExternalLinkbyid = WikiExternalLinkBLL.GetTempExternallink(wikiExternalLinkId) ' txtTitle.Text = dtExternalLinkbyid.Rows(0)("title").ToString() ' txtUrl.Text = dtExternalLinkbyid.Rows(0)("url").ToString() ' 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 Sub Protected Sub gvExternalLinks_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvExternalLinks.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then ' string add2 = DataBinder.Eval(e.Row.DataItem, "Add2").ToString(); Dim url As String = DataBinder.Eval(e.Row.DataItem, "url").ToString() Dim lblTitle As Label = DirectCast(e.Row.FindControl("Label1"), Label) Dim title As String = DataBinder.Eval(e.Row.DataItem, "title").ToString() If Not String.IsNullOrEmpty(title) Then lblTitle.Text = title & " (" & url & ")" Else lblTitle.Text = url End If End If End Sub Protected Sub gvTempExteranlLink_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvTempExteranlLink.RowCommand If e.CommandName.Equals("RemoveLink") Then Dim wikiExternalLinkId As Integer = Convert.ToInt32(gvTempExteranlLink.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) If CStr(ViewState("TempExternalLinkId")) = wikiExternalLinkId Then txtUrl.Text = "" txtTitle.Text = "" ViewState("TempExternalLinkId") = "" btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") End If Try WikiExternalLinkBLL.t_DeleteExternalLink(wikiExternalLinkId) If edit > 0 Then Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 If CStr(Session("update_wiki_text_id")) <> "" Then 'click save button on firsttime origional id Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 ElseIf orgID > 0 Then 'After user click save and preview origional id WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If End If 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 t_BindExternalLinks(Session("exGuid")) divTemp.Style.Add("display", "block") divExternal.Style.Add("display", "none") ElseIf e.CommandName = "EditLink" Then btnAddAnother.Style.Add("display", "none") btnUpdateLink.Style.Add("display", "block") ViewState("TempExternalLinkId") = "" Dim wikiExternalLinkId As Integer = Convert.ToInt32(gvTempExteranlLink.DataKeys(Convert.ToInt32(e.CommandArgument)).Value.ToString()) ViewState("TempExternalLinkId") = wikiExternalLinkId Dim dtTempExternalLink As New DataTable Try dtTempExternalLink = WikiExternalLinkBLL.t_GetExternallink_id(wikiExternalLinkId) Catch ex As Exception If ex.InnerException IsNot Nothing Then Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) Else Logger.WriteToErrorLog(ex.Message) End If End Try txtTitle.Text = dtTempExternalLink.Rows(0)("title").ToString() txtUrl.Text = dtTempExternalLink.Rows(0)("url").ToString() End If End Sub Protected Sub gvTempExteranlLink_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvTempExteranlLink.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then ' string add2 = DataBinder.Eval(e.Row.DataItem, "Add2").ToString(); Dim url As String = DataBinder.Eval(e.Row.DataItem, "Url").ToString() Dim lblTitle As Label = DirectCast(e.Row.FindControl("Label1"), Label) Dim title As String = DataBinder.Eval(e.Row.DataItem, "Title").ToString() If Not String.IsNullOrEmpty(title) Then lblTitle.Text = title & " (" & url & ")" Else lblTitle.Text = url End If End If End Sub Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDelete.Click If edit > 0 Then Try WikiFrequencyBLL.DeleteWikiFrequency(edit) WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiExternalLinkBLL.DeleteExternalLink(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) WikiTextBLL.DeleteWikiText(edit) Catch ex As Exception If ex.InnerException IsNot Nothing Then Logger.WriteToErrorLog(ex.Message, ex.InnerException.Message) Else Logger.WriteToErrorLog(ex.Message) End If End Try Response.Redirect("~/wiki/Start.aspx") End If End Sub Protected Sub lnkNotes_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkNotes.Click ltlValues.Text = "" 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 status As String If rdoCurrentUse.Checked = True Then status = rdoCurrentUse.Text.ToString() ElseIf rdoProposedUse.Checked = True Then status = rdoProposedUse.Text.ToString() Else status = rdoHistoricalUse.Text.ToString() End If Dim heading As String = mainHeading Dim description As String = descrp Dim wikiText As WikiText = New WikiText() If chkLstLicense.Items.FindByText("Site licensed").Selected = True Then wikiText.Site = "1" Else wikiText.Site = "0" End If If chkLstLicense.Items.FindByText("Geographic licensing").Selected = True Then wikiText.Geo = "1" Else wikiText.Geo = "0" End If If chkLstLicense.Items.FindByText("Licensed by rule").Selected = True Then wikiText.Rule = "1" Else wikiText.Rule = "0" End If If chkLstLicense.Items.FindByText("Unlicensed").Selected = True Then wikiText.Undefined = "1" Else wikiText.Undefined = "0" End If wikiText.Head = heading wikiText.Description = description wikiText.Country = Multiselectdropdown2.tbmCountry Dim s As String = Multiselectdropdown2.SelectedOptionsText wikiText.Status = status.ToString() 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 rank As String = fb.Rank 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 Dim subCategory As String = fb.Subcategory 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory 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 Dim rank As String = bp.Rank Dim subCategory As String = bp.Subcategory 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.Rank = rank wikiFrequency.SubCategory = subCategory 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 Dim rank As String = f.Rank Dim subCategory As String = f.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = f.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(f.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(f.Bandwidth * 1000000) Else bandwidth = CLng(f.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim rank As String = fp.Rank Dim subCategory As String = fp.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = fp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(fp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(fp.Bandwidth * 1000000) Else bandwidth = CLng(fp.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim rank As String = nc.Rank Dim subCategory As String = nc.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = nc.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(nc.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(nc.Bandwidth * 1000000) Else bandwidth = CLng(nc.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim rank As String = cp.Rank Dim subCategory As String = cp.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = cp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(cp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(cp.Bandwidth * 1000000) Else bandwidth = CLng(cp.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory wikiFrequency.Bandwidth = bandwidth 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 Dim rank As String = bc.Rank Dim subCategory As String = bc.Subcategory 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory 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 Dim rank As String = bcp.Rank Dim subCategory As String = bcp.Subcategory 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 wikiFrequency.Rank = rank wikiFrequency.SubCategory = subCategory 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 Not String.IsNullOrEmpty(Session("editWikiId")) Then ' Try ' WikiGraphicsBLL.InsertWikiGraphicsTemp(Convert.ToInt32(Session("editWikiId")), 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 Not IsPostBack Then If Convert.ToInt32(Request.QueryString("EditWikiId")) > 0 Then Try 'WikiNotesBLL.TempDeleteWikiNotesByTextId(id) WikiNotesBLL.InsertWikiNotesTemp(Convert.ToInt32(Request.QueryString("EditWikiId")), id) WikiGraphicsBLL.InsertWikiGraphicsTemp(Convert.ToInt32(Request.QueryString("EditWikiId")), 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 ElseIf Convert.ToInt32(Request.QueryString("Preview")) = 1 Then Try 'WikiNotesBLL.TempDeleteWikiNotesByTextId(id) WikiNotesBLL.InsertWikiNotesTemp(edit, id) WikiGraphicsBLL.InsertWikiGraphicsTemp(edit, 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 edit > 0 Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' If tempID = 0 Then ' If Not String.IsNullOrEmpty(ViewState("Url")) Then ' Dim sa As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb As String() = ViewState("Url").ToString().Split("|"c) ' 'string[] sc = ViewState["Add2"].ToString().Split('|'); ' Dim recordnum As Integer = sa.Length ' For j As Integer = 0 To recordnum - 2 ' If (temp_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), temp_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, temp_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' End If ' If txtUrl.Text <> "" Then ' Try ' If (temp_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, temp_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' If txtUrl.Text <> "" Then ' Try ' If (temp_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, temp_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' 'ToDo: ' End If 'End If 'End If If CStr(ViewState("TempExternalLinkId")) <> "" Then Try WikiExternalLinkBLL.t_updatelink(Convert.ToInt32(ViewState("TempExternalLinkId")), txtTitle.Text, txtUrl.Text) txtUrl.Text = "" txtTitle.Text = "" 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 ViewState("TempExternalLinkId") = "" 't_BindExternalLinks(Session("exGuid")) btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") End If 'End If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Else Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If End If divTemp.Style.Add("display", "block") t_BindExternalLinks(Session("exGuid")) If orgID = 0 Then orgID = Convert.ToInt32(Session("update_wiki_text_id")) End If If (id > 0) Then Response.Redirect("~/wiki/Notes.aspx?TempWikiId=" + id.ToString() & "&nbCount=" & nbCount & "&nbpCount=" & nbpCount & "&nfCount=" & nfCount & "&nfpCount=" & nfpCount & "&ncCount=" & ncCount & "&ncpCount=" & ncpCount & "&nbcCount=" & nbcCount & "&nbcpCount=" & nbcpCount & "&EditWikiId=" & edit & "&Edit=" & edit & "&OrgId=" & orgID & "&eguid=" & Session("exGuid")) ElseIf (temp_wiki_text_id > 0) Then Response.Redirect("~/wiki/Notes.aspx?TempWikiId=" + temp_wiki_text_id.ToString() & "&nbCount=" & nbCount & "&nbpCount=" & nbpCount & "&nfCount=" & nfCount & "&nfpCount=" & nfpCount & "&ncCount=" & ncCount & "&ncpCount=" & ncpCount & "&nbcCount=" & nbcCount & "&nbcpCount=" & nbcpCount & "&EditWikiId=" & edit & "&Edit=" & edit & "&OrgId=" & orgID & "&eguid=" & Session("exGuid")) End If 'Else ' Response.Redirect("~/wiki/AddEditPicture.aspx?WikiId=" + wiki_text_id.ToString()) 'End If End Sub Protected Sub lnkNewEntry_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkNewEntry.Click Response.Redirect("~/wiki/Start.aspx") End Sub Public Shared Sub ShowAlertMessage(ByVal [error] As String) Dim page As Page = TryCast(HttpContext.Current.Handler, Page) If page IsNot Nothing Then [error] = [error].Replace("'", "'") ScriptManager.RegisterStartupScript(page, page.[GetType](), "err_msg", "alert('" & [error] & "');", True) End If End Sub Protected Sub lnkEdit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkEdit.Click If edit > 0 Then If Not String.IsNullOrEmpty(Session("update_wiki_text_id")) Then Dim dtGetWikiText As DataTable = WikiTextBLL.GetWikiText(edit) Dim dtHistory As DataTable = WikiHistory.GetHistoryList(edit) If dtHistory.Rows.Count > 0 Then WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("UserName"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserName, DateTime.Now.ToString(), edit) Else Dim dtWikiText As DataTable = WikiTextBLL.GetWikiText(edit) WikiHistory.CreateHistory(dtWikiText.Rows(0)("UserName").ToString(), Convert.ToDateTime(dtWikiText.Rows(0)("datetime")), edit) WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("UserName"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserName, DateTime.Now.ToString(), edit) End If Else Dim dtHistory As DataTable = WikiHistory.GetHistoryList(edit) If dtHistory.Rows.Count = 0 Then Dim dtWikiText As DataTable = WikiTextBLL.GetWikiText(edit) WikiHistory.CreateHistory(dtWikiText.Rows(0)("UserName").ToString(), Convert.ToDateTime(dtWikiText.Rows(0)("datetime")), edit) End If End If Response.Redirect("~/wiki/History.aspx?WikiId=" & edit) Else If Not String.IsNullOrEmpty(Session("update_wiki_text_id")) Then WikiHistory.CreateHistory(SessionWrapper.UserName, DateTime.Now.ToString(), Convert.ToInt32(Session("update_wiki_text_id"))) End If Response.Redirect("~/wiki/History.aspx?WikiId=" & Session("update_wiki_text_id")) End If 'Response.Redirect("~/wiki/Edit.aspx") End Sub Protected Sub btnSaveDone_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSaveDone.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 status As String If rdoCurrentUse.Checked = True Then status = rdoCurrentUse.Text.ToString() ElseIf rdoProposedUse.Checked = True Then status = rdoProposedUse.Text.ToString() Else status = rdoHistoricalUse.Text.ToString() End If Dim wikiText As WikiText = New WikiText() 'License If chkLstLicense.Items.FindByText("Site licensed").Selected = True Then wikiText.Site = "1" Else wikiText.Site = "0" End If If chkLstLicense.Items.FindByText("Geographic licensing").Selected = True Then wikiText.Geo = "1" Else wikiText.Geo = "0" End If If chkLstLicense.Items.FindByText("Licensed by rule").Selected = True Then wikiText.Rule = "1" Else wikiText.Rule = "0" End If If chkLstLicense.Items.FindByText("Unlicensed").Selected = True Then wikiText.Undefined = "1" Else wikiText.Undefined = "0" End If 'wikiText.Head = heading 'wikiText.Description = description wikiText.Head = mainHeading wikiText.Description = descrp wikiText.Status = status.ToString() wikiText.Country = Multiselectdropdown2.tbmCountry 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 If editWikiId <> Nothing Then id = editWikiId wikiText.WikiTextId = id WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(id) ElseIf edit > 0 Then id = edit wikiText.WikiTextId = id WikiTextBLL.UpdateWikiText(wikiText) WikiFrequencyBLL.DeleteWikiFrequency(id) Else id = WikiTextBLL.InsertWikiText(wikiText, SessionWrapper.UserRowID, DateTime.Now.ToString()) ' Dim wikitextid As Integer 'Dim dt As DataTable 'dt = WikiTextBLL.WikiTextSelectMaxId() 'wikitextid = dt.Rows(0)("id").ToString() 'WikiHistory.CreateHistory(SessionWrapper.UserName, DateTime.Now.ToString(), wikitextid) 'End If 'WikiHistory.InsertHistory(dtGetWikiText.Rows(0)("UserName"), dtGetWikiText.Rows(0)("datetime"), SessionWrapper.UserName, DateTime.Now.ToString(), edit) End If '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 Dim rank As String = fb.Rank Dim subCategory As String = fb.Subcategory 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim subCategory As String = bp.Subcategory Dim rank As String = bp.Rank 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.SubCategory = subCategory wikiFrequency.AllocationTable = table wikiFrequency.Rank = rank 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 Dim rank As String = f.Rank Dim subCategory As String = f.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = f.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(f.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(f.Bandwidth * 1000000) Else bandwidth = CLng(f.Bandwidth * 1000000000) End If 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = fp.Rank Dim subCategory As String = fp.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = fp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(fp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(fp.Bandwidth * 1000000) Else bandwidth = CLng(fp.Bandwidth * 1000000000) End If 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 wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = nc.Rank Dim subCategory As String = nc.Subcategory Dim bandwidth As Long Dim bandWidthUnit As String = nc.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(nc.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(nc.Bandwidth * 1000000) Else bandwidth = CLng(nc.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim subCategory As String = cp.Subcategory Dim rank As String = cp.Rank Dim bandwidth As Long Dim bandWidthUnit As String = cp.BandWidthRadioFrequency If (bandWidthUnit = "kHz") Then bandwidth = CLng(cp.Bandwidth * 1000) ElseIf (bandWidthUnit = "MHz") Then bandwidth = CLng(cp.Bandwidth * 1000000) Else bandwidth = CLng(cp.Bandwidth * 1000000000) End If 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 wikiFrequency.Rank = rank wikiFrequency.Bandwidth = bandwidth wikiFrequency.SubCategory = subCategory 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 Dim subCategory As String = bc.Subcategory Dim rank As String = bc.Rank 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 Dim rank As String = bcp.Rank Dim subCategory As String = bcp.Subcategory 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 wikiFrequency.SubCategory = subCategory wikiFrequency.Rank = rank 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 If edit > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiNotesBLL.DeleteWikiNotesByTextId(temp_wiki_text_id) End If WikiGraphicsBLL.DeleteWikiGraphicsByTextId(id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id, id) 'WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, id) WikiNotesBLL.InsertTempToOriginal(temp_wiki_text_id, id) Else If edit > 0 Then WikiGraphicsBLL.DeleteWikiGraphicsByTextId(edit) WikiNotesBLL.DeleteWikiNotesByTextId(edit) Else WikiGraphicsBLL.DeleteWikiGraphicsByTextId(temp_wiki_text_id) WikiNotesBLL.DeleteWikiNotesByTextId(update_wiki_text_id) End If WikiGraphicsBLL.DeleteWikiGraphicsByTextId(update_wiki_text_id) WikiGraphicsBLL.InsertWikiGraphicsOriginal(temp_wiki_text_id, update_wiki_text_id) 'WikiGraphicsBLL.UpdateWikiGraphics(temp_wiki_text_id, update_wiki_text_id) WikiNotesBLL.InsertTempToOriginal(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 'Feb 15,2012 'If CStr(ViewState("ExternalLinkId")) <> "" Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.updatelink(Convert.ToInt32(ViewState("ExternalLinkId")), txtTitle.Text, txtUrl.Text) ' 'WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 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 ' ViewState("ExternalLinkId") = "" 'Else ' 'Feb 15,2012 at 4pm ' If CStr(ViewState("Title")) <> "" And CStr(ViewState("Url")) <> "" And CStr(ViewState("TempExternalLinkId")) <> "" Then ' Dim sa1 As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb1 As String() = ViewState("Url").ToString().Split("|"c) ' Dim recordnum1 As Integer = sa1.Length ' For j1 As Integer = 0 To recordnum1 - 2 ' Dim dr As DataRow = dtTempExternalLink.NewRow() ' dr("Title") = sa1(j1).ToString() ' dr("Url") = sb1(j1).ToString() ' dtTempExternalLink.Rows.Add(dr) ' Next ' ViewState("Title") = "" ' ViewState("Url") = "" ' For i1 As Integer = 0 To dtTempExternalLink.Rows.Count - 1 ' If dtTempExternalLink.Rows(i1)("AutoID").ToString = ViewState("TempExternalLinkId") Then ' ViewState("Title") += txtTitle.Text & "|" ' ViewState("Url") += txtUrl.Text & "|" ' Else ' ViewState("Title") += dtTempExternalLink.Rows(i1)("Title").ToString() & "|" ' ViewState("Url") += dtTempExternalLink.Rows(i1)("Url").ToString() & "|" ' End If ' Next ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' 'End ' If edit > 0 Then ' Try ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, edit) ' WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' txtUrl.Text = "" ' txtTitle.Text = "" ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinks(edit) ' End If ' 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 ' If tempID = 0 Then ' If Not String.IsNullOrEmpty(ViewState("Url")) Then ' Dim sa As String() = ViewState("Title").ToString().Split("|"c) ' Dim sb As String() = ViewState("Url").ToString().Split("|"c) ' 'string[] sc = ViewState["Add2"].ToString().Split('|'); ' Dim recordnum As Integer = sa.Length ' For j As Integer = 0 To recordnum - 2 ' If (update_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' 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 ' Try ' WikiExternalLinkBLL.InsertExternalLink(sa(j), sb(j), id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(id, tempID) ' 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 ' End If ' If txtUrl.Text <> "" Then ' Try ' If (update_wiki_text_id > 0) Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' Else ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(id, tempID) ' End If ' 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 ' If (update_wiki_text_id > 0) Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink(update_wiki_text_id, tempID) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, update_wiki_text_id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(update_wiki_text_id, tempID) ' 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 ' Try ' WikiExternalLinkBLL.UpdateExternalLink(id, tempID) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' If txtUrl.Text <> "" Then ' WikiExternalLinkBLL.InsertExternalLink(txtTitle.Text, txtUrl.Text, id) ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' txtUrl.Text = "" ' txtTitle.Text = "" ' End If ' divExternal.Style.Add("display", "block") ' divTemp.Style.Add("display", "none") ' BindExternalLinksTempOrg(id, tempID) ' 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 ' End If 'End If 'ViewState("Title") = "" 'ViewState("Url") = "" 'If id > 0 Then ' WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(id, SessionWrapper.UserRowID) ' BindExternalLinks(id) 'Else ' WikiExternalLinkBLL.UpdateExternalLinkByUserRowId(update_wiki_text_id, SessionWrapper.UserRowID) ' BindExternalLinks(update_wiki_text_id) '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 'If temp_wiki_text_id = 0 Then ' BindGridFromOrg(edit) 'Else ' BindGrid(temp_wiki_text_id) 'End If 'If edit > 0 Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink_issave(edit) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(edit) ' 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 'ElseIf update_wiki_text_id > 0 Then ' Try ' WikiExternalLinkBLL.UpdateExternalLink_issave(update_wiki_text_id) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(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 'ElseIf id > 0 Then ' Try ' If orgID = 0 And edit = 0 Then ' WikiExternalLinkBLL.CreateExternalLinkOrgtoTemp(id) ' End If ' WikiExternalLinkBLL.UpdateExternalLink_issave(id) ' WikiExternalLinkBLL.InsertExternalLinkToOrg(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 'BindGrid(temp_wiki_text_id) 'Feb 16,2012 If CStr(ViewState("TempExternalLinkId")) <> "" Then Try WikiExternalLinkBLL.t_updatelink(Convert.ToInt32(ViewState("TempExternalLinkId")), txtTitle.Text, txtUrl.Text) txtUrl.Text = "" txtTitle.Text = "" 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 ViewState("TempExternalLinkId") = "" 't_BindExternalLinks(Session("exGuid")) btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") End If 'End If edit > 0 Then If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(edit, Session("exGuid")) 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 If CStr(Session("update_wiki_text_id")) <> "" Then 'click save button on firsttime origional id If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(Convert.ToInt32(Session("update_wiki_text_id")), Session("exGuid")) 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 ElseIf orgID > 0 Then 'After user click save and preview origional id If CStr(Session("exGuid")) <> "" Or Not String.IsNullOrEmpty(eguid) Then If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(orgID, Session("exGuid")) 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 Session("exGuid") = Guid.NewGuid.ToString() If txtUrl.Text <> "" Then WikiExternalLinkBLL.T_InsertExternalLink(txtTitle.Text, txtUrl.Text, Session("exGuid")) txtUrl.Text = "" txtTitle.Text = "" End If Try WikiExternalLinkBLL.InsertExternalLink_t_to_o(orgID, Session("exGuid")) 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 ElseIf temp_wiki_text_id > 0 Then 'Temporary id End If End If 'ShowAlertMessage("Your entry has been saved.") Response.Redirect("~/wiki/LoginOption.aspx") End Sub Sub HandleCheckSelectAll(ByVal sender As Object, ByVal e As EventArgs) Dim dtCountry As New DataTable Try dtCountry = WikiCountry.GetCountryList() 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 dr As DataRow = Nothing dtCountry.Columns.AddRange(New DataColumn() {New DataColumn("selected")}) Dim count = dtCountry.Rows.Count Dim sbCountry As New StringBuilder For i As Integer = 0 To count - 1 If Multiselectdropdown2.checkSelectAll = True Then dtCountry.Rows(i)("selected") = True sbCountry.Append(dtCountry.Rows(i)("country") & ", ") Multiselectdropdown2.tbmCountry = "Worldwide" 'Multiselectdropdown2.Attributes .Add ("class",disabled" 'Multiselectdropdown2.tbmCountry = sbCountry.ToString() Else If dtCountry.Rows(i)("country") = "United States" Then dtCountry.Rows(i)("selected") = True Multiselectdropdown2.tbmCountry = "United States, " Else dtCountry.Rows(i)("selected") = False End If End If Next Me.Multiselectdropdown2.DataSource = dtCountry Me.Multiselectdropdown2.DataTextField = "country" Me.Multiselectdropdown2.DataValueField = "country" Me.Multiselectdropdown2.AutoPostBack = True Me.Multiselectdropdown2.DataBind() End Sub Protected Sub btnUpdateLink_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpdateLink.Click btnAddAnother.Style.Add("display", "block") btnUpdateLink.Style.Add("display", "none") Try WikiExternalLinkBLL.t_updatelink(Convert.ToInt32(ViewState("TempExternalLinkId")), txtTitle.Text, txtUrl.Text) txtUrl.Text = "" txtTitle.Text = "" 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 ViewState("TempExternalLinkId") = "" t_BindExternalLinks(Session("exGuid")) divTemp.Style.Add("display", "block") divExternal.Style.Add("display", "none") End Sub 'Protected Sub btnCancelLink_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancelLink.Click ' btnAddAnother.Style.Add("display", "block") ' btn() 'End Sub End Class