Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public override void UpdateInstance(RepositoryItemBase instance, string partToUpdate, RepositoryItemBase hostItem = null)
        {
            VariableBase variableBaseInstance = (VariableBase)instance;

            //Create new instance of source
            VariableBase newInstance = (VariableBase)this.CreateInstance();

            newInstance.IsSharedRepositoryInstance = true;

            //update required part
            VariableBase.eItemParts ePartToUpdate = (VariableBase.eItemParts)Enum.Parse(typeof(VariableBase.eItemParts), partToUpdate);
            switch (ePartToUpdate)
            {
            case eItemParts.All:
                //case eItemParts.Details:
                newInstance.Guid       = variableBaseInstance.Guid;
                newInstance.ParentGuid = variableBaseInstance.ParentGuid;
                newInstance.ExternalID = variableBaseInstance.ExternalID;
                //if (ePartToUpdate == eItemParts.Details)
                //{
                //}
                if (hostItem != null)
                {
                    //replace old instance object with new
                    int originalIndex = 0;

                    //TODO: Fix the issues
                    if (hostItem is Activity)
                    {
                        originalIndex = ((Activity)hostItem).GetVariables().IndexOf(variableBaseInstance);
                        ((Activity)hostItem).GetVariables().Remove(variableBaseInstance);
                        ((Activity)hostItem).GetVariables().Insert(originalIndex, newInstance);
                    }
                    else
                    {
                        originalIndex = ((BusinessFlow)hostItem).GetVariables().IndexOf(variableBaseInstance);
                        ((BusinessFlow)hostItem).GetVariables().Remove(variableBaseInstance);
                        ((BusinessFlow)hostItem).GetVariables().Insert(originalIndex, newInstance);
                    }
                }
                break;
            }
        }