Пример #1
0
 private void lastSol_Click(object sender, EventArgs e)
 {
     Cursor     = Cursors.WaitCursor;
     solutionBS = new BindingSource();
     if (comboBox1.SelectedIndex == comboBox1.Items.Count - 1)
     {
         solutionBS.DataSource = DBSolution.GetByID(numberOfSolutions);
     }
     else
     {
         string pName = ((Profs)comboBox1.Items[comboBox1.SelectedIndex]).ProfName;
         solutionBS = new BindingSource
         {
             DataSource = DBSolution.GetByProfID(pName, numberOfSolutions)
         };
     }
     solIndex = numberOfSolutions;
     solutionViewGrid.DataSource     = solutionBS;
     bindingNavigator1.BindingSource = solutionBS;
     label2.Text = "";
     for (int y = 0; y < Notes[solIndex - 1].Count; y++)
     {
         label2.Text += Convert.ToString(Notes[solIndex - 1][y]);
     }
     SolUpDown.ValueChanged += null;
     SolUpDown.Value         = solIndex;
     SolUpDown.ValueChanged += SolUpDown_ValueChanged;
     nextSol.Enabled         = false;
     lastSol.Enabled         = false;
     firstSol.Enabled        = true;
     prevSol.Enabled         = true;
     Cursor = Cursors.Default;
 }
Пример #2
0
 private void SolUpDown_ValueChanged(object sender, EventArgs e)
 {
     Cursor      = Cursors.WaitCursor;
     solutionBS  = new BindingSource();
     solIndex    = Convert.ToInt16(SolUpDown.Value);
     label2.Text = "";
     if (solIndex < 1)
     {
         return;
     }
     if (Notes == null)
     {
         return;
     }
     for (int y = 0; y < Notes[solIndex - 1].Count; y++)
     {
         label2.Text += Convert.ToString(Notes[solIndex - 1][y]);
     }
     if (comboBox1.SelectedIndex == comboBox1.Items.Count - 1)
     {
         solutionBS.DataSource = DBSolution.GetByID(solIndex);
     }
     else
     {
         string pName = ((Profs)comboBox1.Items[comboBox1.SelectedIndex]).ProfName;
         solutionBS.DataSource = DBSolution.GetByProfID(pName, solIndex);
     }
     solutionViewGrid.DataSource     = solutionBS;
     bindingNavigator1.BindingSource = solutionBS;
     if (solIndex == 1)
     {
         firstSol.Enabled = false;
         prevSol.Enabled  = false;
     }
     else
     {
         firstSol.Enabled = true;
         prevSol.Enabled  = true;
     }
     if (solIndex == numberOfSolutions)
     {
         nextSol.Enabled = false;
         lastSol.Enabled = false;
     }
     else
     {
         nextSol.Enabled = true;
         lastSol.Enabled = true;
     }
     Cursor = Cursors.Default;
 }
Пример #3
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     if (comboBox1.SelectedIndex == comboBox1.Items.Count - 1)
     {
         SolUpDown_ValueChanged(null, null);
     }
     else
     {
         if (numberOfSolutions > 0)
         {
             string pName = ((Profs)comboBox1.Items[comboBox1.SelectedIndex]).ProfName;
             solutionBS = new BindingSource
             {
                 DataSource = DBSolution.GetByProfID(pName, (int)SolUpDown.Value)
             };
             solutionViewGrid.DataSource     = solutionBS;
             bindingNavigator1.BindingSource = solutionBS;
         }
     }
     Cursor = Cursors.Default;
 }