Repaso de post en los metodos del controller (ValidarEntidad) para que no pete al meter solo el nombre de la entidad y sin salir del campo dar a guardar
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@483 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
721f91b71c
commit
0d006f3f6e
@ -179,6 +179,9 @@ function TAlmacenesController.ValidarAlmacen(AAlmacen: IBizAlmacen): Boolean;
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
|
if (AAlmacen.DataTable.State in dsEditModes) then
|
||||||
|
AAlmacen.DataTable.Post;
|
||||||
|
|
||||||
if Length(AAlmacen.NOMBRE) = 0 then
|
if Length(AAlmacen.NOMBRE) = 0 then
|
||||||
raise Exception.Create('Debe indicar al menos el nombre de este almacén.');
|
raise Exception.Create('Debe indicar al menos el nombre de este almacén.');
|
||||||
|
|
||||||
|
|||||||
@ -411,20 +411,25 @@ end;
|
|||||||
|
|
||||||
function TArticulosController.ValidarArticulo(AArticulo: IBizArticulo): Boolean;
|
function TArticulosController.ValidarArticulo(AArticulo: IBizArticulo): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AArticulo) then
|
if not Assigned(AArticulo) then
|
||||||
raise Exception.Create ('Artículo no asignado');
|
raise Exception.Create ('Artículo no asignado');
|
||||||
|
|
||||||
if (AArticulo.DataTable.State in dsEditModes) then
|
if (AArticulo.DataTable.State in dsEditModes) then
|
||||||
AArticulo.DataTable.Post;
|
AArticulo.DataTable.Post;
|
||||||
|
|
||||||
|
//Tambien hacemos post de sus tablas hija
|
||||||
|
if (AArticulo.Proveedores.DataTable.State in dsEditModes) then
|
||||||
|
AArticulo.Proveedores.DataTable.Post;
|
||||||
|
|
||||||
if Length(AArticulo.DESCRIPCION) = 0 then
|
if Length(AArticulo.DESCRIPCION) = 0 then
|
||||||
raise Exception.Create('Debe indicar al menos la descripción de este artículo.');
|
raise Exception.Create('Debe indicar al menos la descripción de este artículo.');
|
||||||
|
|
||||||
// Asegurarse de valores en campos "automáticos"
|
// Asegurarse de valores en campos "automáticos"
|
||||||
AArticulo.Edit;
|
AArticulo.Edit;
|
||||||
try
|
try
|
||||||
AArticulo.USUARIO := AppFactuGES.UsuarioActivo.UserName;
|
AArticulo.USUARIO := AppFactuGES.UsuarioActivo.UserName;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
finally
|
finally
|
||||||
AArticulo.Post;
|
AArticulo.Post;
|
||||||
|
|||||||
@ -269,6 +269,8 @@ end;
|
|||||||
|
|
||||||
function TContactosController.ValidarContacto(AContacto: IBizContacto): Boolean;
|
function TContactosController.ValidarContacto(AContacto: IBizContacto): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AContacto) then
|
if not Assigned(AContacto) then
|
||||||
raise Exception.Create ('Contacto no asignado');
|
raise Exception.Create ('Contacto no asignado');
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ type
|
|||||||
procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); override;
|
procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); override;
|
||||||
function CreateEditor(const AName : String; const IID: TGUID; out Intf): Boolean;
|
function CreateEditor(const AName : String; const IID: TGUID; out Intf): Boolean;
|
||||||
|
|
||||||
function ValidarAlmacen(AFabricante: IBizFabricante): Boolean;
|
function ValidarFabricante(AFabricante: IBizFabricante): Boolean;
|
||||||
|
|
||||||
//Estos son los tres métodos a sobre escribir si se desea heredar toda la logica de
|
//Estos son los tres métodos a sobre escribir si se desea heredar toda la logica de
|
||||||
//este controller
|
//este controller
|
||||||
@ -129,9 +129,17 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFabricantesController.ValidarAlmacen(AFabricante: IBizFabricante): Boolean;
|
function TFabricantesController.ValidarFabricante(AFabricante: IBizFabricante): Boolean;
|
||||||
begin
|
begin
|
||||||
//
|
Result := False;
|
||||||
|
|
||||||
|
if not Assigned(AFabricante) then
|
||||||
|
raise Exception.Create ('Fabricante no asignado');
|
||||||
|
|
||||||
|
if (AFabricante.DataTable.State in dsEditModes) then
|
||||||
|
AFabricante.DataTable.Post;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFabricantesController.ValidarObjetos;
|
procedure TFabricantesController.ValidarObjetos;
|
||||||
@ -197,13 +205,10 @@ begin
|
|||||||
|
|
||||||
ValidarObjetos;
|
ValidarObjetos;
|
||||||
|
|
||||||
if ValidarAlmacen(AFabricante) then
|
if ValidarFabricante(AFabricante) then
|
||||||
begin
|
begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
if (AFabricante.DataTable.State in dsEditModes) then
|
|
||||||
AFabricante.DataTable.Post;
|
|
||||||
|
|
||||||
AFabricante.DataTable.ApplyUpdates;
|
AFabricante.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
|
|||||||
@ -518,6 +518,8 @@ end;
|
|||||||
|
|
||||||
function TFacturasClienteController.ValidarFactura(AFactura: IBizFacturaCliente): Boolean;
|
function TFacturasClienteController.ValidarFactura(AFactura: IBizFacturaCliente): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AFactura) then
|
if not Assigned(AFactura) then
|
||||||
raise Exception.Create ('Factura no asignada');
|
raise Exception.Create ('Factura no asignada');
|
||||||
|
|
||||||
|
|||||||
@ -376,6 +376,8 @@ end;
|
|||||||
|
|
||||||
function TFacturasProveedorController.ValidarFactura(AFactura: IBizFacturaProveedor): Boolean;
|
function TFacturasProveedorController.ValidarFactura(AFactura: IBizFacturaProveedor): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AFactura) then
|
if not Assigned(AFactura) then
|
||||||
raise Exception.Create ('Factura no asignada');
|
raise Exception.Create ('Factura no asignada');
|
||||||
|
|
||||||
|
|||||||
@ -129,6 +129,14 @@ end;
|
|||||||
|
|
||||||
function TFamiliasController.ValidarFamilia(AFamilia: IBizFamilia): Boolean;
|
function TFamiliasController.ValidarFamilia(AFamilia: IBizFamilia): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if not Assigned(AFamilia) then
|
||||||
|
raise Exception.Create ('Familia no asignada');
|
||||||
|
|
||||||
|
if (AFamilia.DataTable.State in dsEditModes) then
|
||||||
|
AFamilia.DataTable.Post;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -190,9 +198,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
if (AFamilia.DataTable.State in dsEditModes) then
|
|
||||||
AFamilia.DataTable.Post;
|
|
||||||
|
|
||||||
AFamilia.DataTable.ApplyUpdates;
|
AFamilia.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
|
|||||||
@ -156,6 +156,8 @@ end;
|
|||||||
|
|
||||||
function TFormasPagoController.ValidarFormaPago(AFormaPago: IBizFormaPago): Boolean;
|
function TFormasPagoController.ValidarFormaPago(AFormaPago: IBizFormaPago): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AFormaPago) then
|
if not Assigned(AFormaPago) then
|
||||||
raise Exception.Create ('Forma de pago no asignada');
|
raise Exception.Create ('Forma de pago no asignada');
|
||||||
|
|
||||||
|
|||||||
@ -221,6 +221,14 @@ end;
|
|||||||
|
|
||||||
function TObrasController.ValidarObra(AObra: IBizObra): Boolean;
|
function TObrasController.ValidarObra(AObra: IBizObra): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if not Assigned(AObra) then
|
||||||
|
raise Exception.Create ('Obra no asignada');
|
||||||
|
|
||||||
|
if (AObra.DataTable.State in dsEditModes) then
|
||||||
|
AObra.DataTable.Post;
|
||||||
|
|
||||||
if Length(AObra.NOMBRE) = 0 then
|
if Length(AObra.NOMBRE) = 0 then
|
||||||
raise Exception.Create('Debe indicar al menos el nombre de esta obra.');
|
raise Exception.Create('Debe indicar al menos el nombre de esta obra.');
|
||||||
|
|
||||||
@ -407,9 +415,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
if (AObra.DataTable.State in dsEditModes) then
|
|
||||||
AObra.DataTable.Post;
|
|
||||||
|
|
||||||
// AsignarCodigo(AObra);
|
// AsignarCodigo(AObra);
|
||||||
AObra.DataTable.ApplyUpdates;
|
AObra.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
|
|||||||
@ -462,6 +462,8 @@ end;
|
|||||||
|
|
||||||
function TRecibosProveedorController.ValidarReciboProveedor(ARecibosProveedor: IBizRecibosProveedor): Boolean;
|
function TRecibosProveedorController.ValidarReciboProveedor(ARecibosProveedor: IBizRecibosProveedor): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(ARecibosProveedor) then
|
if not Assigned(ARecibosProveedor) then
|
||||||
raise Exception.Create ('IBizRecibosProveedor no asignado');
|
raise Exception.Create ('IBizRecibosProveedor no asignado');
|
||||||
|
|
||||||
|
|||||||
@ -188,6 +188,8 @@ end;
|
|||||||
|
|
||||||
function TRemesasClienteController.ValidarRemesaCliente(ARemesaCliente: IBizRemesaCliente): Boolean;
|
function TRemesasClienteController.ValidarRemesaCliente(ARemesaCliente: IBizRemesaCliente): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(ARemesaCliente) then
|
if not Assigned(ARemesaCliente) then
|
||||||
raise Exception.Create ('Remesa no asignada');
|
raise Exception.Create ('Remesa no asignada');
|
||||||
|
|
||||||
|
|||||||
@ -188,6 +188,8 @@ end;
|
|||||||
|
|
||||||
function TRemesasProveedorController.ValidarRemesaProveedor(ARemesaProveedor: IBizRemesaProveedor): Boolean;
|
function TRemesasProveedorController.ValidarRemesaProveedor(ARemesaProveedor: IBizRemesaProveedor): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(ARemesaProveedor) then
|
if not Assigned(ARemesaProveedor) then
|
||||||
raise Exception.Create ('Remesa no asignada');
|
raise Exception.Create ('Remesa no asignada');
|
||||||
|
|
||||||
|
|||||||
@ -190,6 +190,8 @@ end;
|
|||||||
|
|
||||||
function TTiposIVAController.ValidarTipoIVA(ATipoIVA: IBizTipoIVA): Boolean;
|
function TTiposIVAController.ValidarTipoIVA(ATipoIVA: IBizTipoIVA): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(ATipoIVA) then
|
if not Assigned(ATipoIVA) then
|
||||||
raise Exception.Create ('TipoIVA no asignado');
|
raise Exception.Create ('TipoIVA no asignado');
|
||||||
|
|
||||||
|
|||||||
@ -126,9 +126,16 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TUnidadesMedidaController.ValidarUnidadesMedida(
|
function TUnidadesMedidaController.ValidarUnidadesMedida(AUnidadMedida: IBizUnidadMedida): Boolean;
|
||||||
AUnidadMedida: IBizUnidadMedida): Boolean;
|
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if not Assigned(AUnidadesMedida) then
|
||||||
|
raise Exception.Create ('UnidadMedida no asignada');
|
||||||
|
|
||||||
|
if (AUnidadMedida.DataTable.State in dsEditModes) then
|
||||||
|
AUnidadMedida.DataTable.Post;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -190,11 +197,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
if (AUnidadMedida.DataTable.State in dsEditModes) then
|
|
||||||
AUnidadMedida.DataTable.Post;
|
|
||||||
|
|
||||||
AUnidadMedida.DataTable.ApplyUpdates;
|
AUnidadMedida.DataTable.ApplyUpdates;
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
finally
|
finally
|
||||||
HideHourglassCursor;
|
HideHourglassCursor;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user