- 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 : UpdateAdmin.aspx.cs
//** 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.
//**
//**==========================================================================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using WebChamps.Components.Web;
using Company.ThreeTierDemo.Components.Business;
//*********************************************************************
//
// Company.ThreeTierDemo.Admin Namespace
//
//*********************************************************************
namespace Company.ThreeTierDemo.Admin
{
public class UpdateAdmin : WebChamps.Components.Web.SitePage
{
protected System.Web.UI.WebControls.Label PageMessage;
protected System.Web.UI.WebControls.Label ErrorMessage;
protected System.Web.UI.WebControls.TextBox FirstNameField;
protected System.Web.UI.WebControls.TextBox LastNameField;
protected System.Web.UI.WebControls.TextBox UsernameField;
protected System.Web.UI.WebControls.TextBox PasswordField;
protected System.Web.UI.WebControls.Button UpdateRecord;
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.UpdateRecord.Click += new System.EventHandler(this.UpdateRecord_Click);
}
#endregion
private Int32 AdminId;
//*********************************************************************
//
// Page_Load event
//
//Company.ThreeTierDemo.Components.Data.AdminDB.SelectAdmin(AdminId) is called to populate the fields.
//
//
//*********************************************************************
private void Page_Load(System.Object sender, System.EventArgs e)
{
AdminId = Int32.Parse(Request.Params["AdminId"]);
// Insert code to process code when the page is loaded for first time or without a post back.
if ( ! IsPostBack)
{
//Define objects
Company.ThreeTierDemo.Components.Business.Admin ParamAdmin;
//Create the Admin instance.
ParamAdmin = new Company.ThreeTierDemo.Components.Business.Admin(AdminId);
FirstNameField.Text = Convert.ToString(ParamAdmin.FirstName);
LastNameField.Text = Convert.ToString(ParamAdmin.LastName);
UsernameField.Text = Convert.ToString(ParamAdmin.Username);
PasswordField.Text = Convert.ToString(ParamAdmin.Password);
}
}
//*********************************************************************
//
// UpdateRecord_Click event
//
//The Company.ThreeTierDemo.Components.Data.AdminDB.UpdateAdmin_Tb is used to update record in the table.
//
//*********************************************************************
private void UpdateRecord_Click(System.Object sender, System.EventArgs e)
{
//Define objects
Company.ThreeTierDemo.Components.Business.Admin ParamAdmin;
Int32 ReturnValue;
//Create the Admin instance.
ParamAdmin = new Company.ThreeTierDemo.Components.Business.Admin();
ParamAdmin.AdminId = AdminId;
ParamAdmin.FirstName = FirstNameField.Text;
ParamAdmin.LastName = LastNameField.Text;
ParamAdmin.Username = UsernameField.Text;
ParamAdmin.Password = PasswordField.Text;
//Assign the return value.
ReturnValue = ParamAdmin.Update(User.Identity.Name);
if (ReturnValue == 0)
{
Response.Redirect("Default.aspx");
}
else if (ReturnValue == -1)
{
ErrorMessage.Text = "Custom error!";
}
else if (ReturnValue == 1)
{
ErrorMessage.Text = "Database error!";
}
else
{
PageMessage.Text = "Record already exists!";
}
}
}
}
|
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).