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);
        }
Пример #2
0
 private void RefreshActivitiesGrid()
 {
     if (mBusinessFlow != null)
     {
         grdActivities.Title = "'" + mBusinessFlow.Name + "' - " + GingerDicser.GetTermResValue(eTermResKey.Activities);
         ObservableList <Activity> activities = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
         SharedRepositoryOperations.MarkSharedRepositoryItems((IEnumerable <object>)mBusinessFlow.Activities, (IEnumerable <object>)activities);
         grdActivities.DataSourceList = mBusinessFlow.Activities;
     }
     else
     {
         grdActivities.DataSourceList = new ObservableList <Activity>();
     }
 }
Пример #3
0
 private void FindAndRepalceSaveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (SharedRepositoryOperations.CheckIfSureDoingChange(mVariable, "change") == true)
     {
         try
         {
             WorkSpace.Instance.SolutionRepository.SaveRepositoryItem(mParent);
             saveWasDone = true;
         }
         catch
         {
             Reporter.ToUser(eUserMsgKeys.Failedtosaveitems);
         }
         _pageGenericWin.Close();
     }
 }
Пример #4
0
        public void TestBusinessFlowVariableSyncWithRepo()
        {
            string variableName = "BFV1";
            string initialValue = "123";
            string updatedValue = "abc123";

            mBF = new BusinessFlow()
            {
                Name = "TestBFVarSync", Active = true
            };

            VariableString V1 = new VariableString()
            {
                Name = variableName, InitialStringValue = initialValue
            };

            mBF.AddVariable(V1);

            // add business flow to the solution repository
            mSolutionRepository.AddRepositoryItem(mBF);

            // prepare to add the variable to the shared repository
            UploadItemSelection uploadItemSelection = new UploadItemSelection()
            {
                UsageItem = V1, ItemUploadType = UploadItemSelection.eItemUploadType.New
            };

            SharedRepositoryOperations.UploadItemToRepository(uploadItemSelection);

            // find the newly added variable from the shared repo
            VariableBase   sharedVariableBase = (from x in mSolutionRepository.GetAllRepositoryItems <VariableBase>() where x.Name == variableName select x).SingleOrDefault();
            VariableString sharedV1           = (VariableString)sharedVariableBase;

            //update the new value in the shared repo variable
            sharedV1.InitialStringValue = updatedValue;

            //sync the updated instance with the business flow instance
            sharedV1.UpdateInstance(V1, "All", mBF);

            // get the updated value from the business flow
            VariableString V2 = (VariableString)mBF.Variables[0];

            //Assert
            Assert.AreEqual(1, mBF.Variables.Count);
            Assert.AreNotSame(V1, V2);
            Assert.AreEqual(updatedValue, V2.InitialStringValue);
        }
Пример #5
0
        private void RefreshActivitiesGroupsGrid()
        {
            if (mBusinessFlow != null)
            {
                grdActivitiesGroups.Title = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups);

                ObservableList <ActivitiesGroup> sharedActivitiesGroups = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>();
                SharedRepositoryOperations.MarkSharedRepositoryItems((IEnumerable <object>)mBusinessFlow.ActivitiesGroups, (IEnumerable <object>)sharedActivitiesGroups);

                UpdateActivitiesGroupsGridViewTestSuiteColumn();
                grdActivitiesGroups.DataSourceList = mBusinessFlow.ActivitiesGroups;
            }
            else
            {
                grdActivitiesGroups.DataSourceList = new ObservableList <Activity>();
            }
        }
Пример #6
0
        private void AddToRepository(object sender, RoutedEventArgs e)
        {
            List <RepositoryItem> listOfGroups = grdActivitiesGroups.Grid.SelectedItems.Cast <RepositoryItem>().ToList();// as List<RepositoryItem>;

            List <RepositoryItem> itemsToUpload = new List <RepositoryItem>();

            foreach (RepositoryItem group in listOfGroups)
            {
                foreach (ActivityIdentifiers AI in ((ActivitiesGroup)group).ActivitiesIdentifiers)
                {
                    itemsToUpload.Add(AI.IdentifiedActivity);
                }
            }
            itemsToUpload.AddRange(listOfGroups);

            SharedRepositoryOperations.AddItemsToRepository(itemsToUpload);
        }
Пример #7
0
        private void LoadGridData()
        {
            if (mVariablesParentObj != null)
            {
                ObservableList <VariableBase> variables = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>();
                switch (mVariablesLevel)
                {
                case eVariablesLevel.Solution:
                    grdVariables.DataSourceList = ((Solution)mVariablesParentObj).Variables;
                    break;

                case eVariablesLevel.BusinessFlow:
                    if (mEditMode != General.eRIPageViewMode.Automation)
                    {
                        grdVariables.Title = GingerDicser.GetTermResValue(eTermResKey.Variables);
                    }
                    else
                    {
                        grdVariables.Title = "'" + ((BusinessFlow)mVariablesParentObj).Name + "' - " + GingerDicser.GetTermResValue(eTermResKey.Variables);
                    }
                    SharedRepositoryOperations.MarkSharedRepositoryItems((IEnumerable <object>)((BusinessFlow)mVariablesParentObj).Variables, (IEnumerable <object>)variables);
                    grdVariables.DataSourceList = ((BusinessFlow)mVariablesParentObj).Variables;
                    break;

                case eVariablesLevel.Activity:
                    if (mEditMode != General.eRIPageViewMode.Automation)
                    {
                        grdVariables.Title = GingerDicser.GetTermResValue(eTermResKey.Variables);
                    }
                    else
                    {
                        grdVariables.Title = "'" + ((Activity)mVariablesParentObj).ActivityName + "' - " + GingerDicser.GetTermResValue(eTermResKey.Variables);
                    }
                    SharedRepositoryOperations.MarkSharedRepositoryItems((IEnumerable <object>)((Activity)mVariablesParentObj).Variables, (IEnumerable <object>)variables);
                    grdVariables.DataSourceList = ((Activity)mVariablesParentObj).Variables;
                    break;
                }

                if (grdVariables.DataSourceList != null)
                {
                    grdVariables.DataSourceList.CollectionChanged -= VariablesPage_CollectionChanged;
                    grdVariables.DataSourceList.CollectionChanged += VariablesPage_CollectionChanged;
                }
            }
        }
        //private void ClearListViewBindings()
        //{
        //    if (mVariabelListHelper != null)
        //    {
        //        mVariabelListHelper.VariabelListItemEvent -= MVariabelListItemInfo_VariabelListItemEvent;
        //        mVariabelListHelper = null;
        //    }

        //    if (mVariabelsListView != null)
        //    {
        //        mVariabelsListView.PreviewDragItem -= ListVars_PreviewDragItem;
        //        mVariabelsListView.ItemDropped -= ListVars_ItemDropped;
        //        mVariabelsListView.List.MouseDoubleClick -= VariabelsListView_MouseDoubleClick;
        //        mVariabelsListView.ClearBindings();
        //        mVariabelsListView.DataSourceList = null;
        //        mVariabelsListView = null;
        //    }
        //}

        //public void ClearBindings()
        //{
        //    xMainFrame.Content = null;
        //    xMainFrame.NavigationService.RemoveBackEntry();

        //    ClearListViewBindings();

        //    BindingOperations.ClearAllBindings(xSelectedItemTitleText);
        //    BindingOperations.ClearAllBindings(xResetValueBtn);
        //    BindingOperations.ClearAllBindings(xAutoValueBtn);
        //    this.ClearControlsBindings();
        //}

        private void SetListView()
        {
            if (mVariabelsListView == null)
            {
                mVariabelsListView               = new UcListView();
                mVariabelsListView.Title         = GingerDicser.GetTermResValue(eTermResKey.Variables);
                mVariabelsListView.ListImageType = Amdocs.Ginger.Common.Enums.eImageType.Variable;

                mVariabelListHelper = new VariablesListViewHelper(GetVariablesList(), mVariabelsParent, mVariablesLevel, mContext, mPageViewMode);
                mVariabelListHelper.VariabelListItemEvent += MVariabelListItemInfo_VariabelListItemEvent;
                mVariabelsListView.SetDefaultListDataTemplate(mVariabelListHelper);

                mVariabelsListView.ListSelectionMode = SelectionMode.Extended;

                mVariabelsListView.PreviewDragItem += ListVars_PreviewDragItem;
                mVariabelsListView.ItemDropped     += ListVars_ItemDropped;

                mVariabelsListView.List.MouseDoubleClick += VariabelsListView_MouseDoubleClick;

                mVariabelsListView.List.SetValue(ScrollViewer.CanContentScrollProperty, true);

                if (mPageViewMode == Ginger.General.eRIPageViewMode.View)
                {
                    mVariabelsListView.IsDragDropCompatible = false;
                }
            }

            if (mVariabelsParent != null)
            {
                mVariabelListHelper.VariablesParent = mVariabelsParent;
                mVariabelListHelper.VariablesLevel  = mVariablesLevel;
                mVariabelListHelper.Variables       = GetVariablesList();
                mVariabelsListView.DataSourceList   = GetVariablesList();
                if (mVariablesLevel != eVariablesLevel.Solution)
                {
                    SharedRepositoryOperations.MarkSharedRepositoryItems(GetVariablesList(), WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <VariableBase>());
                }
            }
            else
            {
                mVariabelListHelper.VariablesParent = null;
                mVariabelListHelper.Variables       = null;
                mVariabelsListView.DataSourceList   = null;
            }
        }
Пример #9
0
 public void UpdateActionGrid()
 {
     if (mBusinessFlow != null && mBusinessFlow.CurrentActivity != null)
     {
         if (mCurrentActivity != mBusinessFlow.CurrentActivity)
         {
             mCurrentActivity = (Activity)mBusinessFlow.CurrentActivity;
             mCurrentActivity.PropertyChanged      += Activity_PropertyChanged;
             mCurrentActivity.Acts.PropertyChanged += ActsPropChanged;
         }
         grdActions.Title = "'" + mCurrentActivity.ActivityName + "' - Actions";
         ObservableList <Act> SharedActions = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Act>();
         SharedRepositoryOperations.MarkSharedRepositoryItems((IEnumerable <object>)mCurrentActivity.Acts, (IEnumerable <object>)SharedActions);
         grdActions.DataSourceList = mCurrentActivity.Acts;
     }
     else
     {
         mCurrentActivity          = null;
         grdActions.DataSourceList = new ObservableList <Act>();
         grdActions.Title          = "Actions";
     }
 }
        public void WizardEvent(WizardEventArgs WizardEventArgs)
        {
            switch (WizardEventArgs.EventType)
            {
            case EventType.Init:
                UploadItemToRepositoryWizard = ((UploadItemToRepositoryWizard)WizardEventArgs.Wizard);
                break;

            case EventType.Active:

                ItemValidationBase.mIssuesList.Clear();
                int issuesCount = 0;
                foreach (UploadItemSelection item in UploadItemSelection.mSelectedItems)
                {
                    if (item.Selected)
                    {
                        issuesCount = ItemValidationBase.mIssuesList.Count;
                        SharedRepositoryOperations.Validate(item);
                    }
                }

                if (ItemValidationBase.mIssuesList.Count > 0)
                {
                    itemValidationGrid.DataSourceList = ItemValidationBase.mIssuesList;
                    itemValidationGrid.Visibility     = Visibility.Visible;
                    xLabelMessage.Visibility          = Visibility.Collapsed;
                }
                else
                {
                    itemValidationGrid.Visibility = Visibility.Collapsed;
                    xLabelMessage.Visibility      = Visibility.Visible;

                    xLabelMessage.Content = "No Validation Issues Found. Proceed with Item/s Upload";
                }
                break;
            }
        }
Пример #11
0
        private void SetSharedRepositoryMark()
        {
            ObservableList <Act> sharedActions = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Act>();

            SharedRepositoryOperations.MarkSharedRepositoryItems((IEnumerable <object>)mActivity.Acts, (IEnumerable <object>)sharedActions);
        }
 public bool IsSharedRepositoryItem(RepositoryItemBase item)
 {
     return(SharedRepositoryOperations.IsSharedRepositoryItem(item));
 }