Inheritance: OptimizedPersistable
Exemple #1
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
 }
Exemple #2
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
 }
 public void Create5Components(int numberOfComponents)
 {
   Component component = null;
   Component priorComponent = null;
   for (int i = 0; i < numberOfComponents; 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)];
       Project project = issueTracker.ProjectSet.Keys[rand.Next(issueTracker.ProjectSet.Keys.Count - 1)];
       string c = "component" + i.ToString();
       string d = "cdescription" + i.ToString();
       component = new Component(user, c, d, project);
       session.Persist(component);
       issueTracker.ComponentSet.Add(component);
       priorComponent = component;
       session.Commit();
     }
 }
 public void Create5Components(int numberOfComponents)
 {
   Component component = null;
   Component priorComponent = null;
   for (int i = 0; i < numberOfComponents; 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)];
       Project project = issueTracker.ProjectSet.Keys[rand.Next(issueTracker.ProjectSet.Keys.Count - 1)];
       string c = "component" + i.ToString();
       string d = "cdescription" + i.ToString();
       component = new Component(user, c, d, project);
       component.Persist(session, priorComponent ?? component);
       issueTracker.ComponentSet.Add(component);
       priorComponent = component;
       session.Commit();
     }
 }
Exemple #5
0
 public IEnumerable<Component> SelectComponent(UInt64 Id)
 {
   try
   {
     Component component;
     if (Id > 0)
     {
       component = (Component)s_sharedReadOnlySession.Open(Id);
     }
     else
       component = new Component();
     List<Component> list = new List<Component>(1);
     list.Add(component);
     return list;
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
   return null;
 }
Exemple #6
0
    public void UpdateComponent(EditedComponent newValues)
    {
      try
      {
        object projectIndexObj = Session["ProjectSelected"];
        int projectIndex = projectIndexObj == null ? 0 : (int)projectIndexObj;
        int sessionId = -1;
        SessionBase session = null;
        try
        {
          session = s_sessionPool.GetSession(out sessionId);
          using (var transaction = session.BeginUpdate())
          {

            IssueTracker issueTracker = session.AllObjects<IssueTracker>(false).FirstOrDefault();
            Project project = issueTracker.ProjectSet.Keys[projectIndex];
            if (newValues.Id == 0)
            {
              if (newValues.Name == null)
                Console.WriteLine("Component null storeName detected in Update method");
              else
              {
                User user = lookupUser(issueTracker, session);
                Component newComponent = new Component(user, newValues.Name, newValues.Description, project);
                session.Persist(newComponent);
                issueTracker.ComponentSet.Add(newComponent);
              }
            }
            else
            {
              Component existingComponent = (Component)session.Open(newValues.Id);
              existingComponent.Name = newValues.Name;
              existingComponent.Description = newValues.Description;
              existingComponent.Project = project;
            }
            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();
      }
    }
Exemple #7
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);
    }
 public IEnumerable<Component> SelectComponent(UInt64 Id)
 {
   try
   {
     Component component;
     if (Id > 0)
     {
       using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, true))
       {
         session.BeginRead();
         component = (Component)session.Open(Id);
         session.Commit();
       }
     }
     else
       component = new Component();
     List<Component> list = new List<Component>(1);
     list.Add(component);
     return list;
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
   return null;
 }
 public void UpdateComponent(EditedComponent newValues)
 {
   try
   {
     object projectIndexObj = Session["ProjectSelected"];
     int projectIndex = projectIndexObj == null ? 0 : (int)projectIndexObj;
     using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, true))
     {
       session.BeginUpdate();
       IssueTracker issueTracker = (IssueTracker)session.Open(IssueTracker.PlaceInDatabase, 1, 1, false);
       Project project = issueTracker.ProjectSet.Keys[projectIndex];
       if (newValues.Id == 0)
       {
         if (newValues.Name == null)
           Console.WriteLine("Component null storeName detected in Update method");
         else
         {
           User user = lookupUser(issueTracker, session);
           Component newComponent = new Component(user, newValues.Name, newValues.Description, project);
           Placement placer = new Placement(newComponent.PlacementDatabaseNumber, 1, 1, 10000, 10000);
           newComponent.Persist(placer, session, true, true);
           issueTracker.ComponentSet.Add(newComponent);
         }
       }
       else
       {
         Component existingComponent = (Component)session.Open(newValues.Id);
         existingComponent.Name = newValues.Name;
         existingComponent.Description = newValues.Description;
         existingComponent.Project = project;
       }
       session.Commit();
     }
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
 }