private bool UpdateProcedureItem(ListViewItem item, PLSQLProcedure procedure, bool reloadExisting)
        {
            if (reloadExisting || existingPackage == null)
            {
                GetExistingPackage(lastReadPLSQLSpec.PackageName);
            }

            StoredProcedure storedProc = StoredProcedureHelper.CreateStoredProcedure(procedure);

            // Check if procedure is imported already
            bool isImported = (existingPackage != null &&
                               storedProc != null &&
                               existingPackage.Procedures.Where(p => p.Equals(storedProc)).Count() == 1);

            bool packageHasProcedureNameImported = (existingPackage != null &&
                                                    storedProc != null &&
                                                    existingPackage.Procedures.Where(p => p.ProcedureName == storedProc.ProcedureName).Count() > 0);


            ImportStoredProcedureWrapperClass wrapper = new ImportStoredProcedureWrapperClass();

            wrapper.StoredProcedure = procedure;
            wrapper.IsImported      = isImported;

            item.Text             = procedure.Name;
            item.SubItems[1].Text = procedure.Status.ToString();

            if (isImported)
            {
                item.SubItems[2].Text = "Imported";
            }
            else
            {
                if (packageHasProcedureNameImported)
                {
                    item.SubItems[2].Text = "Overloaded/Updated";
                }
                else
                {
                    item.SubItems[2].Text = "Not Imported";
                }
            }

            item.Tag = wrapper;

            if (procedure.Status != ProcedureStatus.Valid)
            {
                item.ForeColor = Color.OrangeRed;
            }
            else if (isImported)
            {
                item.ForeColor = Color.Green;
            }

            return(true);
        }
        private void EnableDisableButtons()
        {
            btnBrowse.Enabled = this.isEditable;

            if (lvFoundProcedures.SelectedItems.Count == 1)
            {
                ImportStoredProcedureWrapperClass wrapper = (ImportStoredProcedureWrapperClass)lvFoundProcedures.SelectedItems[0].Tag;

                if (wrapper.StoredProcedure.Status == ProcedureStatus.Valid)
                {
                    // Check if any imported procedures already exist with the name
                    if (existingPackage == null)
                    {
                        GetExistingPackage(lastReadPLSQLSpec.PackageName);
                    }
                }
            }
        }