コード例 #1
0
        private void btnDelPos_Click(object sender, RoutedEventArgs e)
        {
            if (AthleticsCommon.MsgBox("Are you sure to delete selected judge position?", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            if (grdSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a judge which you want to remove.");
                return;
            }
            JudgeInfo pos = grdSelJudge.SelectedItem as JudgeInfo;

            if (DatabaseOperation.DelMatchOfficial(m_matchID, pos.ServantNum))
            {
                m_selJudge.RemoveAt(grdSelJudge.SelectedIndex);
                m_unSelJudge = DatabaseOperation.GetAvailableOfficial(m_matchID);
                grdUnSelJudge.ItemsSource = m_unSelJudge;
                FilterUnSelJudges();
            }
            else
            {
                AthleticsCommon.ShowLastErrorBox();
            }
        }
コード例 #2
0
        private bool UpdateJudge()
        {
            if (grdUnSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a judge in left list!");
                return(false);
            }
            if (grdSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a position in right list!");
                return(false);
            }

            JudgeInfo judge = grdUnSelJudge.SelectedItem as JudgeInfo;
            JudgeInfo pos   = grdSelJudge.SelectedItem as JudgeInfo;

            if (DatabaseOperation.UpdateMatchOfficial(m_matchID, pos.ServantNum, judge.RegisterID))
            {
                m_unSelJudge = DatabaseOperation.GetAvailableOfficial(m_matchID);
                grdUnSelJudge.ItemsSource = m_unSelJudge;
                FilterUnSelJudges();
                m_selJudge = DatabaseOperation.GetMatchOfficials(m_matchID, m_serverGroupID);
                grdSelJudge.ItemsSource = m_selJudge;
            }
            else
            {
                AthleticsCommon.ShowLastErrorBox();
                return(false);
            }
            return(true);
        }
コード例 #3
0
        private void btnNewPosition_Click(object sender, RoutedEventArgs e)
        {
            JudgeInfo judge = grdUnSelJudge.SelectedItem as JudgeInfo;
            JudgeInfo pos   = grdSelJudge.SelectedItem as JudgeInfo;

            if (DatabaseOperation.AddMatchOfficial(m_matchID, m_serverGroupID))
            {
                m_selJudge = DatabaseOperation.GetMatchOfficials(m_matchID, m_serverGroupID);
                grdSelJudge.ItemsSource = m_selJudge;
            }
            else
            {
                AthleticsCommon.ShowLastErrorBox();
            }
        }
コード例 #4
0
 private void btnDelAll_Click(object sender, RoutedEventArgs e)
 {
     if (AthleticsCommon.MsgBox("Are you sure to delete all judge positions?", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel)
     {
         return;
     }
     if (DatabaseOperation.ClearOfficialPosition(m_matchID, m_serverGroupID))
     {
         m_unSelJudge = DatabaseOperation.GetAvailableOfficial(m_matchID);
         grdUnSelJudge.ItemsSource = m_unSelJudge;
         FilterUnSelJudges();
         m_selJudge.Clear();
     }
     else
     {
         AthleticsCommon.ShowLastErrorBox();
     }
 }
コード例 #5
0
        private void ComboBox_PositionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cmb        = (sender as ComboBox);
            int      positionID = (int)cmb.SelectedValue;

            JudgePosition pos        = (cmb.ItemsSource as ObservableCollection <JudgePosition>)[cmb.SelectedIndex];
            string        newPosName = pos.Position;
            DataGridRow   row        = (DataGridRow)AthleticsCommon.VisualTreeSearchUp(cmb, typeof(DataGridRow));

            if (row != null)
            {
                JudgeInfo judge = row.DataContext as JudgeInfo;
                if (DatabaseOperation.UpdateJudgePosition(m_matchID, judge.ServantNum, positionID))
                {
                    judge.Position = newPosName;
                }
                else
                {
                    AthleticsCommon.ShowLastErrorBox();
                }
            }
            grdSelJudge.CancelEdit();
        }
コード例 #6
0
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (grdSelJudge.SelectedIndex < 0)
            {
                AthleticsCommon.MsgBox("Please select a judge which you want to remove.");
                return;
            }

            JudgeInfo pos = grdSelJudge.SelectedItem as JudgeInfo;

            if (DatabaseOperation.UpdateMatchOfficial(m_matchID, pos.ServantNum, -1))
            {
                pos.Name     = "";
                pos.NOC      = "";
                m_unSelJudge = DatabaseOperation.GetAvailableOfficial(m_matchID);
                grdUnSelJudge.ItemsSource = m_unSelJudge;
                FilterUnSelJudges();
            }
            else
            {
                AthleticsCommon.ShowLastErrorBox();
                return;
            }
        }