Help(Project crisis)

124»

Comments

  • I've had issues logging on to the site. This is a new account. I've sent you my email address. Check your messages

    Here's how to change your procedure [b]viewing[/b] so that you can use only one [b]View_Records[/b] instead of three. First you need to make the following changes in [b]Viewing[/b].
    [code]
    Case choice of
    1 : [red]View_Records (DDCfile)[/red] ;
    2 : [red]View_Records (DPIfile)[/red] ;
    3 : [red]View_Records (DSGOfile)[/red]
    end;
    [/code]
    Now you need to create a procedure [b]View_Records[/b] which is mostly identical to [b]View_RecordsDDC[/b], etc., except for the parts I've put in red.

    I've made some small changes to [b]nextrec[/b], which I've indicated in blue. It quite often happens when one is coding that better ways to do it come to mind. Whether you want to make these changes is up to you. Obviously the previous versions works.
    [code]
    Procedure [red]View_Records (var thisfile : Databasefiletype)[/red] ;
    {**************************************************
    * This Procedure is used to view the information *
    * about the members in the DDC Database. *
    ***************************************************}

    function nextrec (curr, n : longint) : longint ;
    {
    }
    CONST
    NUL = chr(0) ;
    UP = chr(72) ; { UP arrow }
    DOWN = chr(80) ; { DOWN arrow }
    PGUP = chr(73) ;
    PGDN = chr(81) ;
    QUIT = chr(79) ; { "END" key }
    PGVAL = 10 ;

    var
    key : char ;

    begin
    while TRUE do begin { infinite loop }
    key := readkey ;
    if key = NUL then begin
    key := readkey ;

    case key of
    UP : begin
    [blue]curr := curr + 1 ;
    if curr > n then
    curr := n ;[/blue]
    nextrec := curr ;
    exit
    end ;
    DOWN : begin
    [blue]curr := curr - 1 ;
    if curr < 0 then
    curr := 0 ;[/blue]
    nextrec := curr ;
    exit
    end ;
    PGUP : begin
    [blue]curr := curr + PGVAL ;
    if curr > n then
    curr := n ;[/blue]
    nextrec := curr ;
    exit
    end ;
    PGDN : begin
    [blue]curr := curr - PGVAL ;
    if curr < 0 then
    curr := 0 ;[/blue]
    nextrec := curr ;
    exit
    end ;
    QUIT : begin
    nextrec := -100 ;
    exit
    end
    end { case }
    end
    end
    end ;

    CONST
    SIZE = 1 ; { max number or records to be displayed }
    Var
    Ans : INTEGER;
    count, { loop counter }
    n, { index of last record in database file }
    curr : longint ; { index of current record in database file }
    [red]thisrec : MemberDatabase; { variable for the current record }[/red]

    Begin
    {$I-}
    Reset([red]thisfile[/red]);
    if ioresult > 0 then begin
    clrscr ;
    write ('File not found. Hit ENTER to return to main menu.') ;
    readln ;
    exit
    end ;
    n := filesize([red]thisfile[/red]) - 1 ;
    curr := 1 ; { default value }

    repeat
    clrscr ;
    Info;
    For count := curr - (SIZE - 1) to curr do Begin
    if (count < 0) or (count > n) then
    continue ; { no record has index < 0 or > n }

    Seek([red]thisfile[/red],count);
    Read([red]thisfile,thisrec[/red]);
    writeln;
    Textcolor(Black);
    Textbackground(White);

    With [red]thisrec[/red] do begin
    Writeln;
    writeln('Member Identification#:', Member_ID);
    writeln;
    writeln('name of Member: ', Member_Name);
    Writeln;
    Writeln('Ticket Payment of member:$', Member_TicketPayment);
    Textcolor(Black);
    GotoXY(30,16);
    Writeln('....GO UP.');
    GotoXY(30,18);
    Writeln('....GO DOWN.');
    Gotoxy(30,20);
    Writeln('END....EXIT VIEW MODE.')
    end
    end ;
    curr := nextrec (curr, n)
    until curr < -99 ;
    close(thisfile);
    {$I+}
    end;
    [/code]

  • thanks i'll add them this weekend.

    i can't wait to get the editing codes....

    any ways thanks alot!!!!!!!!!!!!!!!!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories