Пример #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);
            }
        }
Пример #2
0
        protected virtual void OnBeforeStoreChanged(BeforeStoreChangedEventArgs e)
        {
            BeforeStoreChangedEventHandler handler = (BeforeStoreChangedEventHandler)Events[EventBeforeStoreChanged];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #3
0
        protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e)
        {
            var data = e.DataHandler.ObjectData<RowDefinition>();
            foreach (var el in data.Updated)
            {
                Data.Remove(Data.Where(d => d.Id == el.Id).FirstOrDefault());
                Data.Add(el);
            }

            BindData();
        }
        protected void HandleChanges(object sender, BeforeStoreChangedEventArgs e)
        {
            ChangeRecords<HistMovimentacao> persons = e.DataHandler.ObjectData<HistMovimentacao>();

            foreach (HistMovimentacao created in persons.Created)
            {
                int tempId = created.ICodigo;
                int newId = this.AddPerson(created);

                if (Store2.UseIdConfirmation)
                {
                    e.ConfirmationList.ConfirmRecord(tempId.ToString(), newId.ToString());
                }
                else
                {
                    Store2.UpdateRecordId(tempId, newId);
                }

            }

            foreach (HistMovimentacao deleted in persons.Deleted)
            {
                this.DeletePerson(deleted.ICodigo);

                if (Store2.UseIdConfirmation)
                {
                    e.ConfirmationList.ConfirmRecord(deleted.ICodigo.ToString());
                }
            }

            foreach (HistMovimentacao updated in persons.Updated)
            {
                this.UpdatePerson(updated);

                if (Store2.UseIdConfirmation)
                {
                    e.ConfirmationList.ConfirmRecord(updated.ICodigo.ToString());
                }
            }
            e.Cancel = true;
        }
Пример #5
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);
            }
        }
Пример #6
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);
            }
        }
Пример #7
0
        protected virtual void OnBeforeStoreChanged(BeforeStoreChangedEventArgs e)
        {
            BeforeStoreChangedEventHandler handler = (BeforeStoreChangedEventHandler)Events[EventBeforeStoreChanged];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #8
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);
            }
        }
Пример #9
0
        protected virtual void HandleChanges(object sender, BeforeStoreChangedEventArgs e)
        {
            ChangeRecords<sysuser> persons = e.DataHandler.ObjectData<sysuser>();

            foreach (sysuser created in persons.Created) {
                string tempId = created.id;
                string newId = this.AddPerson(created);

                if (Store1.UseIdConfirmation) {
                    e.ConfirmationList.ConfirmRecord(tempId.ToString(), newId.ToString());
                } else {
                    Store1.UpdateRecordId(tempId, newId);
                }

            }

            foreach (sysuser deleted in persons.Deleted) {
                this.DeletePerson(deleted.id);

                if (Store1.UseIdConfirmation) {
                    e.ConfirmationList.ConfirmRecord(deleted.id);
                }
            }

            foreach (sysuser updated in persons.Updated) {
                this.UpdatePerson(updated);

                if (Store1.UseIdConfirmation) {
                    e.ConfirmationList.ConfirmRecord(updated.id);
                }
            }
            e.Cancel = true;
        }