CREATE PROCEDURE sClientApplyInsert
@ClientId uniqueidentifier,
@EmployeId uniqueidentifier,
@ClientTypeId int,
@Prenom nvarchar(100),
@Nom nvarchar(100),
@Adresse nvarchar(150),
@sync_row_count int output
AS
BEGIN
INSERT INTO [Client] ([ClientId], [EmployeId], [ClientTypeId], [Prenom], [Nom], [Adresse])
VALUES (@ClientId, @EmployeId, @ClientTypeId, @Prenom, @Nom, @Adresse) ;
SET @sync_row_count = @@rowcount
END
Create PROCEDURE [dbo].[sClientApplyUpdate]
@sync_force_write bit,
@sync_last_received_anchor Datetime,
UPDATE [Client] SET
[EmployeId] = @EmployeId,
[ClientTypeId] = @ClientTypeId,
[Prenom] = @Prenom,
[Nom] = @Nom,
[Adresse] = @Adresse
WHERE ([ClientId] = @ClientId)
AND (@sync_force_write = 1 OR (LastEditDate <= @sync_last_received_anchor))
CREATE PROCEDURE sClientApplyDelete
DELETE FROM [Client]
Create PROCEDURE [dbo].[sClientConflictDeletes]
@ClientId uniqueidentifier
SELECT [ClientId], [DeletionDate] FROM [Client_Tombstone] WHERE ([ClientId] = @ClientId)
Create PROCEDURE [dbo].[sClientConflictUpdates]
SELECT [ClientId], [EmployeId], [ClientTypeId], [Prenom], [Nom],
[Adresse], [CreationDate], [LastEditDate]
FROM [Client] WHERE ([ClientId] = @ClientId)
Create PROCEDURE [dbo].[sClientIncrementalInserts]
@sync_new_received_anchor Datetime
SELECT [ClientId], [EmployeId], [ClientTypeId], [Prenom], [Nom], [Adresse], [CreationDate], [LastEditDate]
FROM [Client]
WHERE (EmployeId = @EmployeId)
AND (CreationDate > @sync_last_received_anchor AND CreationDate <= @sync_new_received_anchor)
Create PROCEDURE [dbo].[sClientIncrementalUpdates]
AND (LastEditDate > @sync_last_received_anchor AND LastEditDate <= @sync_new_received_anchor
AND CreationDate <= @sync_last_received_anchor)
Create PROCEDURE [dbo].[sClientIncrementalDeletes]
@sync_new_received_anchor Datetime,
@sync_initialized bit
SELECT [ClientId], [DeletionDate] FROM [Client_Tombstone]
WHERE (@sync_initialized = 1
AND DeletionDate > @sync_last_received_anchor AND DeletionDate <= @sync_new_received_anchor)
this.clientSyncAdapter.SelectIncrementalInsertsCommand =
new System.Data.SqlClient.SqlCommand();
this.clientSyncAdapter.SelectIncrementalInsertsCommand.CommandText = "sClientIncrementalInserts";
this.clientSyncAdapter.SelectIncrementalInsertsCommand.CommandType = System.Data.CommandType.StoredProcedure;
this.clientSyncAdapter.SelectIncrementalInsertsCommand.Parameters.Add(
new System.Data.SqlClient.SqlParameter("@sync_last_received_anchor", System.Data.SqlDbType.BigInt));
new System.Data.SqlClient.SqlParameter("@EmployeId", System.Data.SqlDbType.UniqueIdentifier));