- sourcecode.zip
- SourceCode
- Csharp
- Components
- Business
- Data
- Interface
- Parent
- Web
- CSS
- Errors
- Images
- bg_navigation.gif
- delete.gif
- logobanner.gif
- new.gif
- top.jpg
- update.gif
- Login
- UserControls
- Scripts
- ThreeTierGenerator
- VB
- Components
- Business
- Data
- Interface
- Parent
- Web
- CSS
- Errors
- Images
- bg_navigation.gif
- delete.gif
- new.gif
- top.jpg
- update.gif
- UserControls
- demo.zip
- Demo
- ThreeTierDemo
- ThreeTierDemoVB
|
'**==========================================================================================
'**
'** FILE : UpdateUsers.aspx.vb
'** Author: Stevan Rodrigues
'**
'**==========================================================================================
'**
'** (c) The contents of this file , and of any file or document derived from it , are copyright
'** to Webchamps . Unlicensed alteration, change or copying in any form,
'** whether written, by photocopy, by print or by any other methods of reproduction is
'** strictly prohibited.
'**
'**==========================================================================================
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports WebChamps.Components.Web
Imports Company.ThreeTierDemoVB.Components.Business
'*********************************************************************
'
' Company.ThreeTierDemoVB.User Namespace
'
'*********************************************************************
Namespace Company.ThreeTierDemoVB.User
Public Class UpdateUsers
Inherits WebChamps.Components.Web.SitePage
Protected PageMessage As System.Web.UI.WebControls.Label
Protected ErrorMessage As System.Web.UI.WebControls.Label
Protected FirstNameField As System.Web.UI.WebControls.TextBox
Protected LastNameField As System.Web.UI.WebControls.TextBox
Protected EmailField As System.Web.UI.WebControls.TextBox
Protected CommentsField As System.Web.UI.WebControls.TextBox
Protected UpdateRecord As System.Web.UI.WebControls.Button
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
AddHandler Me.Load, New System.EventHandler(AddressOf Me.Page_Load)
AddHandler Me.UpdateRecord.Click, New System.EventHandler(AddressOf Me.UpdateRecord_Click)
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private UserId As Int32
'*********************************************************************
'
' Page_Load event
'
'Company.ThreeTierDemoVB.Components.Data.UserDB.SelectUser(UserId) is called to populate the fields.
'
'
'*********************************************************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
UserId = Int32.Parse(Request.Params("UserId"))
' Insert code to process code when the page is loaded for first time or without a post back.
If Not IsPostBack Then
'Define objects
Dim ParamUser As Company.ThreeTierDemoVB.Components.Business.User
'Create the User instance.
ParamUser = New Company.ThreeTierDemoVB.Components.Business.User(UserId)
FirstNameField.Text = Convert.ToString(ParamUser.FirstName)
LastNameField.Text = Convert.ToString(ParamUser.LastName)
EmailField.Text = Convert.ToString(ParamUser.Email)
CommentsField.Text = Convert.ToString(ParamUser.Comments)
End If
End Sub
'*********************************************************************
'
' UpdateRecord_Click event
'
'The Company.ThreeTierDemoVB.Components.Data.UserDB.UpdateUsers_Tb is used to update record in the table.
'
'*********************************************************************
Private Sub UpdateRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Define objects
Dim ParamUser As Company.ThreeTierDemoVB.Components.Business.User
Dim ReturnValue As Int32
'Create the User instance.
ParamUser = New Company.ThreeTierDemoVB.Components.Business.User()
ParamUser.UserId = UserId
ParamUser.FirstName = FirstNameField.Text
ParamUser.LastName = LastNameField.Text
ParamUser.Email = EmailField.Text
ParamUser.Comments = CommentsField.Text
'Assign the return value.
ReturnValue = ParamUser.Update(User.Identity.Name)
If ReturnValue = 0 Then
Response.Redirect("Default.aspx")
ElseIf ReturnValue = -1 Then
ErrorMessage.Text = "Custom error!"
ElseIf ReturnValue = 1 Then
ErrorMessage.Text = "Database error!"
Else
PageMessage.Text = "Record already exists!"
End If
End Sub
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Stevan is a Microsoft Certified Solutions Developer in .Net Architecture (MCSD.Net Early Achiever – one among the first 2500 worldwide), Microsoft Certified Application Developer in .Net – MCAD.Net (Charter Member - one among the first 5000 developers worldwide).