Beispiel #1
0
        public void Test1()
        {
            CalculateAvg ca = new CalculateAvg();

            ca.AddMarkAndPoints(90, 4);
            ca.SubstractMarkAndPoints(90, 4);

            Assert.Equal("0", ca.ToString());
        }
Beispiel #2
0
        private Dictionary <string, CalculateAvg> GetDictionaryMarkByYears()
        {
            Dictionary <string, CalculateAvg> yearAvg = new Dictionary <string, CalculateAvg>();

            foreach (ListViewItem item in dataListView.Items)
            {
                string yearOfCurrentItem = item.SubItems[(int)eSubItem.Year].Text;
                if (yearAvg.ContainsKey(yearOfCurrentItem))
                {
                    yearAvg[yearOfCurrentItem] = yearAvg[yearOfCurrentItem].AddMarkAndPoints(item.SubItems[(int)eSubItem.Mark].Text, item.SubItems[(int)eSubItem.Points].Text);
                }
                else
                {
                    CalculateAvg newCalAvg = new CalculateAvg();
                    newCalAvg.AddMarkAndPoints(item.SubItems[(int)eSubItem.Mark].Text, item.SubItems[(int)eSubItem.Points].Text);
                    yearAvg.Add(yearOfCurrentItem, newCalAvg);
                }
            }

            return(yearAvg);
        }
Beispiel #3
0
        private void addItemToListView(string[] i_DataToList)
        {
            try
            {
                ListViewItem lvi = new ListViewItem(i_DataToList[(int)eSubItem.CourseName]);
                lvi.SubItems.Add(i_DataToList[(int)eSubItem.Mark]);
                lvi.SubItems.Add(i_DataToList[(int)eSubItem.Points]);
                lvi.SubItems.Add(i_DataToList[(int)eSubItem.Year]);
                lvi.SubItems.Add(i_DataToList[(int)eSubItem.Semseter]);

                UtillsColors.RowColor(lvi, dataListView.Items.Count);

                m_CalAvg.AddMarkAndPoints(i_DataToList[(int)eSubItem.Mark], i_DataToList[(int)eSubItem.Points]);
                updateMarkAverageLabel();
                updateTotalPoints();

                dataListView.Items.Add(lvi);
            }
            catch (Exception)
            {
                MessageBox.Show(string.Format("Error in type please try{0}again after check the '?'", Environment.NewLine));
            }
        }