예제 #1
0
        private void refreshForm()
        {
            if (currentUser.isAdmin == true)
            {
                data = topicController.getTopicData("");
            }
            else
            {
                data = topicController.getTopicData(currentUser.userName);
            }

            dataGridView1.DataSource = data;
            dataGridView1.ClearSelection();
            dataGridView1.Columns[0].Visible = false;

            if (currentUser.isAdmin == true)
            {
                dataGridView1.Columns[3].Visible = true;
            }
            else
            {
                dataGridView1.Columns[3].Visible = false;
            }

            txtTopic.Text = "";
        }
예제 #2
0
        public void updateTooltipVisibility()
        {
            // FIRST PAGE, BEFORE LOGIN
            fileToolStripMenuItem.Visible = false;

            //lblUser.Visible = false;
            userToolStripMenuItem1.Visible     = false;
            loginToolStripMenuItem1.Visible    = true;
            registerToolStripMenuItem2.Visible = true;

            viewUserToolStripMenuItem1.Visible = false;
            viewTopicToolStripMenuItem.Visible = false;
            helpToolStripMenuItem.Visible      = false;

            backToolStripMenuItem.Visible             = false;
            criteriaListToolStripMenuItem1.Visible    = false;
            criteriaWeightToolStripMenuItem1.Visible  = false;
            alternativeListToolStripMenuItem1.Visible = false;
            openAllFormToolStripMenuItem1.Visible     = false;
            closeAllFormToolStripMenuItem1.Visible    = false;
            resultToolStripMenuItem1.Visible          = false;

            topicCountToolStripMenuItem.Visible       = false;
            criteriaCountToolStripMenuItem.Visible    = false;
            alternativeCountToolStripMenuItem.Visible = false;

            if (currentUser != null)
            {
                // SECOND PAGE, AFTER LOGIN
                //lblUser.Visible = true;
                //lblUser.Text = "Hi, " + currentUser.userName + "!";
                //lblUser.Parent = this;
                userToolStripMenuItem1.Visible = true;
                userToolStripMenuItem1.Text    = "Hi, " + currentUser.userName + "!";

                loginToolStripMenuItem1.Visible    = false;
                registerToolStripMenuItem2.Visible = false;

                if (currentUser.isAdmin)
                {
                    viewUserToolStripMenuItem1.Visible = true;
                }
                else
                {
                    viewUserToolStripMenuItem1.Visible = false;
                }
                viewTopicToolStripMenuItem.Visible = true;
                helpToolStripMenuItem.Visible      = true;

                backToolStripMenuItem.Visible             = false;
                criteriaListToolStripMenuItem1.Visible    = false;
                criteriaWeightToolStripMenuItem1.Visible  = false;
                alternativeListToolStripMenuItem1.Visible = false;
                openAllFormToolStripMenuItem1.Visible     = false;
                closeAllFormToolStripMenuItem1.Visible    = false;
                resultToolStripMenuItem1.Visible          = false;

                topicCountToolStripMenuItem.Visible = true;

                if (currentUser.isAdmin)
                {
                    topicCountToolStripMenuItem.Text = "Topic(s): " + topicController.getTopicData("").Count;
                }
                else
                {
                    topicCountToolStripMenuItem.Text = "Topic(s): " + topicController.getTopicData(currentUser.userName).Count;
                }

                criteriaCountToolStripMenuItem.Visible    = false;
                alternativeCountToolStripMenuItem.Visible = false;

                if (currentTopic != null)
                {
                    // THIRD PAGE, AFTER ACCESS TOPIC

                    loginToolStripMenuItem1.Visible    = false;
                    registerToolStripMenuItem2.Visible = false;

                    viewUserToolStripMenuItem1.Visible = false;
                    viewTopicToolStripMenuItem.Visible = false;
                    helpToolStripMenuItem.Visible      = true;

                    backToolStripMenuItem.Visible          = true;
                    criteriaListToolStripMenuItem1.Visible = true;
                    closeAllFormToolStripMenuItem1.Visible = true;
                    resultToolStripMenuItem1.Visible       = false;

                    string topicId          = currentTopic.topicId.ToString();
                    int    countCriteria    = mainController.countCriteria(topicId);
                    int    countAlternative = alternativeListController.getAlternativeList(topicId).Count;

                    topicCountToolStripMenuItem.Visible       = false;
                    criteriaCountToolStripMenuItem.Visible    = true;
                    criteriaCountToolStripMenuItem.Text       = "Criteria(s): " + countCriteria.ToString();
                    alternativeCountToolStripMenuItem.Visible = true;
                    alternativeCountToolStripMenuItem.Text    = "Alternative(s): " + countAlternative.ToString();

                    if (countCriteria < 3 || countCriteria > 11)
                    {
                        criteriaWeightToolStripMenuItem1.Visible  = false;
                        alternativeListToolStripMenuItem1.Visible = false;
                        openAllFormToolStripMenuItem1.Visible     = false;
                        resultToolStripMenuItem1.Visible          = false;
                    }
                    else
                    {
                        criteriaWeightToolStripMenuItem1.Visible  = true;
                        alternativeListToolStripMenuItem1.Visible = true;
                        openAllFormToolStripMenuItem1.Visible     = true;
                        resultToolStripMenuItem1.Visible          = false;

                        if (countAlternative >= 2)
                        {
                            resultToolStripMenuItem1.Visible = true;
                        }
                    }
                }
            }
        }