상속: OptimizedPersistable
예제 #1
0
 public Component(User user, string componentName, string compopnentDescription, Project componentProject)
 {
   name = componentName;
   description = compopnentDescription;
   project = componentProject;
   createdBy = user;
 }
예제 #2
0
 public ProductVersion(User user, string version, string description, DateTime? releaseDate)
 {
   m_createdBy = user;
   m_name = version;
   m_description = description;
   m_releaseDate = releaseDate ?? DateTime.MaxValue;
   if (releaseDate != null)
     m_state = State.Released;
   else
     m_state = State.Unreleased;
 }
예제 #3
0
 public ProductVersion(User user, string version, string description, DateTime? releaseDate)
 {
   createdBy = user;
   name = version;
   this.description = description;
   this.releaseDate = releaseDate ?? DateTime.MaxValue;
   if (releaseDate != null)
     state = State.Released;
   else
     state = State.Unreleased;
 }
예제 #4
0
 public User(User createdBy, string email, string firstName, string lastName, string userName)
 {
   if (createdBy == null)
     this.createdBy = this;
   else
     this.createdBy = createdBy;
   this.email = email;
   this.firstName = firstName;
   this.lastName = lastName;
   this.userName = userName;
   dateTimeCreated = DateTime.Now;
 }
예제 #5
0
 public User(User createdBy, string email, string firstName, string lastName, string userName)
 {
   if (createdBy == null)
     m_createdBy = this;
   else
     m_createdBy = createdBy;
   m_email = email;
   m_firstName = firstName;
   m_lastName = lastName;
   m_userName = userName;
   m_dateTimeCreated = DateTime.Now;
 }
예제 #6
0
 public void Create1Root()
 {
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     session.BeginUpdate();
     IssueTracker issueTracker = new IssueTracker(10, session);
     User user = new User(null, "*****@*****.**", "Mats", "Persson", "matspca");
     session.Persist(user);
     PermissionScheme permissions = new PermissionScheme(user);
     issueTracker.Permissions = permissions;
     session.Persist(issueTracker);
     session.Commit();
   }
 }
예제 #7
0
 public PermissionScheme(User superUser)
 {
   this.m_superUser = superUser;
   m_adminSet = new SortedSetAny<User>();
   m_adminSet.Add(superUser);
   m_developerSet = new SortedSetAny<User>();
   m_adminPermissions = (uint) (Permission.CreateProject | Permission.DeleteProject | Permission.EditProject | Permission.CreateComponent | Permission.DeleteComponent | 
     Permission.EditComponent | Permission.CreateIssue | Permission.DeleteIssue | Permission.EditIssue | Permission.EditOwnIssue | Permission.DeleteOwnIssue | 
     Permission.CreateVersion | Permission.DeleteVersion | Permission.EditVersion | Permission.AddLargeAttachment | Permission.AddSmallAttachment |
     Permission.DeleteAttachment | Permission.LinkIssues | Permission.EditUser | Permission.ScheduleIssues | Permission.DeleteUser | Permission.WorkOnIssues);
   m_developerPermissions = (uint)(Permission.CreateIssue | Permission.DeleteIssue | Permission.EditIssue | Permission.EditOwnIssue | Permission.DeleteOwnIssue | 
     Permission.EditVersion | Permission.AddLargeAttachment | Permission.AddSmallAttachment |
     Permission.DeleteAttachment | Permission.LinkIssues | Permission.ScheduleIssues | Permission.WorkOnIssues);
   m_userPermissions = (uint)(Permission.CreateIssue | Permission.EditOwnIssue | Permission.DeleteOwnIssue | Permission.AddSmallAttachment);
 }
예제 #8
0
 public void Create2Users(int numberOfUsers)
 {
   User user = null;
   User priorUser = null;
   for (int i = 0; i < numberOfUsers; i++)
     using (SessionNoServer session = new SessionNoServer(systemDir))
     {
       session.BeginUpdate();
       IssueTracker issueTracker = session.AllObjects<IssueTracker>(false).FirstOrDefault();
       string email = i.ToString() + "@gmail.com";
       string first = "first" + i.ToString();
       string last = "last" + i.ToString();
       string userName = "******" + i.ToString();
       user = new User(user, email, first, last, userName);
       session.Persist(user);
       issueTracker.UserSet.Add(user);
       priorUser = user;
       session.Commit();
     }
 }
예제 #9
0
 public void Create2Users(int numberOfUsers)
 {
   User user = null;
   User priorUser = null;
   for (int i = 0; i < numberOfUsers; i++)
     using (SessionNoServer session = new SessionNoServer(systemDir))
     {
       session.BeginUpdate();
       IssueTracker issueTracker = (IssueTracker)session.Open(IssueTracker.PlaceInDatabase, 1, 1, false);
       string email = i.ToString() + "@gmail.com";
       string first = "first" + i.ToString();
       string last = "last" + i.ToString();
       string userName = "******" + i.ToString();
       user = new User(user, email, first, last, userName);
       user.Persist(session, priorUser ?? user);
       issueTracker.UserSet.Add(user);
       priorUser = user;
       session.Commit();
     }
 }
예제 #10
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
 }
예제 #11
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
 }
