コード例 #1
0
 public void Create3Versions(int numberOfVersions)
 {
   ProductVersion version = null;
   ProductVersion priorVersion = null;
   for (int i = 0; i < numberOfVersions; i++)
     using (SessionNoServer session = new SessionNoServer(systemDir))
     {
       session.BeginUpdate();
       IssueTracker issueTracker = (IssueTracker)session.Open(IssueTracker.PlaceInDatabase, 1, 1, false);
       User user = issueTracker.UserSet.Keys[rand.Next(issueTracker.UserSet.Keys.Count - 1)];
       string v = "version" + i.ToString();
       string d = "vdescription" + i.ToString();
       version = new ProductVersion(user, v, d, null);
       version.Persist(session, priorVersion ?? version);
       issueTracker.VersionSet.Add(version);
       priorVersion = version;
       session.Commit();
     }
 }
コード例 #2
0
 public void UpdateVersion(EditedVersion newValues)
 {
   try
   {
     using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, true))
     {
       session.BeginUpdate();
       if (newValues.Id == 0)
       {
         if (newValues.Name == null)
           Console.WriteLine("ProductVersion null storeName detected in Update method");
         else
         {
           IssueTracker issueTracker = (IssueTracker)session.Open(IssueTracker.PlaceInDatabase, 1, 1, false);
           User user = lookupUser(issueTracker, session);
           ProductVersion newVersion = new ProductVersion(user, newValues.Name, newValues.Description, newValues.ReleaseDate);
           Placement placer = new Placement(newVersion.PlacementDatabaseNumber);
           newVersion.Persist(placer, session);
           issueTracker.VersionSet.Add(newVersion);
         }
       }
       else
       {
         ProductVersion existingVersion = (ProductVersion)session.Open(newValues.Id);
         existingVersion.Name = newValues.Name;
         existingVersion.Description = newValues.Description;
         existingVersion.ReleaseDate = newValues.ReleaseDate;
       }
       session.Commit();
     }
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
 }
コード例 #3
0
    void createInitialObjects(IssueTracker issueTracker, User user, SessionBase session)
    {
      Project project = new Project(user, "VelocityDB", "Object Database Management System");
      project.Persist(session, project);
      issueTracker.ProjectSet.Add(project);

      Component webSite = new Component(user, "Web Site", "VelocityDB.com", project);
      webSite.Persist(session, webSite);
      issueTracker.ComponentSet.Add(webSite);

      Component samples = new Component(user, "Samples", "Samples applications provided", project);
      samples.Persist(session, webSite);
      issueTracker.ComponentSet.Add(samples);

      Component collections = new Component(user, "Collections", "Any of the collection classes", project);
      collections.Persist(session, samples);
      issueTracker.ComponentSet.Add(collections);

      Component performance = new Component(user, "Performance", "Any performance issue", project);
      performance.Persist(session, collections);
      issueTracker.ComponentSet.Add(performance);

      ProductVersion version = new ProductVersion(user, "0.8", "First initial version", new DateTime(2011, 08, 01));
      version.Persist(session, version);
      issueTracker.VersionSet.Add(version);
    }