Пример #1
0
        public void SelectLabel(Label l)
        {
            (l.Tag as LabelTag).Selected = true;
            SelectedLabels.Add(l);
            l.BorderStyle = BorderStyle.FixedSingle;

            // Fire event "SelectedLabelsChanged"
            SelectedLabelsChanged(null, null);
        }
Пример #2
0
        public void DeselectLabel(Label l)
        {
            (l.Tag as LabelTag).Selected = false;
            SelectedLabels.Remove(l);
            l.BorderStyle = BorderStyle.None;

            // Fire event "SelectedLabelsChanged"
            SelectedLabelsChanged(null, null);
        }
Пример #3
0
        public void DeleteAllLabels(bool fireLabelPropertiesChangedEvent = true)
        {
            if (Container.Controls.Count > 0) {
                Container.Controls.Clear();
                SelectedLabels.Clear();

                // Fire event
                if (fireLabelPropertiesChangedEvent)
                    LabelPropertiesChanged(null, null);
            }
        }
Пример #4
0
        public void DeleteSelectedLabels()
        {
            if (SelectedLabels.Count > 0) {

                foreach (Label l in SelectedLabels)
                    Container.Controls.Remove(l);
                SelectedLabels.Clear();

                // Fire event
                SelectedLabelsChanged(null, null);

                // Fire event
                LabelPropertiesChanged(null, null);
            }
        }
Пример #5
0
        public void DeselectAllLabels()
        {
            // Performance boost
            if (SelectedLabels.Count > 200)
                Container.Visible = false;

            foreach (Label l in SelectedLabels) {
                (l.Tag as LabelTag).Selected = false;
                l.BorderStyle = BorderStyle.None;
            }

            Container.Visible = true;
            SelectedLabels.Clear();
            _dragging = false;

            // Fire event "SelectedLabelsChanged"
            SelectedLabelsChanged(null, null);
        }
Пример #6
0
        public void SelectAllLabels()
        {
            SelectedLabels.Clear();

            // Performance boost
            Container.SuspendLayout();
            if (Container.Controls.Count > 200)
                Container.Visible = false;

            foreach (Control c in Container.Controls) {
                (c.Tag as LabelTag).Selected = true;
                SelectedLabels.Add(c);
                (c as Label).BorderStyle = BorderStyle.FixedSingle;
            }

            Container.SuspendLayout();
            Container.Visible = true;

            // Fire event "SelectedLabelsChanged"
            SelectedLabelsChanged(null, null);
        }
Пример #7
0
        protected override async Task OnGetInternalAsync(SqlConnection connection)
        {
            TeamId = CurrentOrgUser.CurrentTeamId ?? 0;

            SelectedLabel = await connection.FindAsync <Label>(FilterLabelId);

            var appLabels = await new NewItemAppLabels()
            {
                OrgId = OrgId
            }.ExecuteAsync(connection);
            var teamLabels = await new TeamLabels()
            {
                OrgId = OrgId, TeamId = TeamId
            }.ExecuteAsync(connection);

            NewItemLabels = appLabels.Concat(teamLabels);
            Labels        = NewItemLabels.ToLookup(row => row.ApplicationId);

            var labelCounts = await new ItemCountsByLabel()
            {
                OrgId             = OrgId,
                TeamId            = CurrentOrgUser.CurrentTeamId ?? 0,
                AppId             = CurrentOrgUser.EffectiveAppId,
                HasProject        = false,
                HasAssignedUserId = false,
                HasPriority       = false
            }.ExecuteAsync(connection);

            OpenItemCounts = labelCounts.ToDictionary(row => row.LabelId, row => row.Count);

            Applications = await new Applications()
            {
                OrgId = OrgId, AllowNewItems = true, TeamId = TeamId, IsActive = true
            }.ExecuteAsync(connection);
            Teams = await new Teams()
            {
                OrgId = OrgId, IsActive = true
            }.ExecuteAsync(connection);
            TeamInfo = Teams.ToDictionary(row => row.Id); // used to give access to Team.UseApplications for determining whether to show app dropdown in new item form

            if (!Applications.Any() && TeamId != 0)
            {
                SelectedApp = new Application()
                {
                    Name = $"Enter New {CurrentOrgUser.CurrentTeam.Name} work item"
                };
            }

            if (AppId != 0 && SelectedApp == null)
            {
                SelectedApp = await Data.FindAsync <Application>(AppId);
            }

            var workItemLabelMap = SelectedLabels
                                   .Select(grp => new { WorkItemId = grp.Key, LabelId = GetFilteredLabelId(grp) })
                                   .ToDictionary(row => row.WorkItemId, row => row.LabelId);

            var notifyResults = await new LabelSubscriptionUsers()
            {
                OrgId = OrgId
            }.ExecuteAsync(connection);
            var notifyUserLookup = notifyResults.ToLookup(row => row.LabelId);

            LabelNotifyUsers = notifyUserLookup.ToDictionary(row => row.Key, items => string.Join(", ", items.Select(u => u.UserName)));

            AppLabelItems = WorkItems.ToLookup(row => new AppLabelCell(row.ApplicationId, workItemLabelMap[row.Id]));

            var instructions = await new MyLabelInstructions()
            {
                OrgId = OrgId
            }.ExecuteAsync(connection);

            LabelInstructions = instructions.ToDictionary(row => row.LabelId);
        }