- poder indicar individualmente qué artículos están en la tienda o no - arreglado el problema con ñ y tildes al volcar información a MySQL. git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@247 c93665c3-c93d-084d-9b98-7d5f4a9c3376
153 lines
3.9 KiB
ObjectPascal
153 lines
3.9 KiB
ObjectPascal
unit uEditorTiendaWeb;
|
||
|
||
interface
|
||
|
||
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
|
||
Buttons, ComCtrls, ExtCtrls, ActnList, cxControls, cxContainer, cxEdit,
|
||
cxCheckBox, cxDBEdit, DB, uDADataTable, uIEditorTiendaWeb, uBizTiendaWeb,
|
||
cxTextEdit, uTiendaWebController, DBXpress, WideStrings, SqlExpr;
|
||
|
||
type
|
||
TfEditorTiendaWeb = class(TForm, IEditorTiendaWeb)
|
||
Panel1: TPanel;
|
||
Panel2: TPanel;
|
||
PageControl1: TPageControl;
|
||
TabSheet1: TTabSheet;
|
||
OKBtn: TButton;
|
||
CancelBtn: TButton;
|
||
ActionList1: TActionList;
|
||
actAceptar: TAction;
|
||
actCancelar: TAction;
|
||
cbActivo: TcxDBCheckBox;
|
||
dsTiendaWeb: TDADataSource;
|
||
GroupBox1: TGroupBox;
|
||
edtBDSERVER: TcxDBTextEdit;
|
||
edtBDUSER: TcxDBTextEdit;
|
||
edtBDPASS: TcxDBTextEdit;
|
||
edtBDNAME: TcxDBTextEdit;
|
||
Label1: TLabel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
bComprobar: TButton;
|
||
actComprobar: TAction;
|
||
procedure FormShow(Sender: TObject);
|
||
procedure actCancelarExecute(Sender: TObject);
|
||
procedure actAceptarExecute(Sender: TObject);
|
||
procedure cbActivoPropertiesEditValueChanged(Sender: TObject);
|
||
procedure actComprobarUpdate(Sender: TObject);
|
||
procedure actComprobarExecute(Sender: TObject);
|
||
private
|
||
procedure RefrescarControles;
|
||
protected
|
||
FTienda : IBizTiendaWeb;
|
||
FController : ITiendaWebController;
|
||
function GetTiendaWeb: IBizTiendaWeb;
|
||
procedure SetTiendaWeb(const Value: IBizTiendaWeb);
|
||
public
|
||
property TiendaWeb: IBizTiendaWeb read GetTiendaWeb write SetTiendaWeb;
|
||
constructor Create(AOwner: TComponent); override;
|
||
destructor Destroy; override;
|
||
end;
|
||
|
||
|
||
implementation
|
||
|
||
{$R *.dfm}
|
||
|
||
{ TfEditorTiendaWeb }
|
||
|
||
uses
|
||
uDialogUtils;
|
||
|
||
procedure TfEditorTiendaWeb.actAceptarExecute(Sender: TObject);
|
||
begin
|
||
FTienda.Edit;
|
||
if cbActivo.Checked then
|
||
FTienda.TIENDA_ACTIVA := 1
|
||
else
|
||
FTienda.TIENDA_ACTIVA := 0;
|
||
|
||
FController.Guardar(FTienda);
|
||
Close;
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.actCancelarExecute(Sender: TObject);
|
||
begin
|
||
FController.DescartarCambios(FTienda);
|
||
Close;
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.actComprobarExecute(Sender: TObject);
|
||
begin
|
||
{ if FController.HayConexionConTienda(edtBDSERVER.Text, edtBDNAME.Text,
|
||
edtBDUSER.Text, edtBDPASS.Text) then}
|
||
if FController.HayConexionConTienda then
|
||
ShowInfoMessage('Conexi<78>n v<>lida con la tienda')
|
||
else
|
||
ShowErrorMessage('Error de conexi<78>n', 'No se ha podido establecer la conexi<78>n con la base de datos.');
|
||
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.actComprobarUpdate(Sender: TObject);
|
||
begin
|
||
(Sender as TAction).Enabled :=
|
||
(Length(edtBDSERVER.Text) > 0) and
|
||
(Length(edtBDUSER.Text) > 0) and
|
||
(Length(edtBDNAME.Text) > 0);
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.cbActivoPropertiesEditValueChanged(Sender: TObject);
|
||
begin
|
||
RefrescarControles;
|
||
end;
|
||
|
||
constructor TfEditorTiendaWeb.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
FController := TTiendaWebController.Create;
|
||
end;
|
||
|
||
destructor TfEditorTiendaWeb.Destroy;
|
||
begin
|
||
FController := NIL;
|
||
FTienda := NIL;
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.RefrescarControles;
|
||
begin
|
||
edtBDSERVER.Enabled := (FTienda.TIENDA_ACTIVA = 1);
|
||
edtBDUSER.Enabled := (FTienda.TIENDA_ACTIVA = 1);
|
||
edtBDPASS.Enabled := (FTienda.TIENDA_ACTIVA = 1);
|
||
edtBDNAME.Enabled := (FTienda.TIENDA_ACTIVA = 1);
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.FormShow(Sender: TObject);
|
||
begin
|
||
if not FTienda.DataTable.Active then
|
||
FTienda.DataTable.Active := True;
|
||
|
||
RefrescarControles;
|
||
end;
|
||
|
||
function TfEditorTiendaWeb.GetTiendaWeb: IBizTiendaWeb;
|
||
begin
|
||
Result := FTienda;
|
||
end;
|
||
|
||
procedure TfEditorTiendaWeb.SetTiendaWeb(const Value: IBizTiendaWeb);
|
||
begin
|
||
FTienda := Value;
|
||
if Assigned(FTienda) then
|
||
begin
|
||
dsTiendaWeb.DataTable := FTienda.DataTable;
|
||
dsTiendaWeb.DataTable.Open;
|
||
end
|
||
else
|
||
dsTiendaWeb.DataTable := NIL;
|
||
end;
|
||
|
||
end.
|
||
|