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); } }
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); } }
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); } }