예제 #12
0
 public void UpdateUser(EditedUser newValues)
 {
   try
   {
     using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, true))
     {
       session.BeginUpdate();
       if (newValues.Id == 0)
       {
         IssueTracker issueTracker = (IssueTracker)session.Open(IssueTracker.PlaceInDatabase, 1, 1, false);
         User user = lookupUser(issueTracker, session);
         User newUser = new User(user, newValues.Email, newValues.FirstName, newValues.LastName, newValues.UserName);
         Placement placer = new Placement(newUser.PlacementDatabaseNumber);
         newUser.Persist(placer, session, true, true);
         issueTracker.UserSet.Add(newUser);
       }
       else
       {
         User existingUser = (User)session.Open(newValues.Id);
         existingUser.FirstName = newValues.FirstName;
         existingUser.LastName = newValues.LastName;
         existingUser.Email = newValues.Email;
         existingUser.UserName = newValues.UserName;
       }
       session.Commit();
     }
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
 }
예제 #13
0
 public IEnumerable<User> SelectUser(UInt64 Id)
 {
   try
   {
     User user;
     if (Id > 0)
     {
       using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, true))
       {
         session.BeginRead();
         user = (User)session.Open(Id);
         session.Commit();
       }
     }
     else
       user = new User();
     List<User> list = new List<User>(1);
     list.Add(user);
     return list;
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
   return null;
 }
예제 #14
0
 public Project(User user, string projectName, string projectDescription) 
 {
   m_createdBy = user;
   m_name = projectName;
   m_description = projectDescription;
 }
예제 #15
0
 User lookupUser(IssueTracker issueTracker, SessionBase session)
 {
   string userEmail = this.User.Identity.Name;
   User user = new User(userEmail);
   string dataPath = HttpContext.Current.Server.MapPath("~/Database");
   if (!issueTracker.UserSet.TryGetValue(user, ref user))
   {
     CustomerContact existingCustomer = null;
     string firstName = null;
     string lastName = null;
     string userName = null;
     try
     {
       using (SessionNoServer session2 = new SessionNoServer(dataPath, 2000, true, true))
       {
         session2.BeginRead();
         Root velocityDbroot = session2.AllObjects<Root>(false).FirstOrDefault();
         CustomerContact lookup = new CustomerContact(userEmail, null);
         velocityDbroot.customersByEmail.TryGetKey(lookup, ref existingCustomer);
         session2.Commit();
         firstName = existingCustomer.FirstName;
         lastName = existingCustomer.LastName;
         userName = existingCustomer.UserName;
       }
     }
     catch (System.Exception ex)
     {
       this.errorLabel.Text = ex.ToString();
     }
     user = new User(null, userEmail, firstName, lastName, userName);
     session.Persist(user);
     issueTracker.UserSet.Add(user);
   }
   return user;
 }
예제 #16
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);
    }
예제 #17
0
 public void UpdateUser(EditedUser newValues)
 {
   try
   {
     int sessionId = -1;
     SessionBase session = null;
     try
     {
       session = s_sessionPool.GetSession(out sessionId);
       using (var transaction = session.BeginUpdate())
       {
         if (newValues.Id == 0)
         {
           IssueTracker issueTracker = session.AllObjects<IssueTracker>(false).FirstOrDefault();
           User user = lookupUser(issueTracker, session);
           User newUser = new User(user, newValues.Email, newValues.FirstName, newValues.LastName, newValues.UserName);
           session.Persist(newUser);
           issueTracker.UserSet.Add(newUser);
         }
         else
         {
           User existingUser = (User)session.Open(newValues.Id);
           existingUser.FirstName = newValues.FirstName;
           existingUser.LastName = newValues.LastName;
           existingUser.Email = newValues.Email;
           existingUser.UserName = newValues.UserName;
         }
         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();
   }
 }
예제 #18
0
 public User() 
 {     
   createdBy = this;
 }
예제 #19
0
 User lookupUser(IssueTracker issueTracker, SessionBase session)
 {
   string userEmail = this.User.Identity.Name;
   User user = new User(userEmail);
   if (!issueTracker.UserSet.TryGetValue(user, ref user))
   {
     CustomerContact existingCustomer = null;
     string firstName = null;
     string lastName = null;
     string userName = null;
     try
     {
       using (SessionNoServer session2 = new SessionNoServer(dataPath, 2000, true, true))
       {
         session2.BeginRead();
         Root velocityDbroot = (Root)session2.Open(Root.PlaceInDatabase, 1, 1, false);
         CustomerContact lookup = new CustomerContact(userEmail, null);
         velocityDbroot.customersByEmail.TryGetKey(lookup, ref existingCustomer);
         session2.Commit();
         firstName = existingCustomer.FirstName;
         lastName = existingCustomer.LastName;
         userName = existingCustomer.UserName;
       }
     }
     catch (System.Exception ex)
     {
       this.errorLabel.Text = ex.ToString();
     }
     user = new User(null, userEmail, firstName, lastName, userName);
     Placement placer = new Placement(user.PlacementDatabaseNumber);
     user.Persist(placer, session, true, true);
     issueTracker.UserSet.Add(user);
   }
   return user;
 }
예제 #20
0
 public IEnumerable<User> SelectUser(UInt64 Id)
 {
   try
   {
     User user;
     if (Id > 0)
     {
       user = (User)s_sharedReadOnlySession.Open(Id);
     }
     else
       user = new User();
     List<User> list = new List<User>(1);
     list.Add(user);
     return list;
   }
   catch (System.Exception ex)
   {
     this.errorLabel.Text = ex.ToString();
   }
   return null;
 }