public int GetProjectIDFromMetaData(IProjectMetaDataLoader projectMetaDataLoader)
        {
            if (!IsLoaded)
            {
                throw new Exception("ConfigurationHolder has not been loaded yet");
            }

            if (projectMetaDataLoader == null)
            {
                return(-1);
            }

            // a couple checks moved down from ctor
            if (!_metaData.ContainsKey(-1))
            {
                throw new Exception("MetaData needs an entry for the 'non-project', _fk_ProjectID = -1");
            }
            if (!_metaData[-1].ContainsKey("ProjectMap"))
            {
                throw new Exception("MetaData needs a 'ProjectMap' value for GroupName");
            }
            MetaDataEntry e = projectMetaDataLoader.GetProjectMetaDataEntry(_metaData[-1]["ProjectMap"]);

            return(e == null ? -1 : e.IntVal);
        }
 public void SetProject(IProjectMetaDataLoader projectMetaDataLoader)
 {
     this.projectMetaDataLoader = projectMetaDataLoader;
     if (this.Blueprint != null && ConfigurationHolder.IsLoaded && this.ProjectMetaDataLoader != null)
     {
         this.projectID = ServiceLocator.Resolve <ConfigurationHolder>().GetProjectIDFromMetaData(this.ProjectMetaDataLoader);
     }
     else
     {
         this.projectID = -1;
     }
 }
 public TestResult(TestBlueprint blueprint, string name, string subject, string gradeBand, int itemBank,
                   int handscoringProjectID, string testId, string contract, string mode, long tisRequestID, IProjectMetaDataLoader projectMetaDataLoader)
 {
     this.Blueprint    = blueprint;
     this.test         = new Test(gradeBand, mode, contract, itemBank, testId, subject, name, handscoringProjectID);
     this.tisRequestID = tisRequestID;
     this.SetProject(projectMetaDataLoader);
 }