This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Noviseda_FactuGES2/Source/Modulos/Contactos/Views/uViewDireccionEntrega.pas
2010-03-04 19:11:24 +00:00

151 lines
3.8 KiB
ObjectPascal

unit uViewDireccionEntrega;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewBase, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxTextEdit, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridBandedTableView,
cxGridDBBandedTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
uDADataTable, Grids, DBGrids, ActnList, ImgList, PngImageList, ComCtrls,
ToolWin, cxGridDBTableView, uViewDetallesGenerico, cxCurrencyEdit,
uDAInterfaces, cxLookAndFeels, cxLookAndFeelPainters, dxLayoutControl,
StdCtrls, Mask, DBCtrls, cxContainer, dxLayoutcxEditAdapters, cxDBEdit,
cxMaskEdit, cxDropDownEdit;
type
TfrViewDireccionEntrega = class(TfrViewBase)
dxLayoutControl1Group_Root: TdxLayoutGroup;
dxLayoutControl1: TdxLayoutControl;
dsDetalles: TDADataSource;
dxLayoutControl1Item2: TdxLayoutItem;
cbPoblacion: TcxDBComboBox;
dxLayoutControl1Item3: TdxLayoutItem;
cbProvincia: TcxDBComboBox;
dxLayoutControl1Item4: TdxLayoutItem;
eCalle: TcxDBTextEdit;
dxLayoutControl1Item5: TdxLayoutItem;
eCodigoPostal: TcxDBTextEdit;
dxLayoutControl1Group1: TdxLayoutGroup;
procedure cbPoblacionPropertiesInitPopup(Sender: TObject);
procedure cbProvinciaPropertiesInitPopup(Sender: TObject);
protected
FProvincias : TStringList;
FPoblaciones : TStringList;
procedure CargarProvincias;
procedure CargarPoblaciones;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
end;
implementation
{$R *.dfm}
uses
uProvinciasPoblacionesController, uStringsUtils;
{ TfrViewDireccionEntrega }
procedure TfrViewDireccionEntrega.CargarPoblaciones;
var
i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do
begin
BeginUpdate;
try
Clear;
for i := 0 to FPoblaciones.Count - 1 do
Add(FPoblaciones.Names[i]);
finally
EndUpdate;
end;
end;
finally
Free;
end;
end;
procedure TfrViewDireccionEntrega.CargarProvincias;
var
i : integer;
begin
with TProvinciasPoblacionesController.Create do
try
FProvincias := DarListaProvincias;
with cbProvincia.Properties.Items do
begin
BeginUpdate;
try
Clear;
for i := 0 to FProvincias.Count - 1 do
Add(FProvincias.Names[i]);
finally
EndUpdate;
end;
end;
finally
Free;
end;
end;
procedure TfrViewDireccionEntrega.cbPoblacionPropertiesInitPopup(Sender: TObject);
begin
inherited;
ShowHourglassCursor;
try
FreeANDNIL(FPoblaciones);
if not Assigned(FProvincias) then
CargarProvincias;
if not EsCadenaVacia(cbProvincia.Text) and (FProvincias.IndexOfName(cbProvincia.Text) <> -1) then
CargarPoblaciones
finally
HideHourglassCursor;
end;
end;
procedure TfrViewDireccionEntrega.cbProvinciaPropertiesInitPopup(Sender: TObject);
begin
inherited;
ShowHourglassCursor;
try
if not Assigned(FProvincias) then
CargarProvincias;
finally
HideHourglassCursor;
end;
end;
constructor TfrViewDireccionEntrega.Create(AOwner: TComponent);
begin
inherited;
FProvincias := NIL;
FPoblaciones := NIL;
end;
destructor TfrViewDireccionEntrega.Destroy;
begin
if Assigned(FProvincias) then
FreeANDNIL(FProvincias);
if Assigned(FPoblaciones) then
FreeANDNIL(FPoblaciones);
inherited;
end;
end.