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

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

            Assert.Equal("0", ca.ToString());
        }
        public DialogResult ShowDialog(string i_CourseName, byte i_Mark, CalculateAvg i_AverageMark, string i_Points)
        {
            m_PointsOfCourse = float.Parse(i_Points);
            m_AverageChange  = i_AverageMark;
            m_OldMark        = i_Mark;
            numericUpDownMarkToChange.Value = m_OldMark;
            labelCourseName.Text            = i_CourseName;
            updateAverageLabel();
            DialogResult result = ShowDialog();

            return(result);
        }
Example #3
0
        private List <CourseDiffrence> CourseDiffrencesInData()
        {
            List <CourseDiffrence> allCourseDiffrences = new List <CourseDiffrence>(dataListView.Items.Count);

            foreach (ListViewItem item in dataListView.Items)
            {
                float diffrenceValue = CalculateAvg.DifferenceValueTo100(
                    item.SubItems[(int)eSubItem.Mark].Text, item.SubItems[(int)eSubItem.Points].Text);

                allCourseDiffrences.Add(new CourseDiffrence(
                                            item.SubItems[(int)eSubItem.CourseName].Text, diffrenceValue));
            }

            return(allCourseDiffrences);
        }
Example #4
0
        //private void changeMarkToolStripMenuItem_Click(object sender, EventArgs e)
        //{

        //    if (dataListView.Items.Count > 0)
        //    {
        //        // dataListView.Items.Remove(dataListView.SelectedItems[0]);
        //        dataListView.LabelEdit = true;
        //        ListViewItem lvi = dataListView.SelectedItems[0];
        //        lvi.BeginEdit();

        //        dataListView.SelectedItems[0].BeginEdit();
        //        // dataListView.LabelEdit = false;
        //    }
        //}

        #endregion

        private void showPotensialValueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataListView.Items.Count > 0)
                {
                    string markString   = dataListView.SelectedItems[0].SubItems[(int)eSubItem.Mark].Text;
                    string pointsString = dataListView.SelectedItems[0].SubItems[(int)eSubItem.Points].Text;

                    float differenceValue = CalculateAvg.DifferenceValueTo100(markString, pointsString);

                    MessageBox.Show(string.Format(
                                        "Potensian more mark (untill up to 100) {0} the potensian is {1}", Environment.NewLine, differenceValue)
                                    , "Mark Potenseal");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error , try to pick a row .(Row will be in blue.)");
            }
        }
Example #5
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);
        }
Example #6
0
 public void ShowDialog(Dictionary <string, CalculateAvg> yearAvg, CalculateAvg m_CalAvg)
 {
     CalAverageStats = m_CalAvg;
     LoadData(yearAvg);
     ShowDialog();
 }