Ejemplo n.º 1
0
        /// <summary>
        /// Add a judge member to the judge members list.
        /// </summary>
        /// <param name="judgeMember"></param>
        /// <returns>1 if successful, 0 if an error occured when inserting.</returns>
        public int addJudgeMember(JudgeMember judgeMember)
        {
            judgeMembers.Add(judgeMember);

            // TODO: add actual error codes
            return(1);
        }
Ejemplo n.º 2
0
        public void AddJudge(JudgeMember judgeMember)
        {
            judgeMembers.Add(judgeMember);

            judgeMembersToAdd.Remove(judgeMember);

            judgesDataGridView.Rows.Add(judgeMember.Name, judgeMember.Email);

            UpdateDataGridView(judgesDataGridView);
        }
Ejemplo n.º 3
0
        private void acceptButton_Click(object sender, EventArgs e)
        {
            // Get currently selected judge in dataGridView
            // Check if any judge is selected
            if (judgesGridView.CurrentCell != null)
            {
                JudgeMember judgeMember = (JudgeMember)judgesGridView.Rows[judgesGridView.CurrentCell.RowIndex].DataBoundItem;

                editContestForm.AddJudge(judgeMember);

                this.Close();
            }
            else
            {
                MessageBox.Show(null, "You must select a judge.", "Error");
            }
        }
Ejemplo n.º 4
0
        public bool refreshJudges()
        {
            // Load the judges from the Database
            string query = "SELECT id_user, fullname, email FROM user_table";

            SqlCommand cmd = DBSqlHelper._instance.conn.CreateCommand();

            cmd.CommandText = query;

            // Execute query
            using (DbDataReader reader = cmd.ExecuteReader())
            {
                // Check if user exists
                if (reader.HasRows)
                {
                    judgeMembers.Clear();

                    while (reader.Read())
                    {
                        // Construct user information from database
                        JudgeMember judge = new JudgeMember(reader.GetInt32(0), reader.GetString(1), reader.GetString(2));

                        // Check if judge is not the current user
                        if (judge.Id != loggedInUser.id)
                        {
                            // Add it to the list
                            judgeMembers.Add(judge);
                        }
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }