Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports CodiceFiscale.Model
- Public Class FiscalCode
- Inherits System.Web.UI.Page
- #Region "Proprietà per l'accesso ai controlli"
- ' il form dovrà gestire le info di una persona
- ' nome
- Property FirstName As String
- Get
- Return txtFirstName.Text.Trim
- End Get
- Set(value As String)
- txtFirstName.Text = value
- End Set
- End Property
- ' cognome
- Property LastName As String
- Get
- Return txtLastName.Text.Trim
- End Get
- Set(value As String)
- txtLastName.Text = value
- End Set
- End Property
- ' sesso
- Property Sex As SexType
- Get
- If rbSex.SelectedValue = "F" Then
- Return SexType.Female
- End If
- Return SexType.Male
- End Get
- Set(value As SexType)
- If value = SexType.Male Then
- rbSex.SelectedValue = "M"
- Else
- rbSex.SelectedValue = "F"
- End If
- End Set
- End Property
- ' data di nascita
- Property Birthday As DateTime
- Get
- Return txtDate.Text
- End Get
- Set(value As DateTime)
- txtDate.Text = value.Date
- End Set
- End Property
- ' città di nascita
- Property CityOfBirth As String
- Get
- Return txtCity.Text.Trim
- End Get
- Set(value As String)
- txtCity.Text = value
- End Set
- End Property
- #End Region
- Private Function ValidationRule() As Boolean
- Return Not String.IsNullOrEmpty(FirstName) AndAlso
- Not String.IsNullOrEmpty(LastName) AndAlso
- Not String.IsNullOrEmpty(CityOfBirth)
- End Function
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- End Sub
- Protected Sub CalcFC(sender As Object, e As EventArgs) Handles btnCalc.Click
- Dim p As New Person() With {
- .FirstName = FirstName,
- .LastName = LastName,
- .Birthday = Birthday,
- .CityOfBirth = CityOfBirth,
- .Sex = Sex
- }
- lblFiscalCode.Text = p.GetFiscalCode()
- End Sub
- End Class
Add Comment
Please, Sign In to add comment