Exemplo n.º 1
0
        protected virtual void OnBeforeStoreChanged(BeforeStoreChangedEventArgs e)
        {
            BeforeStoreChangedEventHandler handler = (BeforeStoreChangedEventHandler)Events[EventBeforeStoreChanged];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
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 && !string.IsNullOrEmpty(this.DataSourceID))
                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);
            }
        }