示例#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);
            }
        }
示例#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);
        }
示例#3
0
 public BeforeStoreChangedEventArgs(string jsonData, ConfirmationList confirmationList, XmlNode callbackParams)
     : this(jsonData, confirmationList)
 {
     this.ajaxPostBackParams = callbackParams;
 }
示例#4
0
 public BeforeStoreChangedEventArgs(string jsonData, ConfirmationList confirmationList)
 {
     this.jsonData         = jsonData;
     this.cancel           = false;
     this.confirmationList = confirmationList;
 }
示例#5
0
 public AfterStoreChangedEventArgs(bool success, Exception exception, ConfirmationList confirmationList)
 {
     this.exception        = exception;
     this.confirmationList = confirmationList;
     this.success          = success;
 }