Exemplo n.º 1
0
        private void DoSaving(string action, string jsonData, JToken parameters)
        {
            if (this.ModelInstance == null)
            {
                throw new Exception("Model is not defined for the store");
            }
            this.responseRecords = new List <object>();

            this.changingEventArgs = new BeforeStoreChangedEventArgs(action, jsonData, parameters, this.responseRecords);

            this.OnBeforeStoreChanged(changingEventArgs);

            Exception ex = null;

            try
            {
                if (!this.changingEventArgs.Cancel)
                {
                    this.MakeChanges();
                }
            }
            catch (Exception e)
            {
                ex = e;
            }

            AfterStoreChangedEventArgs eStoreChanged = new AfterStoreChangedEventArgs(action, true, ex, this.responseRecords);

            this.OnAfterStoreChanged(eStoreChanged);

            if (eStoreChanged.Exception != null && !eStoreChanged.ExceptionHandled)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 2
0
        protected virtual void OnAfterStoreChanged(AfterStoreChangedEventArgs e)
        {
            AfterStoreChangedEventHandler handler = (AfterStoreChangedEventHandler)Events[EventAfterStoreChanged];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 3
0
        private void DoSaving(string jsonData, XmlNode callbackParameters)
        {
            changingEventArgs = new BeforeStoreChangedEventArgs(jsonData, null, callbackParameters);

            ConfirmationList confirmationList = null;

            if (this.UseIdConfirmation && this.Reader.Reader != null)
            {
                confirmationList = changingEventArgs.DataHandler.BuildConfirmationList(GetIdColumnName());
            }

            changingEventArgs.ConfirmationList = confirmationList;

            this.OnBeforeStoreChanged(changingEventArgs);

            Exception ex = null;

            try
            {
                if (!changingEventArgs.Cancel)
                {
                    this.MakeChanges();
                }
            }
            catch (Exception e)
            {
                ex = e;
            }

            AfterStoreChangedEventArgs eStoreChanged = new AfterStoreChangedEventArgs(true, ex, confirmationList);

            this.OnAfterStoreChanged(eStoreChanged);

            if (eStoreChanged.Exception != null && !eStoreChanged.ExceptionHandled)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 4
0
        private void DoSaving(string action, string jsonData, JToken parameters)
        {
            if (this.ModelInstance == null)
            {
                throw new Exception("Model is not defined for the store");
            }
            this.responseRecords = new List<object>();

            this.changingEventArgs = new BeforeStoreChangedEventArgs(action, jsonData, parameters, this.responseRecords);

            this.OnBeforeStoreChanged(changingEventArgs);

            Exception ex = null;

            try
            {
                if (!this.changingEventArgs.Cancel)
                {
                    this.MakeChanges();
                }
            }
            catch (Exception e)
            {
                ex = e;
            }

            AfterStoreChangedEventArgs eStoreChanged = new AfterStoreChangedEventArgs(action, true, ex, this.responseRecords);
            this.OnAfterStoreChanged(eStoreChanged);

            if (eStoreChanged.Exception != null && !eStoreChanged.ExceptionHandled)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 5
0
        protected virtual void OnAfterStoreChanged(AfterStoreChangedEventArgs e)
        {
            AfterStoreChangedEventHandler handler = (AfterStoreChangedEventHandler)Events[EventAfterStoreChanged];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 6
0
        private void DoSaving(string jsonData, XmlNode callbackParameters)
        {
            changingEventArgs = new BeforeStoreChangedEventArgs(jsonData, null, callbackParameters);

            ConfirmationList confirmationList = null;

            if (this.UseIdConfirmation && this.Reader.Reader != null)
            {
                confirmationList = changingEventArgs.DataHandler.BuildConfirmationList(GetIdColumnName());
            }
            
            changingEventArgs.ConfirmationList = confirmationList;

            this.OnBeforeStoreChanged(changingEventArgs);

            Exception ex = null;

            try
            {
                if (!changingEventArgs.Cancel)
                {
                    this.MakeChanges();
                }
            }
            catch (Exception e)
            {
                ex = e;
            }

            AfterStoreChangedEventArgs eStoreChanged = new AfterStoreChangedEventArgs(true, ex, confirmationList);
            this.OnAfterStoreChanged(eStoreChanged);

            if (eStoreChanged.Exception != null && !eStoreChanged.ExceptionHandled)
            {
                throw new Exception(ex.Message, ex);
            }
        }