Beispiel #1
0
        private int Compare(Skola a, Skola b)
        {
            int    n = int.Parse(listBox1.Items.Count.ToString()), p, opada, u1 = 0, u2 = 0;
            string us, k;

            string[] array = vocab.GetRow();
            for (int i = 0; i < n; ++i)
            {
                us = listBox1.Items[i].ToString();
                p  = us.LastIndexOf(" ");
                k  = us.Substring(0, p);
                if (us[p + 1] == vocab.increase[0])
                {
                    opada = -1;
                }
                else
                {
                    opada = 1;
                }
                for (int j = 0; j < 13; ++j)
                {
                    if (k == array[j])
                    {
                        if (j == 0 || j == 3 || j == 12)
                        {
                            try
                            {
                                u1 = int.Parse(GetCorrectAttribute(a, j));
                                u2 = int.Parse(GetCorrectAttribute(b, j));
                            }
                            catch { }
                        }
                        else
                        {
                            u1 = string.Compare(GetCorrectAttribute(a, j), GetCorrectAttribute(b, j));
                            u2 = 0;
                        }
                        break;
                    }
                }
                if (u1 > u2)
                {
                    return(-1 * opada);
                }
                else if (u1 < u2)
                {
                    return(opada);
                }
            }
            return(0);
        }
 private void FFilter_Load(object sender, EventArgs e)
 {
     RefreshVocab();
     foreach (string s in vocab.GetRow())
     {
         dataGridView1.Columns.Add(s, s);
     }
     foreach (DataGridViewColumn column in dataGridView1.Columns)
     {
         column.SortMode = DataGridViewColumnSortMode.NotSortable;
     }
 }
Beispiel #3
0
 private void Viewer_Load(object sender, EventArgs e)
 {
     foreach (string s in vocab.GetRow())
     {
         dataGridView1.Columns.Add(s, s);
     }
     foreach (DataGridViewColumn column in dataGridView1.Columns)
     {
         column.SortMode = DataGridViewColumnSortMode.NotSortable;
     }
     foreach (Skola s in Data)
     {
         dataGridView1.Rows.Add(s.ToRow());
     }
 }