Untitled
unknown
sql
2 years ago
3.1 kB
9
Indexable
unit Unidad4Actividad1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm4 = class(TForm)
LabelMatricula: TLabel;
LabelApellidos: TLabel;
LabelNombre: TLabel;
Label1Nota: TLabel;
Label2Nota: TLabel;
Label3Nota: TLabel;
Label4Nota: TLabel;
Label5Nota: TLabel;
EditMatricula: TEdit;
EditNombre: TEdit;
EditApellidos: TEdit;
Edit1Nota: TEdit;
Edit2Nota: TEdit;
Edit3Nota: TEdit;
Edit4Nota: TEdit;
Edit5Nota: TEdit;
ButtonSalir: TButton;
ButtonVerificar: TButton;
LabelTitulo: TLabel;
Label1: TLabel;
procedure ButtonSalirClick(Sender: TObject);
procedure ButtonVerificarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
Archivo: TextFile;
implementation
{$R *.dfm}
function CalificacionFinal: Double;
begin
Result := StrToFloat(Form4.Edit1Nota.Text) +
StrToFloat(Form4.Edit2Nota.Text) +
StrToFloat(Form4.Edit3Nota.Text) +
StrToFloat(Form4.Edit4Nota.Text) +
StrToFloat(Form4.Edit5Nota.Text);
end;
procedure GuardarDatosEnArchivo;
begin
AssignFile(Archivo, 'calificacionesEncuentros.txt');
Append(Archivo);
WriteLn(Archivo, Form4.EditMatricula.Text + ',' +
Form4.EditNombre.Text + ',' +
Form4.EditApellidos.Text + ',' +
Form4.Edit1Nota.Text + ',' +
Form4.Edit2Nota.Text + ',' +
Form4.Edit3Nota.Text + ',' +
Form4.Edit4Nota.Text + ',' +
Form4.Edit5Nota.Text + ',' +
FloatToStr(CalificacionFinal));
CloseFile(Archivo);
end;
procedure TForm4.ButtonSalirClick(Sender: TObject);
begin
var
salida: Integer;
begin
salida := MessageDlg('Esta seguro que deseas salir?', mtConfirmation, mbYesNoCancel, 0);
if salida = mrYes then
Application.Terminate;
end;
end;
procedure TForm4.ButtonVerificarClick(Sender: TObject);
var
contestacion: Integer;
begin
contestacion := MessageDlg('¿Seguro que las notas son correctas?', mtConfirmation, mbYesNo, 0);
if contestacion = mrYes then
begin
GuardarDatosEnArchivo ;
MessageDlg('Las notas ingresadas han sido gurdadas de forma correcta', mtInformation, [mbOK], 0)
end;
if contestacion = mrNo then
begin
Form4.EditMatricula.Clear;
Form4.EditNombre.Clear;
Form4.EditApellidos.Clear;
Form4.Edit1Nota.Clear;
Form4.Edit2Nota.Clear;
Form4.Edit3Nota.Clear;
Form4.Edit4Nota.Clear;
Form4.Edit5Nota.Clear;
MessageDlg('Favor ingrese nuevamente los datos', mtInformation, [mbOK], 0)
end
else
begin
MessageDlg('Operacion cancelada', mtInformation, [mbOK], 0)
end;
end;
end.
Editor is loading...