locked
Typed Dataset in asp.net RRS feed

  • Question

  • User-2074037068 posted

    I am getting the following error .How Can Resolve it.

    All are Typed Dataset inside the DataLayer of App_Code. In app_Code itself, i have .vb Class file also availbale.

    Error    4    Type 'SurveyDataSet.SurveyQuestionsDataTable' is not defined.    C:\Inetpub\wwwroot\Trasol\App_Code\Survey.vb    49    29    C:\...\Trasol\

    Error    35    Type 'ProfileCommon' is not defined.    C:\Inetpub\wwwroot\Trasol\App_Code\User.vb    155    36    C:\...\Trasol\

    Error    41    Type 'OrgChartDataSet.FullOrgChartRow' is not defined.    C:\Inetpub\wwwroot\Trasol\App_Code\User.vb    284    36    C:\...\Trasol\

    -----------------

    vb.net class file

    Imports Microsoft.VisualBasic

    Namespace EDTS

        Public Class Survey

            Private Const TextBoxIndeicator As String = "#"

            Public Enum RequestSurveyAnswerPages As Integer

                FromLoginPop = 1

                FromSurveyAdmin = 2

                FromSurveyDesktop = 0 'this is the default if not set

            End Enum

            Public Shared Property RequestSurveyAnswerPage() As RequestSurveyAnswerPages

                Get

                    Return HttpContext.Current.Session("RequestSurveyAnswerPage")

                End Get

                Set(ByVal value As RequestSurveyAnswerPages)

                    HttpContext.Current.Session("RequestSurveyAnswerPage") = value

                End Set

            End Property

            Public Structure SurveyResult

                Dim X As Integer

                Dim Y As Integer

                Dim Value As Integer

                Dim Remarks As String

            End Structure

            Public Enum QuestionTypes

                YesNo = 4708  '4707     -1    نعم / لا    Yes/No           False False False             0     NULL  NULL

                SelectOne = 4709 '      4707  -1    اختيار واحد لكل سؤال    Select One        False False False            0     NULL  NULL

                SelectMany = 4710   '4707     -1    اكثر من اختيار لكل سؤال Select Many       False False False            0     NULL  NULL

                MatrixSelectOne = 4711    '4707     -1    جدول اختيارات اختيار واحد     Matrix Select One       False False False            0     NULL  NULL

                MatrixSelectMany = 4712   '4707     -1    جدول اختيارات اكثر من اختيار  Matrix Select Many      False False False            0     NULL  NULL

                MatrixSelectfromList = 4713   '4707 -1    جدول اختيارات اختيار من قائمة Matrix Select from List       False False False            0     NULL  NULL

                TextForEachLine = 8 '5151     4707  -1    مربع نص لكل سؤال  Text for each line           0     0     0                0     NULL  NULL

                WtihNoOptions = 9 ' 5152      4707  -1    بدون اسئلة  Wtih no options        0      0     0                0     NULL  NULL

     

            End Enum

            Public Properties As SurveyDataSet.SurveyQuestionsRow

            Public SurveyQuestionId As Integer

            Public Sub New(ByVal SurveyQuestionId As Integer)

                Me.SurveyQuestionId = SurveyQuestionId

                Using DT As New SurveyDataSet.SurveyQuestionsDataTable

                    Using adp As New SurveyDataSetTableAdapters.SurveyQuestionsTableAdapter

                        adp.Fill(DT, SurveyQuestionId)

                    End Using

                    Properties = DT(0)

                End Using

            End Sub

            Public ReadOnly Property Rows() As String()

                Get

                    Dim Result As New List(Of String)

                    If Properties.WithTextbox Then

                        Result.Add("مربع نص")

                    End If

                    Select Case QuestionType

                        Case QuestionTypes.YesNo

                            Result.Add("نعم")

                            Result.Add("لا")

                            ' Return New String() {"نعم", "لا"}

                        Case Else

                            Result.AddRange(Split(Properties.Rows, ","))

                    End Select

                    Return Result.ToArray

                End Get

            End Property

            Public ReadOnly Property Columns() As String()

                Get

                    Return Split(Properties.Columns, ",")

                End Get

            End Property

            Public ReadOnly Property ColumnOptions(ByVal Index As Integer) As String()

                Get

                    Dim opt As String() = Split(Properties.Options, ",,")

                    Return Split(opt(Index), ",")

                End Get

            End Property

            Public Property QuestionType() As QuestionTypes

                Get

                    Return Properties.QuestionTypelookupId

                End Get

                Set(ByVal value As QuestionTypes)

                    Properties.QuestionTypelookupId = value

                End Set

            End Property

     

            Public Function GetResultDataTable(ByVal SurveyId As Integer) As Data.DataTable

                'get answer informatoin

                Dim AnswersDataTable As SurveyDataSet.Survey_GetAnswersDataTable

                Dim AnswersView As Data.DataView

                Using adp As New SurveyDataSetTableAdapters.Survey_GetAnswersTableAdapter

                    AnswersDataTable = adp.GetData(SurveyId)

                    AnswersView = New Data.DataView(AnswersDataTable, "SurveyQuestionId=" + SurveyQuestionId.ToString, "", Data.DataViewRowState.CurrentRows)

                End Using

     

                Dim DisplayDataTable As New Data.DataTable

     

                Select Case QuestionType

                    Case QuestionTypes.SelectOne, QuestionTypes.YesNo, QuestionTypes.SelectMany, QuestionTypes.TextForEachLine

                        'define data structure

                        DisplayDataTable.Columns.Add(New Data.DataColumn("Selection", GetType(String)))

                        DisplayDataTable.Columns.Add(New Data.DataColumn("Number", GetType(Integer)))

                        DisplayDataTable.Columns.Add(New Data.DataColumn("Percent", GetType(Double)))

     

     

     

                        'add  data 

                        Dim Index As Integer = 1

                        'add location for text box count

                        If Properties.WithTextbox Then Index = 0

     

                        Dim Data As New List(Of Object)

                        For Each R As String In Me.Rows

     

     

                            Dim ValueRow() As Data.DataRow = AnswersDataTable.Select( _

                                String.Format("SurveyQuestionId={0} and y={1}", SurveyQuestionId, Index))

     

                            If ValueRow.Length = 1 Then

                                DisplayDataTable.Rows.Add(New Object() {R, ValueRow(0).Item("countY"), 0.0})

                            Else

                                DisplayDataTable.Rows.Add(New Object() {R, 0, 0.0})

                            End If

                            Index += 1

                        Next

     

                        'fix percentage

                        Dim Total As Integer = DisplayDataTable.Compute("sum(Number)", "")

                        For Each row As Data.DataRow In DisplayDataTable.Rows

                            row.Item("Percent") = row.Item("Number") / Total

                        Next

                    Case QuestionTypes.MatrixSelectMany, QuestionTypes.MatrixSelectOne

                        DisplayDataTable.Columns.Add(New Data.DataColumn("Selection", GetType(String)))

                        DisplayDataTable.Columns.Add(New Data.DataColumn("Number", GetType(Integer)))

                        For Each col As String In Me.Columns

                            DisplayDataTable.Columns.Add(New Data.DataColumn(col, GetType(Integer)))

                        Next

                        Dim TotalNumberOfColumns As Integer = Me.Columns.Count + 2

     

                        Dim RowIndex As Integer = 1

                        For Each r As String In Me.Rows

                            Dim NewValues = New List(Of Object)

                            If r <> "مربع نص" Then

                                NewValues.Add(r)

     

                                Dim TotalY As Integer = 0

                                For X As Integer = 1 To Me.Columns.Count

                                    'read data

                                    Dim ValueRow() As Data.DataRow = AnswersDataTable.Select( _

                                        String.Format("SurveyQuestionId={0} and y={1} and x={2}", SurveyQuestionId, RowIndex, X))

     

                                    If ValueRow.Length = 1 Then

                                        NewValues.Add(ValueRow(0).Item("countX"))

                                        TotalY += ValueRow(0).Item("countX")

                                    Else

                                        NewValues.Add(0)

                                    End If

                                Next

                                NewValues.Insert(1, TotalY)

                                DisplayDataTable.Rows.Add(NewValues.ToArray)

                            End If

                            RowIndex += 1

     

                        Next

     

     

                End Select

     

                Return DisplayDataTable

            End Function

            Public Shared Function GetDisplayedCheck(ByVal Value As String) As Boolean

                Return Value.IndexOf(TextBoxIndeicator) > 0

            End Function

            Public Shared Function GetDisplayedQuestion(ByVal Value As String) As String

                Return Value.Replace(TextBoxIndeicator, "")

            End Function

     

            Public Shared ReadOnly Property SurveyQuestionDependencies(ByVal SurveyQuestionId As Integer) As SurveyDataSet.SurveyQuestionDependenciesDataTable

                Get

                    Dim SessionName = String.Format("SurveyQuestionDependencies_{0}", SurveyQuestionId)

     

                    If HttpContext.Current.Session(SessionName) Is Nothing Then

                        Using adp As New SurveyDataSetTableAdapters.SurveyQuestionDependenciesTableAdapter

                            HttpContext.Current.Session(SessionName) = adp.GetData(SurveyQuestionId)

                        End Using

                    End If

                    Return HttpContext.Current.Session(SessionName)

                End Get

            End Property

     

            Public Shared Function Survey_IsAvailable(ByVal SurveyId As Integer, ByVal Guid As Guid) As Integer

                Dim ResultValue As Integer = 0

                Dim ResultText As String = ""

                Using adp As New SurveyDataSetTableAdapters.QueriesTableAdapter

                    adp.Survey_IsAvailable(SurveyId, Guid, UserId, UserName, ComputerIP, ResultValue, ResultText)

                End Using

                Return ResultValue

            End Function

            Public Shared ReadOnly Property UserId() As Guid

                Get

                    Try

                        Return EDTS.User.GetUserGuid

                    Catch ex As Exception

                        Return Guid.Empty

                    End Try

                End Get

            End Property

            Public Shared ReadOnly Property UserName() As String

                Get

                    Return HttpContext.Current.Request.ServerVariables("LOGON_USER")

     

                  

                End Get

            End Property

            Public Shared ReadOnly Property ComputerIP() As String

                Get

                    Return HttpContext.Current.Request.UserHostAddress

     

     

                End Get

            End Property

            Public Shared ReadOnly Property ComputerIP_HTTP_X_FORWARDED_FOR() As String

                Get

                    Try

                        Return HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FOR") '  // Return real client IP.

                    Catch ex As Exception

                        Return "NA"

                    End Try

                End Get

            End Property

            Public Shared ReadOnly Property ComputerIP_HTTP_VIA() As String

                Get

                    Try

                        Return HttpContext.Current.Request.ServerVariables("HTTP_VIA") '  // Return real client IP.

     

                    Catch ex As Exception

                        Return "NA"

                    End Try

                End Get

            End Property

            Public Shared ReadOnly Property ComputerIP_REMOTE_ADDR() As String

                Get

                    Try

                        Return HttpContext.Current.Request.ServerVariables("REMOTE_ADDR") '  // Return real client IP.

     

                    Catch ex As Exception

                        Return "NA"

                    End Try

                End Get

            End Property

            Public Shared ReadOnly Property ComputerIP_UserHostAddress() As String

                Get

                    Try

                        Return HttpContext.Current.Request.UserHostAddress

                    Catch ex As Exception

                        Return "NA"

                    End Try

     

                End Get

            End Property

            Public Shared ReadOnly Property ComputerIP_UserHostName() As String

                Get

                    Try

                        Return HttpContext.Current.Request.UserHostName

                    Catch ex As Exception

                        Return "NA"

                    End Try

                End Get

            End Property

        End Class

    End Namespace

    Namespace EDTS .............what is this

    Y they r not using the Other Namespace?

    But it is working live server.

    Tuesday, August 23, 2011 3:42 AM

Answers

  • User-1770227574 posted

    Hi muji85a,

    Namespace EDTS .............what is this

    Y they r not using the Other Namespace?

    A namespace is a collection of different classes, and is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developers. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionality related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the ASP.NET application framework, or remoting functionality.

    Check out http://msdn.microsoft.com/en-us/library/ms973231.aspx#assenamesp_topic5

    http://www.startvbdotnet.com/language/

     

     

    About this issue, check out this thread http://forums.asp.net/p/1710988/4555433.aspx/1?Exception+not+defined

     

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 28, 2011 11:13 PM