private void btnRemoveGroup_Click(object sender, RoutedEventArgs e) { if (AthleticsCommon.MsgBox("Are you sure to delete selected ServerGroup?", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel) { return; } if (grdServerGrid.SelectedIndex < 0) { AthleticsCommon.MsgBox("Please select a ServerGroup which you want to remove."); return; } try { ServerGroup serverGroup = grdServerGrid.SelectedItem as ServerGroup; DatabaseOperation.DeleteServerGroup(m_matchID, serverGroup.Order); m_serverGroup = DatabaseOperation.GetServerGroups(m_matchID); grdServerGrid.ItemsSource = m_serverGroup; } catch { } }
private void btnUpdateGroup_Click(object sender, RoutedEventArgs e) { if (grdServerGrid.SelectedIndex < 0) { return; } try { if (string.IsNullOrWhiteSpace(txtGroupLongname.Text) || string.IsNullOrWhiteSpace(txtGroupShortname.Text)) { AthleticsCommon.MsgBox("LongName and ShortName could not be null"); return; } else { ServerGroup serverGroup = grdServerGrid.SelectedItem as ServerGroup; DatabaseOperation.UpdateServerGroup(m_matchID, serverGroup.Order, txtGroupLongname.Text, txtGroupShortname.Text); m_serverGroup = DatabaseOperation.GetServerGroups(m_matchID); grdServerGrid.ItemsSource = m_serverGroup; txtGroupShortname.Text = ""; txtGroupLongname.Text = ""; } } catch { } }
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(); } }
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); }
private void btnAddGroup_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(txtGroupLongname.Text) || string.IsNullOrWhiteSpace(txtGroupShortname.Text)) { AthleticsCommon.MsgBox("LongName and ShortName could not be null"); return; } else { DatabaseOperation.AddServerGroup(m_matchID, txtGroupLongname.Text, txtGroupShortname.Text); m_serverGroup = DatabaseOperation.GetServerGroups(m_matchID); grdServerGrid.ItemsSource = m_serverGroup; } }
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(); } }
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; } }