public BugEntryGump(BugEntry entry, bool access)
            : base(0, 0)
        {
            _Entry  = entry;
            _Access = access;

            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddBackground(12, 14, 503, 568, 9200);
            this.AddLabel(25, 26, 254, String.Format("Created By: {0}", entry.Submitter));
            this.AddLabel(25, 46, 254, String.Format("Added on: {0}", entry.CreationTime.ToShortDateString()));
            this.AddLabel(25, 66, 254, String.Format("Last updated on: {0}", entry.LastUpdatedTime.ToShortDateString()));
            this.AddLabel(260, 26, 254, String.Format("Assigned To: {0}", Enum.GetName(typeof(AssignedTo), entry.AssignedTo)));
            this.AddLabel(260, 46, 254, String.Format("Status: {0}", Enum.GetName(typeof(BugStatus), entry.Status)));
            this.AddHtml(21, 94, 481, 174, entry.Description, (bool)true, (bool)true);      //Description
            this.AddHtml(21, 275, 481, 263, CreateComments(entry), (bool)true, (bool)true); //Comments
            this.AddLabel(26, 550, 254, @"Add Comment:");
            this.AddButton(116, 550, 4014, 4015, (int)Buttons.addBtn, GumpButtonType.Reply, 0);

            if (access)
            {
                this.AddLabel(154, 550, 254, @"Edit Entry:");
                this.AddButton(225, 550, 4014, 4015, (int)Buttons.editBtn, GumpButtonType.Reply, 0);
            }
        }
Exemple #2
0
        public static string FormatBug(BugEntry bug)
        {
            // If bugzilla validation is disabled, all bugs are uncertain
            if (string.IsNullOrEmpty(bug.Title))
            {
                return(FormatUncertainBug(bug));
            }

            return($"* [{bug.ID}](https://bugzilla.xamarin.com/show_bug.cgi?id={bug.ID}) -  {bug.Title}" + (String.IsNullOrEmpty(bug.SecondaryTitle) ? "" : $" / {bug.SecondaryTitle}"));
        }
        private void AddEntry(BugEntry bugEntry, int index)
        {
            int y = (index * 28) + 118;

            this.AddHtml(29, y, 317, 26, bugEntry.Title, (bool)true, (bool)false);                                                                                     //Description
            this.AddHtml(345, y, 101, 26, bugEntry.Submitter, (bool)true, (bool)false);                                                                                //Submitter
            this.AddHtml(445, y, 77, 26, Enum.GetName(typeof(BugStatus), bugEntry.Status), (bool)true, (bool)false);                                                   //Status
            this.AddHtml(521, y, 101, 26, Enum.GetName(typeof(AssignedTo), bugEntry.AssignedTo), (bool)true, (bool)false);                                             //Assigned To
            this.AddHtml(621, y, 117, 26, bugEntry.LastUpdatedTime.ToShortDateString() + " " + bugEntry.LastUpdatedTime.ToShortTimeString(), (bool)true, (bool)false); //Last Updated
            this.AddButton(739, y, 208, 209, ((_Page * 15) + index) + 1, GumpButtonType.Reply, 0);
        }
        private static int CompareDate(BugEntry one, BugEntry two)
        {
            if (one.CreationTime > two.CreationTime)
            {
                return(-1);
            }
            else if (one.CreationTime < two.CreationTime)
            {
                return(1);
            }

            return(0);
        }
 public static int Compare(BugEntry one, BugEntry two)
 {
     if ((int)one.Status < (int)two.Status)
     {
         return(-1);
     }
     else if ((int)one.Status > (int)two.Status)
     {
         return(1);
     }
     else
     {
         return(CompareDate(one, two));
     }
 }
        public AddCommentGump(BugEntry entry)
            : base(30, 20)
        {
            _Entry = entry;

            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddBackground(6, 22, 423, 171, 9200);
            this.AddAlphaRegion(17, 48, 399, 114);
            this.AddTextEntry(21, 52, 394, 108, 0, 0, @"");
            this.AddButton(383, 166, 4014, 4015, 1, GumpButtonType.Reply, 0);
            this.AddLabel(18, 26, 0, "Please fill out the box below.");
        }
