// returns 0 on success
        public int AddSpinoff(string symbol, DateTime eventDate, string xml = "<Deliverables></Deliverables>")
        {
            ClearErrorState();
            int rc = 8;

            try
            {
                if ((!IsInitialized) || (m_hugoConnection == null))
                {
                    throw new Exception("HugoCorporateActionsLib not initialized");
                }

                using (HugoDataSetTableAdapters.QueriesTableAdapter queryAdapter = new HugoDataSetTableAdapters.QueriesTableAdapter())
                {
                    queryAdapter.Connection = m_hugoConnection;
                    queryAdapter.SetAllCommandTimeouts(m_timeOut);
                    queryAdapter.p_add_spinoff(null, 0, eventDate, null, null, null, null, symbol, null, null, null, xml);

                    queryAdapter.LogSqlCommand("CorporateActions.p_add_spinoff");
                    rc = queryAdapter.GetReturnCode("CorporateActions.p_add_spinoff");
                }
            }
            catch (Exception ex)
            {
                Error("Error inserting spinoffs", ex);
            }

            Info(String.Format("Inserted spinoff"));
            return(rc);
        }
        public int InsertCorporateActions(string provider, string xml, DateTime?importDate, bool restart)
        {
            int?numberRecordsInserted = 0;

            ClearErrorState();

            try
            {
                if ((!IsInitialized) || (m_hugoConnection == null))
                {
                    throw new Exception("HugoCorporateActionsLib not initialized");
                }

                using (HugoDataSetTableAdapters.QueriesTableAdapter queryAdapter = new HugoDataSetTableAdapters.QueriesTableAdapter())
                {
                    queryAdapter.Connection = m_hugoConnection;
                    queryAdapter.SetAllCommandTimeouts(m_timeOut);
                    queryAdapter.p_insert_CorporateActions(provider, xml, importDate, ref numberRecordsInserted, restart, false);

                    queryAdapter.LogSqlCommand("CorporateActions.p_insert_CorporateActions");
                }
            }
            catch (Exception ex)
            {
                numberRecordsInserted = 0;
                Error("Error inserting corporate actions", ex);
            }

            if (numberRecordsInserted.Value > 0)
            {
                Info("Break");
            }
            Info(String.Format("Inserted {0} corporate actions", numberRecordsInserted));
            return(numberRecordsInserted.Value);
        }