Exemplo n.º 1
0
        protected void DiscoveryUrl_Update(object sender, DataGridCommandEventArgs e)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                int index = grid.EditItemIndex;

                if (index == discoveryUrls.Count)
                {
                    discoveryUrls.Add();
                }

                DiscoveryUrl discoveryUrl = discoveryUrls[index];

                DataGridItem item = grid.Items[index];

                discoveryUrl.Value   = ((TextBox)item.FindControl("discoveryUrl")).Text;
                discoveryUrl.UseType = ((TextBox)item.FindControl("useType")).Text;


                parentEntity.Save();

                grid.EditItemIndex = -1;
                grid.ShowFooter    = true;

                CancelEditMode();

                this.discoveryUrls = ShuffleData(parentEntity.DiscoveryUrls);

                PopulateDataGrid();
            }
        }
Exemplo n.º 2
0
        /// ****************************************************************
        ///   public FindByDiscoveryUrls
        /// ----------------------------------------------------------------
        ///   <summary>
        ///   </summary>
        /// ----------------------------------------------------------------
        ///   <param name="discoveryUrls">
        ///   </param>
        /// ****************************************************************
        ///
        public int FindByDiscoveryUrls(DiscoveryUrlCollection discoveryUrls)
        {
            SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();

            sp.ProcedureName = "net_find_" + entityName + "_discoveryURL";

            sp.Parameters.Add("@contextID", SqlDbType.UniqueIdentifier);
            sp.Parameters.Add("@useType", SqlDbType.NVarChar, UDDI.Constants.Lengths.UseType);
            sp.Parameters.Add("@discoveryURL", SqlDbType.NVarChar, UDDI.Constants.Lengths.DiscoveryURL);
            sp.Parameters.Add("@rows", SqlDbType.Int, ParameterDirection.Output);

            sp.Parameters.SetGuid("@contextID", Context.ContextID);

            int rows = 0;

            foreach (DiscoveryUrl discoveryUrl in discoveryUrls)
            {
                sp.Parameters.SetString("@useType", discoveryUrl.UseType);
                sp.Parameters.SetString("@discoveryURL", discoveryUrl.Value);

                sp.ExecuteNonQuery();

                rows = sp.Parameters.GetInt("@rows");
            }

            return(ScratchCommit());
        }
Exemplo n.º 3
0
        protected void DiscoveryUrl_Delete(object sender, DataGridCommandEventArgs e)
        {
            int index = e.Item.ItemIndex;

            discoveryUrls.RemoveAt(index);

            parentEntity.Save();

            grid.EditItemIndex = -1;

            this.discoveryUrls = ShuffleData(parentEntity.DiscoveryUrls);

            PopulateDataGrid();
        }
Exemplo n.º 4
0
 DiscoveryUrlCollection ShuffleData(DiscoveryUrlCollection discurls)
 {
     foreach (DiscoveryUrl d in discurls)
     {
         // move the default one to the begining of the list to
         // fix bug: 1229
         if (d.IsDefault(BusinessKey))
         {
             discurls.Remove(d);
             discurls.Insert(0, d);
             break;
         }
     }
     return(discurls);
 }
Exemplo n.º 5
0
        public void Initialize(DiscoveryUrlCollection discUrls, BusinessEntity parentEntity)
        {
            //set the parenet entity
            this.parentEntity = parentEntity;

            //capture the be key
            this.BusinessKey = this.parentEntity.BusinessKey;

            //reorganize the discoveryUrls to mantian order.
            //we need the default to be the first in the collection.
            this.discoveryUrls = ShuffleData(discUrls);


            grid.Columns[1].Visible = true;
        }
Exemplo n.º 6
0
        static void LogFixStart(DiscoveryUrlCollection filteredList)
        {
            Log("\tSTART Fixing duplicates; new DiscoveryUrl list will be:");

            if (filteredList.Count == 0)
            {
                Log("\t\tNo Discovery Urls besides default.");
            }
            else
            {
                foreach (DiscoveryUrl discoveryUrl in filteredList)
                {
                    Log("\t\t" + discoveryUrl.Value);
                }
            }
        }
Exemplo n.º 7
0
        static DiscoveryUrlCollection GetFilterList(BusinessEntity businessEntity)
        {
            DiscoveryUrlCollection filterList = new DiscoveryUrlCollection();

            //
            // Get the default URL
            //
            string defaultDiscoveryUrl = Config.GetString("DefaultDiscoveryURL") + businessEntity.BusinessKey;

            foreach (DiscoveryUrl discoveryUrl in businessEntity.DiscoveryUrls)
            {
                //
                // Do a case in-sensitive search
                //
                if (string.Compare(discoveryUrl.Value, defaultDiscoveryUrl, true) != 0)
                {
                    filterList.Add(discoveryUrl);
                }
            }

            return(filterList);
        }
Exemplo n.º 8
0
        static void FixDefaultURLs()
        {
            //
            // Get a list of business keys that have non-default discovery URLs.
            //
            ArrayList businessEntities = GetBusinessEntities();
            int       total            = businessEntities.Count;
            int       current          = 1;
            int       numberFixed      = 0;

            foreach (BusinessEntity businessEntity in businessEntities)
            {
                //
                // Get values for this business.
                //
                businessEntity.Get();

                //
                // BusinessEntity.Get() may add the default one, we don't want it.
                //
                DiscoveryUrlCollection originalList = new DiscoveryUrlCollection();
                originalList.Get(businessEntity.BusinessKey);
                businessEntity.DiscoveryUrls = originalList;

                Log("*** Processing " + current++ + "/" + total + " *** ");

                LogStartBusinessEntity(businessEntity);

                DiscoveryUrlCollection filteredList = GetFilterList(businessEntity);

                if (filteredList.Count < businessEntity.DiscoveryUrls.Count)
                {
                    try
                    {
                        numberFixed++;

                        LogFixStart(filteredList);

                        ConnectionManager.BeginTransaction();

                        //
                        // Remove duplicate discovery URLs
                        //
                        businessEntity.DiscoveryUrls = filteredList;

                        //
                        // Fix change records
                        //
                        FixChangeRecords(businessEntity);

                        //
                        // Fix data.  Saving the BusinessEntity will also create a ChangeRecordNew data in our replication stream.
                        // Other operators will consume this change record, which will update their databases.
                        //

                        FixData(businessEntity);
#if never
                        ChangeRecordNewData changeRecordNewData = new ChangeRecordNewData(businessEntity);
                        ChangeRecord        fixData             = new ChangeRecord(changeRecordNewData);
                        fixData.Process();
#endif
                        ConnectionManager.Commit();

                        LogFixEnd(businessEntity);
                    }
                    catch (Exception e)
                    {
                        WriteException(e);
                        ConnectionManager.Abort();
                    }
                }
                LogDoneBusinessEntity(businessEntity);
            }
            Log("BusinessEntities fixed: " + numberFixed);
        }
Exemplo n.º 9
0
 public void Initialize(DiscoveryUrlCollection discUrls)
 {
     this.discoveryUrls      = ShuffleData(discUrls);
     grid.Columns[1].Visible = false;
 }