Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        public ConfirmationList BuildConfirmationList(string idColumnName)
        {
            if (string.IsNullOrEmpty(idColumnName))
            {
                return(null);
            }

            ConfirmationList confirmationList = new ConfirmationList();

            XmlNodeList records = this.XmlData.SelectNodes("records/*/record");

            foreach (XmlNode node in records)
            {
                XmlNode keyNode = node.SelectSingleNode(idColumnName);
                if (string.IsNullOrEmpty(keyNode.InnerText))
                {
                    throw new InvalidOperationException("No id in submitted record");
                }
                confirmationList.Add(keyNode.InnerText, new ConfirmationRecord(false, keyNode.InnerText));
            }

            return(confirmationList);
        }
Esempio n. 3
0
 public BeforeStoreChangedEventArgs(string jsonData, ConfirmationList confirmationList, XmlNode callbackParams)
     : this(jsonData, confirmationList)
 {
     this.ajaxPostBackParams = callbackParams;
 }
Esempio n. 4
0
 public BeforeStoreChangedEventArgs(string jsonData, ConfirmationList confirmationList)
 {
     this.jsonData         = jsonData;
     this.cancel           = false;
     this.confirmationList = confirmationList;
 }
Esempio n. 5
0
 public AfterStoreChangedEventArgs(bool success, Exception exception, ConfirmationList confirmationList)
 {
     this.exception        = exception;
     this.confirmationList = confirmationList;
     this.success          = success;
 }