Exemple #7
0
        static void PrintBug(BugEntry bug, bool potential, SearchOptions options)
        {
            if (!potential)
            {
                Console.WriteLine(FormatBug(bug));
            }
            else
            {
                Console.WriteLine(FormatUncertainBug(bug));
            }

            if (options.AdditionalBugInfo)
            {
                BugzillaChecker checker = new BugzillaChecker(options);
                checker.Setup().Wait();
                string additionalInfo = checker.LookupAdditionalInfo(bug.ID).Result;
                if (additionalInfo != null)
                {
                    Console.WriteLine($"\t{additionalInfo}");
                }
            }
        }
        public static string CreateComments(BugEntry entry)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Comments<br>------------------------------------<br>");

            if (entry.Comments == null)
            {
                entry.Comments = new List <CommentEntry>();
            }

            for (int i = 0; i < entry.Comments.Count; i++)
            {
                CommentEntry c = entry.Comments[i];
                if (c != null)
                {
                    sb.AppendFormat("Comment by: {0} - {1} {2}<br><br>{3}", c.Submitter,
                                    c.Created.ToShortDateString(), c.Created.ToShortTimeString(),
                                    c.Comment);
                }
            }

            return(sb.ToString());
        }
Exemple #9
0
 public static string FormatUncertainBug(BugEntry bug)
 {
     return($"* [{bug.ID}](https://bugzilla.xamarin.com/show_bug.cgi?id={bug.ID}) -  {bug.SecondaryTitle}");
 }
Exemple #10
0
        private void addButton_Click(object sender, System.EventArgs e)
        {
            if ( validateEntryInformation( ) )
            {
                BugEntry entry = new BugEntry( );

                entry.title = titleTextBox.Text;
                entry.submitter = submitterComboBox.Text;
                entry.submitDate = DateTime.Now;
                entry.owner = ownerComboBox.Text;
                entry.product = productComboBox.Text;
                entry.description = descriptionTextBox.Text;
                entry.closeDate = DateTime.Parse( closeDatePicker.Text );
                entry.mileStone = milestoneComboBox.Text;
                entry.priority = System.Convert.ToInt32( priorityComboBox.Text, 10 );
                entry.type = typeComboBox.Text;
                entry.isOpen = ( openStateComboBox.Text == "OPEN" );
                entry.bugID = new Guid( IDLabel.Text );
                entry.history = "USER " + username + " added bug " + entry.bugID + " on " + entry.submitDate.ToString( );

                if ( !addBugToDatabase( entry ) )
                {
                    MessageBox.Show( "Could not add bug to database!", "Error adding to DB" );
                }
                else
                {
                    addButton.Enabled = false;
                    updateButton.Enabled = true;

                    // Update the listing of bugs...
                    listBugs( );
                }
            }
        }
Exemple #11
0
        public bool updateBugInDatabase( BugEntry entry )
        {
            // Build up the insertion query string...
            string updateQuery = "UPDATE " + "BugDB" + " SET submitter='" + entry.submitter + "', submitDate='" + entry.submitDate.ToString( ) + "', owner='" + entry.owner + "', closeDate='" + entry.closeDate.ToString( ) + "', mileStone='" + entry.mileStone + "', priority='" + entry.priority.ToString( ) +
                                 "', product='" + entry.product + "', type='" + entry.type + "', description='" + entry.description + "', history='" + entry.history + "', title='" + entry.title + "', isOpen='" + boolToBit( entry.isOpen ).ToString( ) + "' WHERE bugID='" + entry.bugID.ToString( ) + "';";

            try
            {
                // Build up the sql command...
                SqlCommand cmd = new SqlCommand( updateQuery, dbConnection );

                // Perform the query to add the information to the database...
                cmd.ExecuteNonQuery( );
            }
            catch  ( Exception e )
            {
                MessageBox.Show( "A problem occurred during the add operation: \n\n" + e.Message, "Error adding to DB" );
                return false;
            }

            return true;
        }
Exemple #12
0
        public BugEntry getBugFromDatabase( Guid guid )
        {
            string selectQuery = "SELECT submitter, submitDate, owner, closeDate, mileStone, priority, product, type, description, history, bugID, title, isOpen FROM " + "BugDB WHERE " +
                                 "bugID='" + guid.ToString( ) + "';";

            BugEntry dbEntry = null;

            SqlDataReader sr = null;

            try
            {
                SqlCommand queryCommand = new SqlCommand( selectQuery, dbConnection );

                sr = queryCommand.ExecuteReader( );

                dbEntry = new BugEntry( );

                while ( sr.Read( ) )
                {
                    dbEntry.submitter = sr.GetString( 0 );
                    dbEntry.submitDate = sr.GetDateTime( 1 );
                    dbEntry.owner = sr.GetString( 2 );
                    dbEntry.closeDate = sr.GetDateTime( 3 );
                    dbEntry.mileStone = sr.GetString( 4 );
                    dbEntry.priority = sr.GetInt32( 5 );
                    dbEntry.product = sr.GetString( 6 );
                    dbEntry.type = sr.GetString( 7 );
                    dbEntry.description = sr.GetString( 8 );
                    dbEntry.history = sr.GetString( 9 );
                    dbEntry.bugID = sr.GetGuid( 10 );
                    dbEntry.title = sr.GetString( 11 );
                    dbEntry.isOpen = sr.GetBoolean( 12 );
                }
            }
            catch
            {
                // Return null if failure...
                dbEntry = null;
            }
            finally
            {
                sr.Close( );
            }

            return dbEntry;
        }
