Inheritance: OptimizedPersistable
Exemplo n.º 1
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();
   }
 }
Exemplo n.º 2
0
        public IssueTracker(int capacity, SessionBase session)
        {
            issueSetById = new SortedSetAny <Issue>(capacity);
            CompareByField <Issue> descriptionCompare = new CompareByField <Issue>("description", session, true);

            issueSetByDescription = new SortedSetAny <Issue>(descriptionCompare);
            ComparePriority priorityCompare = new ComparePriority();

            issueSetByPriority = new SortedSetAny <Issue>(priorityCompare);
            CompareByField <Issue> dateTimeCreatedCompare = new CompareByField <Issue>("dateTimeCreated", session, true);

            issueSetByDateTimeCreated = new SortedSetAny <Issue>(dateTimeCreatedCompare);
            CompareByField <Issue> dateTimeUpdatedCompare = new CompareByField <Issue>("dateTimeLastUpdated", session, true);

            issueSetByDateTimeUpdated = new SortedSetAny <Issue>(dateTimeCreatedCompare);
            CompareByField <Issue> compareStatus = new CompareByField <Issue>("status", session, true);

            issueSetByStatus = new SortedSetAny <Issue>(compareStatus);
            CompareSummary compareSummary = new CompareSummary();

            issueSetBySummary = new SortedSetAny <Issue>(compareSummary);
            CompareByField <Issue> compareProject = new CompareByField <Issue>("project", session, true);

            issueSetByProject = new SortedSetAny <Issue>(compareProject);
            CompareCategory compareCategory = new CompareCategory();

            issueSetByCategory = new SortedSetAny <Issue>(compareCategory);
            CompareReportedBy compareReportedBy = new CompareReportedBy();

            issueSetByReportedBy = new SortedSetAny <Issue>(compareReportedBy);
            CompareLastUpdatedBy compareLastUpdatedBy = new CompareLastUpdatedBy();

            issueSetByLastUpdatedBy = new SortedSetAny <Issue>(compareLastUpdatedBy);
            CompareAssignedTo compareAssignedTo = new CompareAssignedTo();

            issueSetByAssignedTo = new SortedSetAny <Issue>(compareAssignedTo);
            CompareByField <Issue> compareByDueDate = new CompareByField <Issue>("dueDate", session, true);

            issueSetByDueDate = new SortedSetAny <Issue>(compareByDueDate);
            CompareByVersion compareByVersion = new CompareByVersion();

            issueSetByVersion = new SortedSetAny <Issue>(compareByVersion);
            componentSet      = new SortedSetAny <Component>(capacity);
            userSet           = new SortedSetAny <User>(capacity);
            projectSet        = new SortedSetAny <Project>(capacity);
            versionSet        = new SortedSetAny <ProductVersion>(capacity);
            organizationSet   = new SortedSetAny <Organization>(capacity);
            permissions       = null;
        }
