Imports EDSL.Entities
Imports EDSL.DAL
Partial Public Class EnquiryEditControl
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'txtNotes.BaseHref = ConfigurationManager.AppSettings("BaseHref") & "PageEdit"
        'txtNotes.BasePath = ConfigurationManager.AppSettings("BasePath")

        If IsPostBack = False Then
            Call PopulateddlStatus()
            If Request.QueryString("id") = 0 OrElse Request.QueryString("id") = "" Then

            Else

                Call GetDetails(Request.QueryString("id"))
            End If
        End If
    End Sub
    Private Sub PopulateddlStatus()
        Dim objMain As New dbMainFunctions
        Dim objDDLItems As List(Of entMainDropDown) = objMain.GetDropDownReference(4)
        'call ddlStatus.Items.Clear
        'For Each objDDL As entMainDropDown In objDDLItems
        '  Dim objListitem As New ListItem
        '  objListitem.Text = objddl.TextDisplay
        '  objListitem.Value = objddl.Value
        '  ddlStatus.Items.Add(objListitem)
        'Next
    End Sub
    Private Sub GetDetails(ByVal intEnquiryID As Integer)
        Dim objMain As New dbMainEnquiry
        Dim objMainEntity As entMainEnquiry = objMain.GetItem(intEnquiryID)
        txtID.Value = objMainEntity.EnquiryID
        txtName.Text = objMainEntity.EnquiryName
        txtBusinessName.Text = objMainEntity.BusinessName
        'txtTown.Text = objMainEntity.Ad4
        'txtCounty.Text = objMainEntity.Ad4
        'txtPostcode.Text = objMainEntity.Postcode
        txtEmail.Text = objMainEntity.EnquiryEmail
        txtTelephone.Text = objMainEntity.EnquiryTelephone
        txtDate.Text = objMainEntity.CreatedDate
        txtMessage.Value = objMainEntity.EnquiryMessage
        txtFax.Text = objMainEntity.EnquiryFaxNo
        lblAreasOfInterest.Text = objMainEntity.EnquiryNotes.ToString()
        ''txtNotes.Value = objMainEntity.EnquiryNotes
        'ddlStatus.SelectedValue = objMainEntity.EnquiryStatus
    End Sub
    'Protected Sub btnDelete_click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDelete.Click
    '    Dim objMain As New dbMainEnquiry
    '    Response.Redirect("Enquirydelete.aspx?id=" & txtID.Value & "&idtext=" & txtName.Text & "&r=e")
    'End Sub
    'Protected Sub btnSave_click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
    '  Dim objMainAdmin As new dbMainEnquiry
    '  Dim intResultFromSave As Integer
    '  Dim intID As Integer

    '  If txtID.Value = "" then
    '    intID = 0
    '  else 
    '    intID = cint(txtID.Value)
    '  End If

    '      intResultFromSave = objMainAdmin.SaveItem(intID, txtName.Text, txtBusinessName.Text, txtTown.Text, txtCounty.Text, txtPostcode.Text, txtEmail.Text, txtTelephone.Text, txtMessage.Value.ToString, txtNotes.value.tostring, ddlStatus.SelectedValue, Session("passover"))
    '  Select Case intResultFromSave 
    '    Case 0
    '      Response.Redirect("list.aspx")
    '    Case 1
    '      divErrorPanel.InnerHtml = "Error saving Enquiry item"
    '    Case Else
    '      Response.Redirect("list.aspx")
    '  End Select
    'End Sub

    Protected Sub btnBack_click(ByVal sender As Object, ByVal e As EventArgs) Handles btnBack.Click
        Response.Redirect("list.aspx")
    End Sub
End Class
