Beispiel #1
0
        public static string GetUniqueItemName(UploadItemSelection duplicateItem)
        {
            List <string> existingRepoItems = new List <string>();

            if (duplicateItem.UsageItem is ActivitiesGroup)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoActivitiesGroups().Select(x => x.ItemName).ToList();
            }
            else if (duplicateItem.UsageItem is Activity)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoActivities().Select(x => x.ItemName).ToList();
            }
            else if (duplicateItem.UsageItem is Act)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoActions().Select(x => x.ItemName).ToList();
            }
            else if (duplicateItem.UsageItem is VariableBase)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoVariables().Select(x => x.ItemName).ToList();
            }

            string newItemName = duplicateItem.ItemName;

            while (true)
            {
                newItemName += "_copy";

                if (!existingRepoItems.Contains(newItemName))
                {
                    return(newItemName);
                }
            }
            //TODO - find better way to get unique name
        }
Beispiel #2
0
        public static bool CheckForItemWithDuplicateName(UploadItemSelection selectedItem)
        {
            List <RepositoryItem> existingRepoItems = new List <RepositoryItem>();

            if (selectedItem.UsageItem is ActivitiesGroup)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoActivitiesGroups().Cast <RepositoryItem>().ToList();
            }
            else if (selectedItem.UsageItem is Activity)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoActivities().Cast <RepositoryItem>().ToList();
            }
            else if (selectedItem.UsageItem is Act)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoActions().Cast <RepositoryItem>().ToList();
            }
            else if (selectedItem.UsageItem is VariableBase)
            {
                existingRepoItems = App.LocalRepository.GetSolutionRepoVariables().Cast <RepositoryItem>().ToList();
            }

            if (selectedItem.ItemUploadType == UploadItemSelection.eItemUploadType.Overwrite)
            {
                existingRepoItems.Remove(selectedItem.ExistingItem);
            }

            foreach (object o in existingRepoItems)
            {
                if (((RepositoryItem)o).GetNameForFileName() == selectedItem.ItemName)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #3
0
 private void SetSamePartToAll(object sender, RoutedEventArgs e)
 {
     if (itemSelectionGrid.CurrentItem != null)
     {
         UploadItemSelection a = (UploadItemSelection)itemSelectionGrid.CurrentItem;
         foreach (UploadItemSelection itm in UploadItemSelection.mSelectedItems)
         {
             if (itm.ItemUploadType != UploadItemSelection.eItemUploadType.New)
             {
                 itm.SelectedItemPart = a.SelectedItemPart;
             }
         }
     }
     else
     {
         Reporter.ToUser(eUserMsgKey.AskToSelectItem);
     }
 }
Beispiel #4
0
        public static void Validate(UploadItemSelection selectedItem)
        {
            bool isDuplicateFound = CheckForItemWithDuplicateName(selectedItem);

            if (isDuplicateFound)
            {
                ItemValidationBase VA = CreateNewIssue((RepositoryItemBase)selectedItem.UsageItem);
                VA.IssueDescription = "Item with same name already exists";
                VA.mIssueType       = eIssueType.DuplicateName;
                VA.ItemNewName      = GetUniqueItemName(selectedItem);
                VA.IssueResolution  = "Item will be uploaded with new name: " + VA.ItemNewName;
                VA.Selected         = true;
                mIssuesList.Add(VA);
            }
            switch (selectedItem.UsageItem.GetType().Name)
            {
            case "Activity":
                ValidateActivity.Validate((Activity)selectedItem.UsageItem);
                break;
            }
        }
Beispiel #5
0
        public static string GetUniqueItemName(UploadItemSelection duplicateItem)
        {
            List <string>                 existingRepoItems = new List <string>();
            ObservableList <Activity>     activities        = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
            ObservableList <Act>          actions           = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Act>();
            ObservableList <VariableBase> variables         = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>();

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

            if (duplicateItem.UsageItem is ActivitiesGroup)
            {
                existingRepoItems = activitiesGroup.Select(x => x.ItemName).ToList();
            }
            else if (duplicateItem.UsageItem is Activity)
            {
                existingRepoItems = activities.Select(x => x.ItemName).ToList();
            }
            else if (duplicateItem.UsageItem is Act)
            {
                existingRepoItems = actions.Select(x => x.ItemName).ToList();
            }
            else if (duplicateItem.UsageItem is VariableBase)
            {
                existingRepoItems = variables.Select(x => x.ItemName).ToList();
            }

            string newItemName = duplicateItem.ItemName;

            while (true)
            {
                newItemName += "_copy";

                if (!existingRepoItems.Contains(newItemName))
                {
                    return(newItemName);
                }
            }
            //TODO - find better way to get unique name
        }
Beispiel #6
0
        public static bool CheckForItemWithDuplicateName(UploadItemSelection selectedItem)
        {
            List <RepositoryItemBase>        existingRepoItems = new List <RepositoryItemBase>();
            ObservableList <Activity>        activities        = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
            ObservableList <Act>             SharedActions     = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Act>();
            ObservableList <VariableBase>    variables         = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>();
            ObservableList <ActivitiesGroup> activitiesGroup   = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>();

            if (selectedItem.UsageItem is ActivitiesGroup)
            {
                existingRepoItems = activitiesGroup.Cast <RepositoryItemBase>().ToList();
            }
            else if (selectedItem.UsageItem is Activity)
            {
                existingRepoItems = activities.Cast <RepositoryItemBase>().ToList();
            }
            else if (selectedItem.UsageItem is Act)
            {
                existingRepoItems = SharedActions.Cast <RepositoryItemBase>().ToList();
            }
            else if (selectedItem.UsageItem is VariableBase)
            {
                existingRepoItems = variables.Cast <RepositoryItemBase>().ToList();
            }

            if (selectedItem.ItemUploadType == UploadItemSelection.eItemUploadType.Overwrite)
            {
                existingRepoItems.Remove(selectedItem.ExistingItem);
            }

            foreach (object o in existingRepoItems)
            {
                if (((RepositoryItemBase)o).GetNameForFileName() == selectedItem.ItemName)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #7
0
 public static List <ItemValidationBase> GetAllIssuesForItem(UploadItemSelection item)
 {
     return(mIssuesList.Where(x => x.UsageItem.Guid == item.UsageItem.Guid).ToList());
 }