コード例 #1
0
        public void CommitChanges(IAssetCache assetCache)
        {
            if (!connector.IsConnected)
            {
                Logger.Error("Not connected to VersionOne.");
            }

            try {
                var validationResult = new Dictionary <Asset, List <RequiredFieldsDto> >();
                var internalCache    = assetCache.ToInternalCache();

                var workitems = assetCache.GetWorkitems(true);

                foreach (var item in workitems)
                {
                    if (!ValidateWorkitemAndCommitOnSuccess(item, internalCache.Efforts, validationResult))
                    {
                        continue;
                    }

                    foreach (var child in item.Children)
                    {
                        ValidateWorkitemAndCommitOnSuccess(child, internalCache.Efforts, validationResult);
                    }
                }

                if (validationResult.Count > 0)
                {
                    throw new ValidatorException(requiredFieldsValidator.CreateErrorMessage(validationResult));
                }
            } catch (APIException ex) {
                Logger.Error("Failed to commit changes.", ex);
            }
        }
コード例 #2
0
 public ICollection <Workitem> GetWorkitems()
 {
     try {
         // NOTE this may be totally wrong - DataLayer object is shared among many clients. But it is not thread safe, that's why local lock object is not used
         lock (DataLayer) {
             DataLayer.GetWorkitems(assetCache);
             return(assetCache.GetWorkitems(!Settings.ShowMyTasks));
         }
     } catch (DataLayerException) {
         view.ShowErrorMessage("Unable to download workitems.");
         return(null);
     }
 }
コード例 #3
0
        public void CommitChanges(IAssetCache assetCache) {
            if(!connector.IsConnected) {
                Logger.Error("Not connected to VersionOne.");
            }

            try {
                var validationResult = new Dictionary<Asset, List<RequiredFieldsDto>>();
                var internalCache = assetCache.ToInternalCache();

                var workitems = assetCache.GetWorkitems(true);

                foreach(var item in workitems) {
                    if(!ValidateWorkitemAndCommitOnSuccess(item, internalCache.Efforts, validationResult)) {
                        continue;
                    }

                    foreach(var child in item.Children) {
                        ValidateWorkitemAndCommitOnSuccess(child, internalCache.Efforts, validationResult);
                    }
                }

                if(validationResult.Count > 0) {
                    throw new ValidatorException(requiredFieldsValidator.CreateErrorMessage(validationResult));
                }

            } catch(APIException ex) {
                Logger.Error("Failed to commit changes.", ex);
            }
        }