Exemplo n.º 1
0
        private void SetRepoLinkStatus()
        {
            mLinkedRepoItem     = null;
            mLinkIsByExternalID = false;
            mLinkIsByParentID   = false;

            EditLinkedRepoItemBtn.Visibility = Visibility.Collapsed;
            UpdateRepoBtn.Visibility         = Visibility.Collapsed;

            //get the item from shared repo if exist
            mLinkedRepoItem = SharedRepositoryOperations.GetMatchingRepoItem(mItem, null, ref mLinkIsByExternalID, ref mLinkIsByParentID);
            if (mLinkedRepoItem == null)
            {
                LinkStatusImage.Source  = General.GetResourceImage("@StarGray_24x24.png");
                LinkStatusImage.ToolTip = "The item is not linked to Shared Repository." + Environment.NewLine + "Click to add it to Shared Repository.";
                UpdateRepoBtn.ToolTip   = "Upload to Shared Repository";
            }
            else
            {
                LinkStatusImage.Source = General.GetResourceImage("@Star_24x24.png");

                string ItemName = Amdocs.Ginger.Common.GeneralLib.General.RemoveInvalidFileNameChars(mLinkedRepoItem.ItemName);

                if (mLinkIsByParentID || mLinkIsByExternalID)
                {
                    LinkStatusImage.ToolTip = "The item is linked to the Shared Repository item: '" + Path.Combine(mLinkedRepoItem.ContainingFolder, ItemName) + "'." + Environment.NewLine + "Click to un-link it.";
                }
                else
                {
                    LinkStatusImage.ToolTip = "The item is linked to the Shared Repository item: '" + Path.Combine(mLinkedRepoItem.ContainingFolder, ItemName) + "'.";
                }
                UpdateRepoBtn.ToolTip = "Overwrite Shared Repository linked item";
            }
        }
        public RepositoryItemBase ExistingItemCheck(object item, ref string strComment, ref UploadItemSelection.eExistingItemType existingItemType)
        {
            IEnumerable <object> existingRepoItems = new ObservableList <RepositoryItem>();
            bool   existingItemIsExternalID        = false;
            bool   existingItemIsParent            = false;
            string existingItemFileName            = string.Empty;

            ObservableList <ActivitiesGroup> activitiesGroup = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>();

            if (item is ActivitiesGroup)
            {
                existingRepoItems = (IEnumerable <object>)activitiesGroup;
            }
            else if (item is Activity)
            {
                existingRepoItems = (IEnumerable <object>)WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
            }
            else if (item is Act)
            {
                existingRepoItems = (IEnumerable <object>)WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Act>();
            }
            else if (item is VariableBase)
            {
                existingRepoItems = (IEnumerable <object>)WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>();
            }

            RepositoryItemBase exsitingItem = SharedRepositoryOperations.GetMatchingRepoItem((RepositoryItemBase)item, existingRepoItems, ref existingItemIsExternalID, ref existingItemIsParent);

            if (exsitingItem != null)
            {
                existingItemFileName = exsitingItem.FileName;

                if (existingItemIsExternalID)
                {
                    strComment       = "Item with Same External Id Exist. Back up of existing item will be saved in PrevVersion folder.Change the item upload type if you want to upload it as new item";
                    existingItemType = UploadItemSelection.eExistingItemType.ExistingItemIsExternalID;
                }
                else if (existingItemIsParent)
                {
                    strComment       = "Parent item exist in repository. Back up of existing item will be saved in PrevVersion folder.Change the item upload type if you want to upload it as new item";
                    existingItemType = UploadItemSelection.eExistingItemType.ExistingItemIsParent;
                }
                else
                {
                    strComment       = "Item already exist in repository. Back up of existing item will be saved in PrevVersion folder.Change the item upload type if you want to upload it as new item";
                    existingItemType = UploadItemSelection.eExistingItemType.ExistingItemIsDuplicate;
                }
            }
            return(exsitingItem);
        }