Ejemplo n.º 1
0
        public override Msg ReplyFromServer()
        {
            IServerMessageDispatcher dispatcher = ServerMessageDispatcher();

            lock (ContainerLock())
            {
                LocalTransaction trans = ServerTransaction();
                long             replicationRecordId  = ReadLong();
                long             timestamp            = ReadLong();
                IList            concurrentTimestamps = trans.ConcurrentReplicationTimestamps();
                ServerMessageDispatcher().Server().BroadcastReplicationCommit(timestamp, concurrentTimestamps
                                                                              );
                ReplicationRecord replicationRecord = (ReplicationRecord)Container().GetByID(trans
                                                                                             , replicationRecordId);
                Container().Activate(trans, replicationRecord, new FixedActivationDepth(int.MaxValue
                                                                                        ));
                replicationRecord.SetVersion(timestamp);
                replicationRecord.ConcurrentTimestamps(concurrentTimestamps);
                replicationRecord.Store(trans);
                Container().StoreAfterReplication(trans, replicationRecord, Container().UpdateDepthProvider
                                                      ().ForDepth(int.MaxValue), false);
                trans.Commit(dispatcher);
                committedInfo = dispatcher.CommittedInfo();
                Transaction().UseDefaultTransactionTimestamp();
            }
            return(Msg.Ok);
        }
Ejemplo n.º 2
0
        public override async Task <Enums.eSyncResult> SaveAndSync(ISUPModel sender)
        {
            InteraccionModel <InteraccionBusiness> interaccion = sender as InteraccionModel <InteraccionBusiness>;

            Enums.eSyncResult syncResult = Enums.eSyncResult.Synchronized;

            LocalTransaction localTransaction = CRMMobileDesaDB.BeginTransaction();

            try
            {
                if (interaccion.Formulario_CodigoSAP != null)
                {
                    // Save formularios
                    guardarFormularios(interaccion);
                    guardarRelevamientos(interaccion);
                }
                // Save this and sync Transacciones
                syncResult = await base.SaveAndSync(sender, new Func <ISUPModel, Task <bool> >(syncTransacciones));

                localTransaction.Commit();
            }
            catch (Exception ex)
            {
                localTransaction.Rollback();
                throw ex;
            }
            return(syncResult);
        }