Пример #1
0
        /// <summary>
        /// code lifted from creating the project panels - needs work to get updates displaying nicely
        /// panels should get drawn under each other now
        /// needs consideration for making a drawPanels class to make these
        /// </summary>
        /// <param name="update"></param>
        private void CreateDisplayElements(UpdateObject update, int panelYpos)
        {
            Panel Panel_UpdatePanel = new Panel
            {
                Name      = "UpdatePanel_" + update.id,
                BackColor = Color.White,
                Width     = 430,
                Height    = 150,
                Location  = new Point(0, panelYpos)
            };

            Label Label_PostedBy = new Label
            {
                Name        = "UpdatePoster_" + update.posterId, //this is now the poster's username
                Location    = new Point(8, 8),
                Font        = new Font("Arial", 14f, FontStyle.Bold),
                ForeColor   = Color.FromArgb(82, 82, 82),
                MaximumSize = new Size(Panel_UpdatePanel.Width - 32, Panel_UpdatePanel.Height / 4), //50
                AutoSize    = true,
                Text        = "Posted By: " + update.posterId,

                Cursor = Cursors.Hand
            };

            Label Label_UpdateStatus = new Label
            {
                Name        = "UpdateStatus_" + update.newStatus,
                Location    = new Point(430 - 180, 8), //Panel_UpdatePanel.Width - this.Width - 8, wanted to do the width of the panel - the length of the label - a margin
                Font        = new Font("Arial", 10f, FontStyle.Bold),
                ForeColor   = Color.FromArgb(82, 82, 82),
                MaximumSize = new Size(Panel_UpdatePanel.Width - 32, Panel_UpdatePanel.Height / 4), //50
                AutoSize    = true,
                Text        = "Status: " + update.newStatus
            };

            RichTextBox RichText_UpdateComment = new RichTextBox
            {
                // this works but can't scroll through updates if mouse cursor is inside richtextbox
                Name        = "UpdateComment_" + update.comment,
                Location    = new Point(16, (Panel_UpdatePanel.Height / 4) + 16), //62
                Font        = new Font("Arial", 8f, FontStyle.Bold),
                ForeColor   = Color.FromArgb(82, 82, 82),
                Size        = new Size(Panel_UpdatePanel.Width - 32, Panel_UpdatePanel.Height / 2),
                MaximumSize = new Size(Panel_UpdatePanel.Width - 16, Panel_UpdatePanel.Height / 2),
                AutoSize    = true,
                Text        = update.comment,
                ReadOnly    = true
            };

            // i want the username to be clickable to take the user to the update poster's page
            // however update's posterId is now username and not their iduser
            // so conversion will be needed
            Label_PostedBy.Click += new EventHandler((sender, e) => UserClicked(sender, e, update.posterId.ToString()));

            Controls.Add(Panel_Updates);
            Panel_Updates.Controls.Add(Panel_UpdatePanel);
            Panel_UpdatePanel.Controls.Add(Label_PostedBy);
            Panel_UpdatePanel.Controls.Add(RichText_UpdateComment);
            Panel_UpdatePanel.Controls.Add(Label_UpdateStatus);
        }
Пример #2
0
        /// <summary>
        /// Go to DB with bug's ID, return all updates on this bug. make update objects with these updates
        /// and add them to a list of updates
        /// this code will be reused whenever we query the db (projects, bugs etc)
        /// </summary>
        /// <param name="bugId"></param>
        private void LoadUpdatesToList(string bugId)
        {
            //needs to go to db with bug id, return a table of updates and store these in a list
            //
            DataTable updates = Connection.GetDbConn().GetDataTable(SqlUpdate.GetUpdates(bugId));

            foreach (DataRow update in updates.Rows)
            {
                UpdateObject up = new UpdateObject(update["idupdate"].ToString(),
                                                   update["postedBy"].ToString(), update["comment"].ToString(), update["bug"].ToString(), update["newStatus"].ToString());
                UpdateObject.Updates.Add(up);
            }
        }