Example #1
0
File: UPT.cs Project: am1guma/PSSC
 private void afiseazaStudentiCazati(object sender, EventArgs e)
 {
     int nr = Convert.ToInt32(textBox3.Text);
     double min = Convert.ToDouble(textBox4.Text);
     double max = Convert.ToDouble(textBox5.Text);
     List<FisaCazare> fise = new List<FisaCazare>();
     foreach (DataRowView drv in studentiBindingSource.List)
     {
         int suma = 0;
         int n = 0;
         foreach (DataRow dr in databaseDataSet.Tables[1].Rows)
             if (drv["Nr_matricol"].ToString().Equals(dr["Nr_matricol"].ToString()))
             {
                 suma += Convert.ToInt32(dr["Nota"].ToString());
                 n++;
             }
         FisaCazare fisa = new FisaCazare(drv["Nume"].ToString(), drv["Prenume"].ToString(), drv["Facultate"].ToString(), Convert.ToInt32(drv["An"].ToString()), Math.Round((double)suma / n,2));
         fise.Add(fisa);
     }
     List<FisaCazare> SortedList = fise.OrderByDescending(o => o.Medie).ToList().FindAll(c => (c.Medie<=max) && (c.Medie>=min));
     while (SortedList.Count > nr)
         SortedList.RemoveAt(SortedList.Count - 1);
     var bindingList = new BindingList<FisaCazare>(SortedList);
     var source = new BindingSource(bindingList, null);
     dataGridView1.DataSource = source;
 }
Example #2
0
File: UPT.cs Project: am1guma/PSSC
        private void afiseazaStudentiCazati(object sender, EventArgs e)
        {
            int               nr   = Convert.ToInt32(textBox3.Text);
            double            min  = Convert.ToDouble(textBox4.Text);
            double            max  = Convert.ToDouble(textBox5.Text);
            List <FisaCazare> fise = new List <FisaCazare>();

            foreach (DataRowView drv in studentiBindingSource.List)
            {
                int suma = 0;
                int n    = 0;
                foreach (DataRow dr in databaseDataSet.Tables[1].Rows)
                {
                    if (drv["Nr_matricol"].ToString().Equals(dr["Nr_matricol"].ToString()))
                    {
                        suma += Convert.ToInt32(dr["Nota"].ToString());
                        n++;
                    }
                }
                FisaCazare fisa = new FisaCazare(drv["Nume"].ToString(), drv["Prenume"].ToString(), drv["Facultate"].ToString(), Convert.ToInt32(drv["An"].ToString()), Math.Round((double)suma / n, 2));
                fise.Add(fisa);
            }
            List <FisaCazare> SortedList = fise.OrderByDescending(o => o.Medie).ToList().FindAll(c => (c.Medie <= max) && (c.Medie >= min));

            while (SortedList.Count > nr)
            {
                SortedList.RemoveAt(SortedList.Count - 1);
            }
            var bindingList = new BindingList <FisaCazare>(SortedList);
            var source      = new BindingSource(bindingList, null);

            dataGridView1.DataSource = source;
        }