Exemplo n.º 3
0
 public IssueTracker(int capacity, SessionBase session)
 {
   issueSetById = new SortedSetAny<Issue>(capacity);
   CompareByField<Issue> descriptionCompare = new CompareByField<Issue>("description", session, true);
   issueSetByDescription = new SortedSetAny<Issue>(descriptionCompare); 
   ComparePriority priorityCompare = new ComparePriority();
   issueSetByPriority = new SortedSetAny<Issue>(priorityCompare);
   CompareByField<Issue> dateTimeCreatedCompare = new CompareByField<Issue>("dateTimeCreated", session, true);
   issueSetByDateTimeCreated = new SortedSetAny<Issue>(dateTimeCreatedCompare);
   CompareByField<Issue> dateTimeUpdatedCompare = new CompareByField<Issue>("dateTimeLastUpdated", session, true);
   issueSetByDateTimeUpdated = new SortedSetAny<Issue>(dateTimeCreatedCompare);
   CompareByField<Issue> compareStatus = new CompareByField<Issue>("status", session, true);
   issueSetByStatus = new SortedSetAny<Issue>(compareStatus);
   CompareSummary compareSummary = new CompareSummary();
   issueSetBySummary = new SortedSetAny<Issue>(compareSummary);
   CompareByField<Issue> compareProject = new CompareByField<Issue>("project", session, true);
   issueSetByProject = new SortedSetAny<Issue>(compareProject);
   CompareCategory compareCategory = new CompareCategory();
   issueSetByCategory = new SortedSetAny<Issue>(compareCategory);
   CompareReportedBy compareReportedBy = new CompareReportedBy();
   issueSetByReportedBy = new SortedSetAny<Issue>(compareReportedBy);
   CompareLastUpdatedBy compareLastUpdatedBy = new CompareLastUpdatedBy();
   issueSetByLastUpdatedBy = new SortedSetAny<Issue>(compareLastUpdatedBy);
   CompareAssignedTo compareAssignedTo = new CompareAssignedTo();
   issueSetByAssignedTo = new SortedSetAny<Issue>(compareAssignedTo);
   CompareByField<Issue> compareByDueDate = new CompareByField<Issue>("dueDate", session, true);
   issueSetByDueDate = new SortedSetAny<Issue>(compareByDueDate);
   CompareByVersion compareByVersion = new CompareByVersion();
   issueSetByVersion = new SortedSetAny<Issue>(compareByVersion);
   componentSet = new SortedSetAny<Component>(capacity);
   userSet = new SortedSetAny<User>(capacity);
   projectSet = new SortedSetAny<Project>(capacity);
   versionSet = new SortedSetAny<ProductVersion>(capacity);
   organizationSet = new SortedSetAny<Organization>(capacity);
   permissions = null;
 }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
      {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Page.Header.Title = "VelocityWeb - Issue Tracking";
        HtmlGenericControl menu = (HtmlGenericControl)Master.FindControl("liIssues");
        menu.Attributes.Add("class", "active");
        IssueTracker bugTracker = null;
        User user = null;
        int sessionId = -1;
        SessionBase session = null;
        try
        {
          session = s_sessionPool.GetSession(out sessionId);
          using (var transaction = session.BeginUpdate())
          {
            bugTracker = session.AllObjects<IssueTracker>(false).FirstOrDefault();
            if (bugTracker == null)
            {
              bugTracker = new IssueTracker(10, session);
              session.Persist(bugTracker);
              user = lookupUser(bugTracker, session);
              PermissionScheme permissions = new PermissionScheme(user);
              bugTracker.Permissions = permissions;
              createInitialObjects(bugTracker, user, session);
            }
            else
              user = lookupUser(bugTracker, session);

            transaction.Commit();
            s_sharedReadOnlySession.ForceDatabaseCacheValidation();
          }
        }
        catch (Exception ex)
        {
          Console.Out.WriteLine(ex.StackTrace);
        }
        finally
        {
          s_sessionPool.FreeSession(sessionId, session);
        }
        if (Session["filterById"] == null)
        {
          Session["filterById"] = false;
          Session["priorityFilter"] = new List<int>();
          Session["statusFilter"] = new List<int>();
          Session["categoryFilter"] = new List<int>();
        }
        viewString = Request.QueryString["view"];
        int view = 1;
        if (viewString != null)
          view = int.Parse(viewString);
        switch (view)
        {
          case 0:
            Session["UpdatedAttachments"] = null;
            IssueDetailsView.ChangeMode(DetailsViewMode.Insert);
            IssuesGridView.SelectedIndex = -1;
            IssueDetailsView.InsertItem(false);
            IssueDetailsView.Visible = true;
            IssueDetailsView.DataBind();
            MultiView1.SetActiveView(IssueEdit);
            break;
          case 1:
            Session["filterOn"] = false;
            MultiView1.SetActiveView(IssuesView);
            break;
          case 2:
            bindFilterRanges(bugTracker);
            object sessionState = Session["filterById"];
            bool filterById = (bool)sessionState;
            TreeNode root = IssueFilterTree.Nodes[0];
            TreeNode id = root.ChildNodes[0];
            id.Checked = filterById;
            MultiView1.SetActiveView(IssuesFilter);
            break;
          case 3:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
              MultiView1.SetActiveView(IssuesView);
            else
              MultiView1.SetActiveView(ProjectsView);
            break;
          case 4:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete components";
              MultiView1.SetActiveView(IssuesView);
            }
            else
              MultiView1.SetActiveView(ComponentsView);
            break;
          case 5:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete users";
              MultiView1.SetActiveView(IssuesView);
            }
            else
              MultiView1.SetActiveView(UsersView);
            break;
          case 6:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete versions";
              MultiView1.SetActiveView(IssuesView);
            }
            else
              MultiView1.SetActiveView(VersionsView);
            break;
          case 7:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete permissions";
              MultiView1.SetActiveView(IssuesView);
            }
            else
            {
              AdminUsers.DataSource = bugTracker.Permissions.AdminSet.Keys;
              DeveloperUsers.DataSource = bugTracker.Permissions.DeveloperSet.Keys;
              RegularUsers.DataSource = bugTracker.UserSet.Keys;
              AdminUsers.DataBind();
              DeveloperUsers.DataBind();
              RegularUsers.DataBind();
              MultiView1.SetActiveView(PermissionsView);
            }
            break;
        }
      }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
      {
        Page.Header.Title = "VelocityWeb - Issue Tracking";
        HtmlGenericControl menu = (HtmlGenericControl)Master.FindControl("liIssues");
        menu.Attributes.Add("class", "active");
        IssueTracker bugTracker = null;
        User user;
        using (SessionNoServer session = new SessionNoServer(dataPath, 2000, true, false))
        {
          session.BeginUpdate();
          bugTracker = (IssueTracker)session.Open(IssueTracker.PlaceInDatabase, 1, 1, false);
          if (bugTracker == null)
          {
            Placement placementRoot = new Placement(IssueTracker.PlaceInDatabase, 1, 1, 1000, 1000);
            bugTracker = new IssueTracker(10, session);
            bugTracker.Persist(placementRoot, session, true, true);
            user = lookupUser(bugTracker, session);
            PermissionScheme permissions = new PermissionScheme(user);
            bugTracker.Permissions = permissions;
            createInitialObjects(bugTracker, user, session);
          }
          else
            user = lookupUser(bugTracker, session);

          session.Commit();
        }
        if (Session["filterById"] == null)
        {
          Session["filterById"] = false;
          Session["priorityFilter"] = new List<int>();
          Session["statusFilter"] = new List<int>();
          Session["categoryFilter"] = new List<int>();
        }
        viewString = Request.QueryString["view"];
        int view = 1;
        if (viewString != null)
          view = int.Parse(viewString);
        switch (view)
        {
          case 0:
            Session["UpdatedAttachments"] = null;
            IssueDetailsView.ChangeMode(DetailsViewMode.Insert);
            IssuesGridView.SelectedIndex = -1;
            IssueDetailsView.InsertItem(false);
            IssueDetailsView.Visible = true;
            IssueDetailsView.DataBind();
            MultiView1.SetActiveView(IssueEdit);
            break;
          case 1:
            Session["filterOn"] = false;
            MultiView1.SetActiveView(IssuesView);
            break;
          case 2:
            bindFilterRanges(bugTracker);
            object sessionState = Session["filterById"];
            bool filterById = (bool)sessionState;
            TreeNode root = IssueFilterTree.Nodes[0];
            TreeNode id = root.ChildNodes[0];
            id.Checked = filterById;
            MultiView1.SetActiveView(IssuesFilter);
            break;
          case 3:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
              MultiView1.SetActiveView(IssuesView);
            else
              MultiView1.SetActiveView(ProjectsView);
            break;
          case 4:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete components";
              MultiView1.SetActiveView(IssuesView);
            }
            else
              MultiView1.SetActiveView(ComponentsView);
            break;
          case 5:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete users";
              MultiView1.SetActiveView(IssuesView);
            }
            else
              MultiView1.SetActiveView(UsersView);
            break;
          case 6:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete versions";
              MultiView1.SetActiveView(IssuesView);
            }
            else
              MultiView1.SetActiveView(VersionsView);
            break;
          case 7:
            if (bugTracker.Permissions.AdminSet.Contains(user) == false)
            {
              errorLabel.Text = "Sorry, you don't have permission to create/edit/delete permissions";
              MultiView1.SetActiveView(IssuesView);
            }
            else
            {
              AdminUsers.DataSource = bugTracker.Permissions.AdminSet.Keys;
              DeveloperUsers.DataSource = bugTracker.Permissions.DeveloperSet.Keys;
              RegularUsers.DataSource = bugTracker.UserSet.Keys;
              AdminUsers.DataBind();
              DeveloperUsers.DataBind();
              RegularUsers.DataBind();
              MultiView1.SetActiveView(PermissionsView);
            }
            break;
        }
      }
    }