Exemplo n.º 1
0
 private void DefaultSession_BeforeConnect(object sender, SessionManipulationEventArgs e)
 {
     throw new Exception(
               "This error occurs because you tried to use the Session.DefaultSession " +
               "(please refer to XPO documentation to learn more) in XAF. " +
               "It is not allowed by default. Instead, use the XafApplication.ConnectionString property " +
               "to configure the connection to the database according to your needs. " +
               "Most likely, this problem is caused by the fact that you instantiated your persistent object, " +
               "XPCollection, etc. without the Session parameter and the default session was used by default. " +
               "Use a non-default session object to instantiate your objects and collections.");
 }
Exemplo n.º 2
0
        private void directBaseUow_BeforeCommitTransaction(object sender, SessionManipulationEventArgs e)
        {
            var listDemo   = new List <DemoInfo>();
            var listSource = new List <SourseInfo>();

            foreach (var item in e.Session.GetObjectsToSave())
            {
                switch (item)
                {
                case DemoInfo demoInfo:
                {
                    if (!listDemo.Contains(demoInfo))
                    {
                        listDemo.Add(demoInfo);
                    }

                    break;
                }

                case SourseInfo sourseInfo:
                {
                    if (!listSource.Contains(sourseInfo))
                    {
                        listSource.Add(sourseInfo);
                    }

                    break;
                }

                case ConsultRecord consultRecord:
                {
                    if (consultRecord.DemoInfo != null && !listDemo.Contains(consultRecord.DemoInfo))
                    {
                        listDemo.Add(consultRecord.DemoInfo);
                    }
                    if (consultRecord.SourseInfo != null && !listSource.Contains(consultRecord.SourseInfo))
                    {
                        listSource.Add(consultRecord.SourseInfo);
                    }

                    break;
                }
                }
            }

            foreach (var demoInfo in listDemo)
            {
                demoInfo.CalculateCurrentCount();
            }
            foreach (var sourseInfo in listSource)
            {
                sourseInfo.CalculateCurrentCount();
            }
        }
Exemplo n.º 3
0
 private void UnitOfWork_BeforeDisconnect(object sender, SessionManipulationEventArgs e)
 {
 }
Exemplo n.º 4
0
 private void UnitOfWork_AfterConnect(object sender, SessionManipulationEventArgs e)
 {
 }
Exemplo n.º 5
0
 private void UnitOfWork_AfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 /// Handles the AfterCommitTransaction event of the session control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DevExpress.Xpo.SessionManipulationEventArgs"/> instance containing the event data.</param>
 private void session_AfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     // save changes
     saveProtocolData();
     trackedObjects.Refresh();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Handles the AfterRollbackTransaction event of the session control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DevExpress.Xpo.SessionManipulationEventArgs"/> instance containing the event data.</param>
 private void session_AfterRollbackTransaction(object sender, SessionManipulationEventArgs e)
 {
     // clear lists
     trackedObjects.Clear();
     sessionEvents.Rollback();
 }
Exemplo n.º 8
0
 private void Session_AfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     AcceptSequence();
 }
Exemplo n.º 9
0
 static void UnitOfWorkBeforePreProcessCommitedList(object sender, SessionManipulationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("UnitOfWorkBeforePreProcessCommitedList()");
 }
Exemplo n.º 10
0
 static void UnitOfWorkBeforeFlushChanges(object sender, SessionManipulationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("UnitOfWorkBeforeFlushChanges()");
 }
Exemplo n.º 11
0
 static void UnitOfWorkBeforeDisconnect(object sender, SessionManipulationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("UnitOfWorkBeforeDisconnect()");
 }
Exemplo n.º 12
0
 static void UnitOfWorkAfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("UnitOfWorkAfterCommitTransaction()");
 }
Exemplo n.º 13
0
 static void UnitOfWorkAfterBeginTrackingChanges(object sender, SessionManipulationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("UnitOfWorkAfterBeginTrackingChanges()");
 }
Exemplo n.º 14
0
 /// <summary>
 /// Handles the AfterRollbackTransaction event of the session control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DevExpress.Xpo.SessionManipulationEventArgs"/> instance containing the event data.</param>
 private void session_AfterRollbackTransaction(object sender, SessionManipulationEventArgs e)
 {
     // clear lists
     trackedObjects.Clear();
     sessionEvents.Rollback();
 }
Exemplo n.º 15
0
 private void UnitOfWork_BeforeRollbackTransaction(object sender, SessionManipulationEventArgs e)
 {
 }
Exemplo n.º 16
0
 static void UnitOfWorkBeforeRollbackTransaction(object sender, SessionManipulationEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("UnitOfWorkBeforeRollbackTransaction()");
 }
Exemplo n.º 17
0
 private static void SessionOnAfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     ((Session)sender).AfterCommitTransaction -= SessionOnAfterCommitTransaction;
     Instance.Accept();
 }
Exemplo n.º 18
0
 private void Session_AfterRollBack(object sender, SessionManipulationEventArgs e)
 {
     CancelSequence();
 }
Exemplo n.º 19
0
 void Session_AfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     AcceptSequence();
 }
Exemplo n.º 20
0
 /// <summary>
 /// Handles the AfterCommitTransaction event of the session control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DevExpress.Xpo.SessionManipulationEventArgs"/> instance containing the event data.</param>
 private void session_AfterCommitTransaction(object sender, SessionManipulationEventArgs e)
 {
     // save changes
     saveProtocolData();
     trackedObjects.Refresh();
 }
Exemplo n.º 21
0
 void Session_AfterRollBack(object sender, SessionManipulationEventArgs e)
 {
     CancelSequence();
 }
 public void SessionManipulationHandler(object sender, SessionManipulationEventArgs e)
 {
     EvalTransactionState();
 }
Exemplo n.º 23
0
 private void DefaultSession_BeforeConnect(object sender, SessionManipulationEventArgs e)
 {
     throw new Exception(
         "This error occurs because you tried to use the Session.DefaultSession " +
         "(please refer to XPO documentation to learn more) in XAF. " +
         "It is not allowed by default. Instead, use the XafApplication.ConnectionString property " +
         "to configure the connection to the database according to your needs. " +
         "Most likely, this problem is caused by the fact that you instantiated your persistent object, " +
         "XPCollection, etc. without the Session parameter and the default session was used by default. " +
         "Use a non-default session object to instantiate your objects and collections.");
 }