Exemple #13
0
        public void fillInBugInformation( BugEntry entry )
        {
            titleTextBox.Text = entry.title;
            submitterComboBox.SelectedIndex = submitterComboBox.Items.IndexOf( entry.submitter );
            submitDatePicker.Text = entry.submitDate.ToString( );
            ownerComboBox.SelectedIndex = ownerComboBox.Items.IndexOf( entry.owner );
            productComboBox.SelectedIndex = productComboBox.Items.IndexOf( entry.product );
            descriptionTextBox.Text = entry.description;
            closeDatePicker.Text = entry.closeDate.ToString( );
            milestoneComboBox.SelectedIndex = milestoneComboBox.Items.IndexOf( entry.mileStone );
            priorityComboBox.SelectedIndex = priorityComboBox.Items.IndexOf( entry.priority.ToString( ) );
            typeComboBox.SelectedIndex = typeComboBox.Items.IndexOf( entry.type );

            if ( entry.isOpen )
                openStateComboBox.SelectedIndex = openStateComboBox.Items.IndexOf( "OPEN" );
            else
                openStateComboBox.SelectedIndex = openStateComboBox.Items.IndexOf( "CLOSED" );

            IDLabel.Text = entry.bugID.ToString( );
        }
Exemple #14
0
        private void updateButton_Click(object sender, System.EventArgs e)
        {
            BugEntry entry = new BugEntry( );

            entry.title = titleTextBox.Text;
            entry.submitter = submitterComboBox.Text;
            entry.submitDate = DateTime.Now;
            entry.owner = ownerComboBox.Text;
            entry.product = productComboBox.Text;
            entry.description = descriptionTextBox.Text;
            entry.closeDate = DateTime.Parse( closeDatePicker.Text );
            entry.mileStone = milestoneComboBox.Text;
            entry.priority = System.Convert.ToInt32( priorityComboBox.Text, 10 );
            entry.type = typeComboBox.Text;
            entry.isOpen = ( openStateComboBox.Text == "OPEN" );
            entry.bugID = new Guid( IDLabel.Text );
            entry.history = "USER " + username + " updated bug " + entry.bugID + " on " + entry.submitDate.ToString( );

            // Update the entry in the database...
            updateBugInDatabase( entry );

            listBugs( );
        }
Exemple #15
0
        public bool addBugToDatabase( BugEntry entry )
        {
            // Build up the insertion query string...
            string insertQuery = "INSERT " + "BugDB" + " (submitter, submitDate, owner, closeDate, mileStone, priority, product, type, description, history, bugID, title, isOpen ) VALUES ('" +
                 entry.submitter + "', '" + entry.submitDate.ToString( ) + "', '" + entry.owner + "', '" + entry.closeDate + "', '" + entry.mileStone + "', '" + entry.priority.ToString( ) + "', '" + entry.product + "', '" +
                 entry.type + "', '" + entry.description + "', '" + entry.history + "', '" + entry.bugID.ToString( ) + "', '" + entry.title + "', '" + boolToBit( entry.isOpen ).ToString( ) + "');";

            try
            {
                // Build up the sql command...
                SqlCommand cmd = new SqlCommand( insertQuery, dbConnection );

                // Perform the query to add the information to the database...
                cmd.ExecuteNonQuery( );
            }
            catch  ( Exception e )
            {
                MessageBox.Show( "A problem occurred during the add operation: \n\n" + e.Message, "Error adding to DB" );
                return false;
            }

            return true;
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            if (m == null)
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 0: break;     //Cancel

            case 60000:
            {
                if (_Page < 5)
                {
                    _Page++;
                }

                m.CloseGump(typeof(BugTrackerGump));
                m.SendGump(new BugTrackerGump(_Entries, _Page));
                break;
            }

            case 59999:
            {
                if (_Page > 0)
                {
                    _Page--;
                }

                m.CloseGump(typeof(BugTrackerGump));
                m.SendGump(new BugTrackerGump(_Entries, _Page));
                break;
            }

            default:     //Any Entry
            {
                try
                {
                    int      index = info.ButtonID - 1;
                    BugEntry entry = _Entries[index];

                    if (entry == null)
                    {
                        m.SendMessage("Entry was deleted during a world save.");
                        return;
                    }

                    bool access = (m.AccessLevel >= AccessLevel.Seer);

                    m.CloseGump(typeof(BugEntryGump));
                    m.SendGump(new BugEntryGump(entry, access));
                }
                catch
                {
                    Console.WriteLine("Bug Tracker: Invlid index selected.");
                }
                break;
            }
            }
        }