ASP.NET Web Forms Movie Management Code Snippets

Delete Movie Record

Partial Class Paginas_Eliminar
Inherits System.Web.UI.Page
Dim cine As ServicioWeb.Cine

Protected Sub btnEliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEliminar.Click
Dim obj As New ServicioWeb.Service
If lblID.Text.Trim.Length > 0 Then
lblMsj.Text = obj.Eliminar(lblID.Text)
lblID.Text = “”
Else
lblMsj.Text = “You must first search for the movie”
End If
End Sub

Protected Sub btnBuscar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBuscar.Click
Dim obj As New ServicioWeb.Service

cine = obj.BuscarDatos(txtDescrip.Text.Trim)
If cine.Id > 0 Then
lblID.Text = cine.Id
cbbInicio.Text = cine.HoraInicio
cbbFin.Text = cine.HoraFin
rbSalas.Text = cine.NroSala
txtNroAsisitentes.Text = cine.CantAsistentes
txtTotAsientos.Text = cine.TotalAsientos
txtPrecio.Text = cine.PrecioEntrada
lblMsj.Text = “”
Else
lblMsj.Text = “The movie name does not exist, try again”
End If
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
‘ Filling of the start and end time, in addition to the rooms
If Not Page.IsPostBack Then
For i As Integer = 10 To 23
cbbInicio.Items.Add(CStr(i))
cbbFin.Items.Add(CStr(i))
Next
For i As Integer = 1 To 6
rbSalas.Items.Add(CStr(i))
Next
End If
End Sub

End Class

Insert Movie Record

Partial Class Paginas_Ingreso
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
‘ Filling of the start and end time, in addition to the rooms.
If Not Page.IsPostBack Then
For i As Integer = 10 To 23
cbbInicio.Items.Add(CStr(i))
cbbFin.Items.Add(CStr(i))
Next
For i As Integer = 1 To 6
rbSalas.Items.Add(CStr(i))
Next
End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As New ServicioWeb.Service

lblMsj.Text = obj.Insertar(txtDescrip.Text, _
cbbInicio.SelectedItem.Text, _
cbbFin.SelectedItem.Text, _
rbSalas.SelectedItem.Text, _
txtNroAsisitentes.Text, _
txtTotAsientos.Text, _
txtPrecio.Text)
End Sub

End Class

Modify Movie Record

Partial Class Paginas_Modificar
Inherits System.Web.UI.Page
Dim cine As ServicioWeb.Cine

Protected Sub btnBuscar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBuscar.Click
Dim obj As New ServicioWeb.Service

cine = obj.BuscarDatos(txtDescrip.Text.Trim)
If cine.Id > 0 Then
lblID.Text = cine.Id
cbbInicio.Text = cine.HoraInicio
cbbFin.Text = cine.HoraFin
rbSalas.Text = cine.NroSala
txtNroAsisitentes.Text = cine.CantAsistentes
txtTotAsientos.Text = cine.TotalAsientos
txtPrecio.Text = cine.PrecioEntrada
lblMsj.Text = “”
Else
lblMsj.Text = “The movie name does not exist, try again”
End If
End Sub

Protected Sub btnModificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnModificar.Click
Dim obj As New ServicioWeb.Service

If lblID.Text.Trim.Length > 0 Then
lblMsj.Text = obj.Modificar(lblID.Text, txtDescrip.Text, _
cbbInicio.SelectedItem.Text, _
cbbFin.SelectedItem.Text, _
rbSalas.SelectedItem.Text, _
txtNroAsisitentes.Text, _
txtTotAsientos.Text, _
txtPrecio.Text)
lblID.Text = “”
Else
lblMsj.Text = “You must first search for the movie”
End If
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
‘ Filling of the start and end time, in addition to the rooms
If Not Page.IsPostBack Then
For i As Integer = 10 To 23
cbbInicio.Items.Add(CStr(i))
cbbFin.Items.Add(CStr(i))
Next
For i As Integer = 1 To 6
rbSalas.Items.Add(CStr(i))
Next
End If
End Sub
End Class

Main Page

Partial Class Paginas_Principal
Inherits System.Web.UI.Page