Example #1
0
        public override bool ExecutePackage(Makolab.Commons.Communication.ICommunicationPackage communicationPackage)
        {
            try
            {
                XDocument rulesXml = XDocument.Parse(communicationPackage.XmlData.Content);

                if (rulesXml.Root.Attribute("isCommunication") == null)
                {
                    rulesXml.Root.Add(new XAttribute("isCommunication", "true"));
                }
                else
                {
                    rulesXml.Root.Attribute("isCommunication").Value = "true";
                }

                this.repository.SetPriceRuleList(rulesXml);
            }
            catch (SqlException e)
            {
                if (e.Number == 50012) // Conflict detection
                {
                    throw new ConflictException("Conflict detected while execution package order=" + communicationPackage.OrderNumber + " id=" + communicationPackage.XmlData.Id);
                }
                else
                {
                    this.Log.Error("SnapshotScript:ExecutePackage " + e.ToString());
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Executes the communication package.
        /// </summary>
        /// <param name="communicationPackage">The communication package to execute.</param>
        /// <returns>
        ///     <c>true</c> if execution succeeded; otherwise, <c>false</c>
        /// </returns>
        public override bool ExecutePackage(Makolab.Commons.Communication.ICommunicationPackage communicationPackage)
        {
            XDocument commXml = XDocument.Parse(communicationPackage.XmlData.Content);

            try
            {
                string dictionaryName             = commXml.Root.Elements().First().Name.LocalName;
                string cappitalizedDictionaryName = dictionaryName.Capitalize();

                this.mainObjectTag = dictionaryName;

                return(base.ExecutePackage(communicationPackage));
            }
            catch (SqlException e)
            {
                if (e.Number == 50012) // Conflict detection
                {
                    throw new ConflictException("Conflict detected while changing dictionary");
                }
                else
                {
                    this.Log.Error("SnapshotScript:ExecutePackage " + e.ToString());
                    return(false);
                }
            }
        }