Inheritance: OptimizedPersistable
Example #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();
     }
 }
Example #2
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 = session.AllObjects<IssueTracker>(false).FirstOrDefault();
       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);
       session.Persist(version);
       issueTracker.VersionSet.Add(version);
       priorVersion = version;
       session.Commit();
     }
 }
Example #3
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
   string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny<Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
   if (attachments != null)
     m_attachments = attachments;
   else
     m_attachments = new SortedSetAny<Attachment>();
   m_reportedBy = reportedBy;
   m_project = project;
   m_component = component;
   m_affectedComponentSet = new SortedSetAny<Component>(1);
   if (component != null)
     m_affectedComponentSet.Add(component);
   m_affectedVersionSet = new SortedSetAny<ProductVersion>(1);
   if (version != null)
     m_affectedVersionSet.Add(version);
   m_voteSet = new SortedSetAny<Vote>(1);
   m_relatedIssueSet = new SortedSetAny<Issue>(1);
   m_fixedInVersionSet = new SortedSetAny<ProductVersion>(1);
   m_subTaskSet = new SortedSetAny<SubTask>(1);
   m_labelSet = new SortedSetAny<ProductLabel>(1);
   m_version = version;
   m_summary = summary;
   m_description = description;
   m_environment = environment;
   m_category = category;
   m_priority = priority;
   m_fixResolution = resolution;
   m_dateTimeCreated = DateTime.Now;
   m_dateTimeLastUpdated = m_dateTimeCreated;
   m_fixmessage = null;
   m_lastUpdatedBy = reportedBy;
   m_dueDate = dueDate;
   m_status = status;
   AssignedTo = assignedTo;
   m_subscribers = null; // to do
   m_testCase = null;// to do
 }
Example #4
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
   string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny<Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
   if (attachments != null)
     this.attachments = attachments;
   else
     this.attachments = new SortedSetAny<Attachment>();
   this.reportedBy = reportedBy;
   this.project = project;
   this.component = component;
   affectedComponentSet = new SortedSetAny<Component>(1);
   if (component != null)
     affectedComponentSet.Add(component);
   affectedVersionSet = new SortedSetAny<ProductVersion>(1);
   if (version != null)
     affectedVersionSet.Add(version);
   voteSet = new SortedSetAny<Vote>(1);
   relatedIssueSet = new SortedSetAny<Issue>(1);
   fixedInVersionSet = new SortedSetAny<ProductVersion>(1);
   subTaskSet = new SortedSetAny<SubTask>(1);
   labelSet = new SortedSetAny<ProductLabel>(1);
   this.version = version;
   this.summary = summary;
   this.description = description;
   this.environment = environment;
   this.category = category;
   this.priority = priority;
   fixResolution = resolution;
   dateTimeCreated = DateTime.Now;
   dateTimeLastUpdated = dateTimeCreated;
   fixmessage = null;
   lastUpdatedBy = reportedBy;
   this.dueDate = dueDate;
   this.status = status;
   this.AssignedTo = assignedTo;
   subscribers = null; // to do
   testCase = null;// to do
 }
Example #5
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
              string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny <Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
     if (attachments != null)
     {
         this.attachments = attachments;
     }
     else
     {
         this.attachments = new SortedSetAny <Attachment>();
     }
     this.reportedBy      = reportedBy;
     this.project         = project;
     this.component       = component;
     affectedComponentSet = new SortedSetAny <Component>(1);
     if (component != null)
     {
         affectedComponentSet.Add(component);
     }
     affectedVersionSet = new SortedSetAny <ProductVersion>(1);
     if (version != null)
     {
         affectedVersionSet.Add(version);
     }
     voteSet             = new SortedSetAny <Vote>(1);
     relatedIssueSet     = new SortedSetAny <Issue>(1);
     fixedInVersionSet   = new SortedSetAny <ProductVersion>(1);
     subTaskSet          = new SortedSetAny <SubTask>(1);
     labelSet            = new SortedSetAny <ProductLabel>(1);
     this.version        = version;
     this.summary        = summary;
     this.description    = description;
     this.environment    = environment;
     this.category       = category;
     this.priority       = priority;
     fixResolution       = resolution;
     dateTimeCreated     = DateTime.Now;
     dateTimeLastUpdated = dateTimeCreated;
     fixmessage          = null;
     lastUpdatedBy       = reportedBy;
     this.dueDate        = dueDate;
     this.status         = status;
     this.AssignedTo     = assignedTo;
     subscribers         = null; // to do
     testCase            = null; // to do
 }
