Beispiel #1
0
        public MainIcon()
        {
            _mainIcon = new NotifyIcon
            {
                Visible        = true,
                Text           = "ECB migration number tray utility",
                BalloonTipIcon = ToolTipIcon.Info,
                Icon           = Resources.MainIcon,
            };
            _mainIcon.MouseClick += MainIconClick;

            if (string.IsNullOrWhiteSpace(Settings.Default.SolutionDir))
            {
                ShowSettings(this, new EventArgs());
            }

            _branchProvider = new BranchProvider
            {
                SolutionDir = Settings.Default.SolutionDir,
            };

            _migrationNumberTrackerClient = new MigrationNumberTrackerClient
            {
                Url = Settings.Default.ServerUrl,
            };

            _leftClickContextMenuStrip  = GenerateLeftClickMenu();
            _rightClickContextMenuStrip = GenerateRightClickMenu();
        }
    public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
    {
        using (FitnessManagement.Data.FitnessDataContext ctx = new FitnessManagement.Data.FitnessDataContext())
        {
            BranchProvider branchProvider = new BranchProvider(ctx);
            if (branchProvider.GetActiveBranches(HttpContext.Current.User.Identity.Name).Count() == 0)
            {
                return(false);
            }
        }

        foreach (string role in node.Roles)
        {
            if (role == "" || role == "*")
            {
                return(true);
            }
            if (Roles.IsUserInRole(role))
            {
                return(true);
            }
        }

        return(false);
    }
        public static void PopulateAllowedBranches(BranchProvider branchProvider, RadDropDownList dropdown, string userName, bool addEmptyOption = false)
        {
            dropdown.DataSource     = branchProvider.GetAllowedBranches(userName);
            dropdown.DataTextField  = "Name";
            dropdown.DataValueField = "ID";
            dropdown.DataBind();

            if (addEmptyOption)
            {
                dropdown.Items.Insert(0, new DropDownListItem(String.Empty));
            }
        }
    public static void PopulateActiveBranches(RadDropDownList dropdown, string userName, bool addEmptyOption = false)
    {
        BranchProvider branchProvider = UnityContainerHelper.Container.Resolve <BranchProvider>();

        dropdown.DataSource     = branchProvider.GetActiveBranches(userName);
        dropdown.DataTextField  = "Name";
        dropdown.DataValueField = "ID";
        dropdown.DataBind();

        if (addEmptyOption)
        {
            dropdown.Items.Insert(0, new DropDownListItem(String.Empty, String.Empty));
        }
    }
Beispiel #5
0
        public void GetBranches_ReturnsLastCommitInfo()
        {
            var message   = "Initial support for auto property initializers.\r\n\r\nFeatures the new syntax ('= expr;'), new rules around required accessors, and allows auto property and field initializers in structs.";
            var text      = "b02c98c7906dd3666f479699b83760ce239d6d2d 2014-04-16 Andy Gocke\r\n" + message;
            var directory = new DirectoryMock("root",
                                              new DirectoryMock("test",
                                                                new FileMock("LastCommit.txt", text)
                                                                )
                                              );

            var provider = new BranchProvider(directory);
            var branch   = Assert.Single(provider.GetBranches());

            Assert.Equal("b02c98c7906dd3666f479699b83760ce239d6d2d", branch.LastCommitHash);
            Assert.Equal("2014-04-16", branch.LastCommitDate.ToString("yyyy-MM-dd"));
            Assert.Equal("Andy Gocke", branch.LastCommitAuthor);
            Assert.Equal(message, branch.LastCommitMessage);
        }
        public void ListReturnExpected(IRepository repository)
        {
            BranchProvider branchProvider = new BranchProvider(repository);

            Assert.Equal(repository.Branches.Count(), branchProvider.GetAllBranches().Count());
        }
Beispiel #7
0
 public BranchController(BranchProvider branchProvider, IMapper mapper)
 {
     this.branchProvider = branchProvider;
     this.mapper         = mapper;
 }