git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/tags/1.8.0@17 c93665c3-c93d-084d-9b98-7d5f4a9c3376
84 lines
2.5 KiB
ObjectPascal
84 lines
2.5 KiB
ObjectPascal
unit uActualizarTiendaUtils;
|
|
|
|
interface
|
|
|
|
uses
|
|
Forms, Classes, Windows, SysUtils,
|
|
uBizTiendaWeb, uBizContactos, uBizDireccionesContacto;
|
|
|
|
function ActualizarTienda(ATiendaWeb : IBizTiendaWeb): Boolean;
|
|
|
|
function AnadirCliente(ATiendaWeb : IBizTiendaWeb; ACliente: IBizCliente): Boolean;
|
|
{function ActualizarCliente(ATiendaWeb : IBizTiendaWeb; ACliente: IBizCliente): Boolean;
|
|
function AnadirProveedor(ATiendaWeb : IBizTiendaWeb; AProveedor: IBizProveedor): Boolean;
|
|
function ActualizarProveedor(ATiendaWeb : IBizTiendaWeb; AProveedor: IBizProveedor): Boolean;}
|
|
|
|
implementation
|
|
|
|
uses
|
|
uClientesController, uProveedoresController, uOscAddressBookController,
|
|
uOscCustomersController, uBizOscAddressBook, uBizOscCustomers,
|
|
uPasswordUtils, schTiendaWebClient_Intf;
|
|
|
|
function AnadirCliente(ATiendaWeb : IBizTiendaWeb; ACliente: IBizCliente): Boolean;
|
|
var
|
|
AClientesController : IClientesController;
|
|
AOSCCustomerController : IOscCustomersController;
|
|
AOSCCustomer : IBizOscCustomer;
|
|
i : Integer;
|
|
begin
|
|
if not Assigned(ATiendaWeb) then
|
|
raise Exception.Create ('TiendaWeb no asignada (AnadirCliente)');
|
|
|
|
if not Assigned(ACliente) then
|
|
raise Exception.Create ('Cliente no asignado (AnadirCliente)');
|
|
|
|
ACliente.DataTable.Active := True;
|
|
|
|
AOSCCustomerController := TOscCustomersController.Create;
|
|
try
|
|
AOSCCustomer := AOSCCustomerController.Nuevo;
|
|
with AOSCCustomer do
|
|
begin
|
|
customers_firstname := ACliente.NOMBRE;
|
|
customers_dob := ACliente.FECHA_ALTA;
|
|
customers_lastname := '';
|
|
customers_email_address := ACliente.EMAIL_1;
|
|
customers_telephone := ACliente.TELEFONO_1;
|
|
customers_fax := ACliente.FAX;
|
|
customers_password := EncriptarPasswordOSC('12345');
|
|
rdx_customers_id_local := ACliente.ID;
|
|
end;
|
|
AOSCCustomerController.Guardar(AOSCCustomer);
|
|
finally
|
|
AOSCCustomerController := NIL;
|
|
AOSCCustomer := NIL;
|
|
end;
|
|
end;
|
|
|
|
function ActualizarTienda(ATiendaWeb : IBizTiendaWeb): Boolean;
|
|
var
|
|
AClientesController : IClientesController;
|
|
AProveedoresController : IProveedoresController;
|
|
AClientes : IBizCliente;
|
|
i : Integer;
|
|
begin
|
|
if not Assigned(ATiendaWeb) then
|
|
raise Exception.Create ('TiendaWeb no asignada');
|
|
|
|
AClientesController := TClientesController.Create;
|
|
try
|
|
AClientes := (AClientesController.BuscarTodos as IBizCliente);
|
|
for i := 0 to AClientes.DataTable.RecordCount - 1 do
|
|
begin
|
|
//ATiendaWeb.
|
|
AClientes.Next;
|
|
end;
|
|
finally
|
|
AClientesController := NIL;
|
|
end;
|
|
end;
|
|
|
|
|
|
end.
|