Delphi-Kylix
  Home arrow Delphi-Kylix arrow User Management for an Internet Access Con...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

User Management for an Internet Access Control Application
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-09-22

    Table of Contents:
  • User Management for an Internet Access Control Application
  • User Management Module
  • User Management Module Explained
  • Stats Page

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    User Management for an Internet Access Control Application


    (Page 1 of 4 )

    In this part of the Internet access control application, we are going to discuss the last section of the server application that deals with user management. The term "user management" is somewhat misleading in the context of our application because it is not actually users of the Internet café that we are referring to, but rather the staff members. This section will deal with how staff members allocate Internet sessions to users and also how staff members with administration level access can add, remove and change new staff member details.

    The first section deals with adding an Internet session for a user.

    Adding an Internet session

    This part of the server application is where most of the money making is taking place. Below is a screen shot of what the session allocating application looks like:


    The above image shows the allocating screen detailing the following: the name of the workstation to which the session is being allocated; in this case the workstation is called “janedoe.” It also shows the length of time that is allocated; in this case it is sixty minutes. Finally, it shows the charge, which is twenty dollars.

    The session time, charge and the name of the workstation will then be sent to the client application, which will use that information to start up an Internet session. The allocation form is activated when a staff member double clicks on the workstation name in the list view control. When a staff member double clicks on it, the name of the workstation is transferred to the allocation screen.

    Below is a listing of the code that makes all of the above happen: 

    unit adduser;


    interface


    uses

    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

    Dialogs, StdCtrls, Buttons;


    type

    TForm2 = class(TForm)

    BitBtn1: TBitBtn;

    StaticText1: TStaticText;

    StaticText2: TStaticText;

    edcharge: TEdit;

    StaticText3: TStaticText;

    StaticText4: TStaticText;

    StaticText5: TStaticText;

    cbtime: TComboBox;

    Label1: TLabel;

    procedure BitBtn1Click(Sender: TObject);

    procedure cbtimeChange(Sender: TObject);

    private

    { Private declarations }

    public

    { Public declarations }

    end;


    var

    Form2: TForm2;


    implementation


    {$R *.dfm}

    uses server;

    procedure TForm2.BitBtn1Click(Sender: TObject);

    begin

    form1.WStation:='';

    form1.mins:='';

    form1.tcharge:='';


    form1.WStation:=label1.caption;

    form1.mins:=cbtime.Text;

    form1.tcharge:=edcharge.Text;

    //update mula table

    with form1.ado1 do

    begin

    tablename:='mula';

    active:=true;

    Insert;

    FieldByName('uid').AsInteger:= form1.uid;

    FieldByName('total').AsCurrency:=strtofloat(edcharge.text);

    post;

    active:=false;

    end;


    form1.Timing(label1.Caption,edcharge.text,cbtime.text);

    close;

    end;


    procedure TForm2.cbtimeChange(Sender: TObject);

    begin

    if cbtime.text = '15' then

    begin

    edcharge.text:='5.00';

    end

    else

    if cbtime.text = '30' then

    begin

    edcharge.text:='10.00';

    end

    else

    edcharge.text:='20.00';

    end;


    end.

    The first procedure in the code deals with what happens when a staff member clicks on the “OK” button that is on the form. It is essentially responsible for updating the mula table and then sending the session information over to the workstation. The first part of the code initializes a couple of variables:

    procedure TForm2.BitBtn1Click(Sender: TObject);

    begin

    form1.WStation:='';

    form1.mins:='';

    form1.tcharge:='';

    The name of the workstation is added to the label control and other information, such as the time and charge, is added to the just-initialized variables from appropriate edit and combo box controls:

    form1.WStation:=label1.caption;

    form1.mins:=cbtime.Text;

    form1.tcharge:=edcharge.Text;

    Then the mula table is updated. Essentially, two pieces of information are sent to the database. The first piece is the user id of the currently logged-in staff member, which is captured at login, and the second piece is the total charge of the session that the staff member is allocating:

    //update mula table

    with form1.ado1 do

    begin

    tablename:='mula';

    active:=true;

    Insert;

    FieldByName('uid').AsInteger:= form1.uid;

    FieldByName('total').AsCurrency:=strtofloat(edcharge.text);

    post;

    active:=false;

    end;

    Finally, the information is sent to the workstation for processing. This is done by calling the timing() function which we discussed in the previous article. This function takes three arguments, which in this case are answered by adding the name of the workstation, the charge, and the time that is allocated for the Internet session:

    form1.Timing(label1.Caption,edcharge.text,cbtime.text);

    close;

    end;

    The remaining procedure in this form deals with the allocation of the time and charge. As I’ve stated previously, the time and charge for a session is hard coded (which is not good practice, as it will be difficult to change the values at a later stage), but you might be well advised to make the setting of these values more flexible:

    procedure TForm2.cbtimeChange(Sender: TObject);

    begin

    if cbtime.text = '15' then

    begin

    edcharge.text:='5.00';

    end

    else

    if cbtime.text = '30' then

    begin

    edcharge.text:='10.00';

    end

    else

    edcharge.text:='20.00';

    end;


    end.

    More Delphi-Kylix Articles
    More By David Web


     

    DELPHI-KYLIX ARTICLES

    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...
    - Using the Client Dataset in Two-Tiered Clien...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT