Esempio n. 1
0
        public override RepositoryItemBase GetUpdatedRepoItem(RepositoryItemBase itemToUpload, RepositoryItemBase existingRepoItem, string itemPartToUpdate)
        {
            Activity updatedActivity = null;

            //update required part
            eItemParts ePartToUpdate = (eItemParts)Enum.Parse(typeof(eItemParts), itemPartToUpdate);

            switch (ePartToUpdate)
            {
            case eItemParts.All:

            case eItemParts.Details:
                updatedActivity = (Activity)itemToUpload.CreateCopy(false);

                if (ePartToUpdate == eItemParts.Details)
                {
                    updatedActivity.Acts      = ((Activity)existingRepoItem).Acts;
                    updatedActivity.Variables = ((Activity)existingRepoItem).Variables;
                }

                break;

            case eItemParts.Actions:
                updatedActivity      = (Activity)existingRepoItem.CreateCopy(false);
                updatedActivity.Acts = ((Activity)itemToUpload).Acts;
                break;

            case eItemParts.Variables:
                updatedActivity           = (Activity)existingRepoItem.CreateCopy(false);
                updatedActivity.Variables = ((Activity)itemToUpload).Variables;
                break;
            }

            return(updatedActivity);
        }
Esempio n. 2
0
        public override void UpdateInstance(RepositoryItemBase instance, string partToUpdate, RepositoryItemBase hostItem = null, object extraDetails = null)
        {
            Activity activityInstance = (Activity)instance;
            //Create new instance of source
            Activity newInstance = (Activity)this.CreateInstance();


            newInstance.IsSharedRepositoryInstance = true;

            //update required part
            eItemParts ePartToUpdate = (eItemParts)Enum.Parse(typeof(eItemParts), partToUpdate);

            switch (ePartToUpdate)
            {
            case eItemParts.All:
            case eItemParts.Details:
                newInstance.Guid              = activityInstance.Guid;
                newInstance.ParentGuid        = activityInstance.ParentGuid;
                newInstance.ExternalID        = activityInstance.ExternalID;
                newInstance.ActivitiesGroupID = activityInstance.ActivitiesGroupID;
                //newInstance.ActivitiesGroupColor = activityInstance.ActivitiesGroupColor;
                newInstance.TargetApplication     = activityInstance.TargetApplication;
                newInstance.Active                = activityInstance.Active;
                newInstance.VariablesDependencies = activityInstance.VariablesDependencies;
                if (ePartToUpdate == eItemParts.Details)
                {
                    //keep other parts
                    newInstance.Acts      = activityInstance.Acts;
                    newInstance.Variables = activityInstance.Variables;
                }
                if (instance.ExternalID == this.ExternalID)
                {
                    AddExistingSelectionListVariabelesValues(newInstance, activityInstance);    //increase selection list vars values- needed for GingerATS integration so based on External ID
                }
                if (hostItem != null)
                {
                    //replace old instance object with new
                    int originalIndex = ((BusinessFlow)hostItem).Activities.IndexOf(activityInstance);
                    ((BusinessFlow)hostItem).Activities.Remove(activityInstance);
                    ((BusinessFlow)hostItem).Activities.Insert(originalIndex, newInstance);
                }
                break;

            case eItemParts.Actions:
                if (hostItem != null)
                {
                    activityInstance.Acts = newInstance.Acts;
                    BusinessFlow currentBF = hostItem as BusinessFlow;
                    currentBF.Activities = currentBF.Activities;
                    //int originalIndex = ((BusinessFlow)hostItem).Activities.IndexOf(activityInstance);
                    //(hostItem as BusinessFlow).Activities.Remove(activityInstance);
                    //(hostItem as BusinessFlow).Activities.Insert(originalIndex, activityInstance);
                }
                break;

            case eItemParts.Variables:
                activityInstance.Variables = newInstance.Variables;
                break;
            }
        }
Esempio n. 3
0
        public override RepositoryItemBase GetUpdatedRepoItem(RepositoryItemBase itemToUpload, RepositoryItemBase existingRepoItem, string itemPartToUpdate)
        {
            ActivitiesGroup updatedGroup = null;

            //update required part
            eItemParts ePartToUpdate = (eItemParts)Enum.Parse(typeof(eItemParts), itemPartToUpdate);

            switch (ePartToUpdate)
            {
            case eItemParts.All:
            case eItemParts.Details:
                updatedGroup = (ActivitiesGroup)itemToUpload.CreateCopy(false);

                if (ePartToUpdate == eItemParts.Details)
                {
                    updatedGroup.ActivitiesIdentifiers = ((ActivitiesGroup)existingRepoItem).ActivitiesIdentifiers;
                }

                break;

            case eItemParts.Activities:
                updatedGroup = (ActivitiesGroup)existingRepoItem.CreateCopy(false);
                updatedGroup.ActivitiesIdentifiers = ((ActivitiesGroup)itemToUpload).ActivitiesIdentifiers;
                break;
            }

            return(updatedGroup);
        }
Esempio n. 4
0
        public override RepositoryItemBase GetUpdatedRepoItem(RepositoryItemBase itemToUpload, RepositoryItemBase existingRepoItem, string itemPartToUpdate)
        {
            VariableBase updatedVariable = null;

            //update required part
            eItemParts ePartToUpdate = (eItemParts)Enum.Parse(typeof(VariableBase.eItemParts), itemPartToUpdate);

            switch (ePartToUpdate)
            {
            case eItemParts.All:
                updatedVariable = (VariableBase)itemToUpload.CreateCopy(false);

                break;
            }

            return(updatedVariable);
        }