Example #6
0
 public Issue(User reportedBy, PriorityEnum priority, Project project, CategoryEnum category, Component component, ProductVersion version, Resolution resolution,
              string summary, string description, string environment, User assignedTo, DateTime dueDate, SortedSetAny <Attachment> attachments, StatusEnum status = StatusEnum.Open)
 {
     if (attachments != null)
     {
         m_attachments = attachments;
     }
     else
     {
         m_attachments = new SortedSetAny <Attachment>();
     }
     m_reportedBy           = reportedBy;
     m_project              = project;
     m_component            = component;
     m_affectedComponentSet = new SortedSetAny <Component>(1);
     if (component != null)
     {
         m_affectedComponentSet.Add(component);
     }
     m_affectedVersionSet = new SortedSetAny <ProductVersion>(1);
     if (version != null)
     {
         m_affectedVersionSet.Add(version);
     }
     m_voteSet             = new SortedSetAny <Vote>(1);
     m_relatedIssueSet     = new SortedSetAny <Issue>(1);
     m_fixedInVersionSet   = new SortedSetAny <ProductVersion>(1);
     m_subTaskSet          = new SortedSetAny <SubTask>(1);
     m_labelSet            = new SortedSetAny <ProductLabel>(1);
     m_version             = version;
     m_summary             = summary;
     m_description         = description;
     m_environment         = environment;
     m_category            = category;
     m_priority            = priority;
     m_fixResolution       = resolution;
     m_dateTimeCreated     = DateTime.Now;
     m_dateTimeLastUpdated = m_dateTimeCreated;
     m_fixmessage          = null;
     m_lastUpdatedBy       = reportedBy;
     m_dueDate             = dueDate;
     m_status      = status;
     AssignedTo    = assignedTo;
     m_subscribers = null; // to do
     m_testCase    = null; // to do
 }
Example #7
0
 public IEnumerable<ProductVersion> SelectVersion(UInt64 Id)
 {
   try
   {
     ProductVersion version;
     if (Id > 0)
     {
       version = (ProductVersion)s_sharedReadOnlySession.Open(Id);
     }
     else
       version = new ProductVersion(null, null, null, DateTime.MaxValue);
     List<ProductVersion> list = new List<ProductVersion>(1);
     list.Add(version);
     return list;
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
   return null;
 }
Example #8
0
 public void UpdateVersion(EditedVersion newValues)
 {
   try
   {
     int sessionId = -1;
     SessionBase session = null;
     try
     {
       session = s_sessionPool.GetSession(out sessionId);
       using (var transaction = session.BeginUpdate())
       {
         if (newValues.Id == 0)
         {
           if (newValues.Name == null)
             Console.WriteLine("ProductVersion null storeName detected in Update method");
           else
           {
             IssueTracker issueTracker = session.AllObjects<IssueTracker>(false).FirstOrDefault();
             User user = lookupUser(issueTracker, session);
             ProductVersion newVersion = new ProductVersion(user, newValues.Name, newValues.Description, newValues.ReleaseDate);
             session.Persist(newVersion);
             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();
         s_sharedReadOnlySession.ForceDatabaseCacheValidation();
       }
     }
     catch (Exception ex)
     {
       Console.Out.WriteLine(ex.StackTrace);
     }
     finally
     {
       s_sessionPool.FreeSession(sessionId, session);
     }
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
 }
Example #9
0
    void createInitialObjects(IssueTracker issueTracker, User user, SessionBase session)
    {
      Project project = new Project(user, "VelocityDB", "Object Database Management System");
      session.Persist(project);
      issueTracker.ProjectSet.Add(project);

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

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

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

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

      ProductVersion version = new ProductVersion(user, "5.0.16", "First initial version", new DateTime(2015, 11, 29));
      session.Persist(version);
      issueTracker.VersionSet.Add(version);
      version = new ProductVersion(user, "4.7", "June 13 version", new DateTime(2015, 06, 13));
      session.Persist(version);
      issueTracker.VersionSet.Add(version);
    }
Example #10
0
 public IEnumerable<ProductVersion> SelectVersion(UInt64 Id)
 {
   try
   {
     ProductVersion version;
     if (Id > 0)
     {
       using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, true))
       {
         session.BeginRead();
         version = (ProductVersion)session.Open(Id);
         session.Commit();
       }
     }
     else
       version = new ProductVersion(null, null, null, DateTime.MaxValue);
     List<ProductVersion> list = new List<ProductVersion>(1);
     list.Add(version);
     return list;
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
   return null;
 }
Example #11
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();
   }
 }