Exemple #1
0
        private void setDatePickers()
        {
            Parser.Employee emp = parser.getEmployeeByName(employeesList.Text.ToString());
            if (emp == null || emp.results == null || emp.results.Count <= 0)
            {
                dateFrom.Enabled = false;
                dateTo.Enabled   = false;
                return;
            }
            dateFrom.Enabled = true;
            dateTo.Enabled   = true;
            int id = 0;

            for (int i = 0; i < emp.results.Count; i++)
            {
                string[] date  = emp.results[i].date.Split('/');
                string[] fdate = emp.results[id].date.Split('/');
                if (int.Parse(fdate[2]) < int.Parse(date[2]))
                {
                    continue;
                }
                else if (int.Parse(fdate[2]) > int.Parse(date[2]))
                {
                    id = i;
                }
                else if (int.Parse(fdate[1]) < int.Parse(date[1]))
                {
                    continue;
                }
                else if (int.Parse(fdate[1]) > int.Parse(date[1]))
                {
                    id = i;
                }
                else if (int.Parse(fdate[0]) < int.Parse(date[0]))
                {
                    continue;
                }
                else if (int.Parse(fdate[0]) > int.Parse(date[0]))
                {
                    id = i;
                }
            }
            Console.WriteLine("emp.results[id].date " + emp.results[id].date);
            string[] parts    = emp.results[id].date.Split('/');
            DateTime firstDay = new DateTime(int.Parse(parts[2]), int.Parse(parts[1]), int.Parse(parts[0]));

            dateFrom.CustomFormat = "dd/MM/yyyy";
            dateFrom.Format       = DateTimePickerFormat.Custom;
            dateTo.CustomFormat   = "dd/MM/yyyy";
            dateTo.Format         = DateTimePickerFormat.Custom;
            dateFrom.MinDate      = firstDay;
            dateFrom.MaxDate      = DateTime.Today;
            dateTo.MinDate        = firstDay;
            dateTo.MaxDate        = DateTime.Today;
            dateFrom.Value        = firstDay;
            dateTo.Value          = DateTime.Today;
        }
Exemple #2
0
        private void loadAverages()
        {
            float intime  = 0;
            float quality = 0;
            int   count   = 0;

            Parser.Employee emp = parser.getEmployeeByName(employeesList.Text.ToString());
            if (emp == null)
            {
                return;
            }

            for (int i = 0; i < emp.results.Count; i++)
            {
                Console.WriteLine(emp.name + ": " + i + " " + emp.results[i].date + " " + emp.results[i].intime + " " + emp.results[i].quality);
            }

            if (emp.results.Count > 0)
            {
                for (int i = 0; i < emp.results.Count; i++)
                {
                    if (isInside(emp.results[i].date))
                    {
                        if (emp.results[i].intime)
                        {
                            intime++;
                        }
                        quality += emp.results[i].quality;
                        count++;
                    }
                }
                if (count == 0)
                {
                    return;
                }
                intime            *= 100;
                intime            /= count;
                quality           *= 50;
                quality           /= count;
                intimeCircle.Value = (int)intime;
                intimeCircle.Update();
                intimeCircle.Text   = "" + (int)intime;
                qualityCircle.Value = (int)quality;
                qualityCircle.Update();
                qualityCircle.Text = "" + (int)quality;
            }
            else
            {
                intimeCircle.Value = 0;
                intimeCircle.Update();
                intimeCircle.Text   = "0";
                qualityCircle.Value = 0;
                qualityCircle.Update();
                qualityCircle.Text = "0";
            }
        }
Exemple #3
0
        private void add_Click(object sender, EventArgs e)
        {
            //addEmployeesFromList();
            Parser parser = new Parser(form);

            Parser.Employee emp = new Parser.Employee();
            emp.name    = name.Text.ToString();
            emp.results = new List <Parser.Result>();
            parser.getEmployees().Add(emp);
            parser.serialize();
            Close();
            form.setAddedEmployee(emp.name);
        }
Exemple #4
0
 private void addEmployeesFromList()
 {
     String[] content = System.IO.File.ReadAllText(@"C:\Users\Joeri\Desktop\names.txt").Split('\n');
     for (int i = 0; i < content.Length; i++)
     {
         Parser          parser = new Parser(form);
         Parser.Employee emp    = new Parser.Employee();
         emp.name    = content[i];
         emp.results = new List <Parser.Result>();
         parser.getEmployees().Add(emp);
         parser.serialize();
     }
     Close();
 }
Exemple #5
0
        private void save_Click(object sender, EventArgs e)
        {
            Parser parser = new Parser(form);

            if (qualityCombo.Text.Equals(""))
            {
                MessageBox.Show("Je bent vergeten de kwaliteit in te vullen!");
                return;
            }
            int    quality = 1;
            string q       = qualityCombo.Text.ToString();

            if (q.Equals(qualityCombo.Items[0]))
            {
                quality = 0;
            }
            else if (q.Equals(qualityCombo.Items[2]))
            {
                quality = 2;
            }
            string date = day.Text.ToString().Split(' ')[1];

            Console.WriteLine("date " + date);
            Parser.Employee emp = parser.getEmployeeByName(name);
            if (emp != null)
            {
                for (int i = 0; i < emp.results.Count; i++)
                {
                    if (emp.results[i].date.Equals(date))
                    {
                        MessageBox.Show("Er is al een resultaat ingevuld op deze datum voor deze persoon!");
                        return;
                    }
                }
                Parser.Result result = new Parser.Result();
                result.date    = date;
                result.intime  = intimeCheckbox.Checked;
                result.quality = quality;
                emp.results.Add(result);
                parser.serialize();
            }
            Close();
        }
Exemple #6
0
        private void setupChart()
        {
            clearChart();
            string[]        daysInWeek = new string[] { "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag" };
            Parser.Employee emp        = parser.getEmployeeByName(employeesList.Text.ToString());
            if (emp == null)
            {
                return;
            }
            DateTime dtt = firstDateOfWeek(week);

            for (int i = 0; i < 7; i++)
            {
                DateTime dt = dtt.AddDays(i);
                string   s  = dt.Date.Day + "/" + dt.Date.Month + "/" + dt.Date.Year;
                for (int j = 0; j < emp.results.Count; j++)
                {
                    if (emp.results[j].date.Equals(s))
                    {
                        if (emp.results[j].intime)
                        {
                            chart1.Series["Op tijd klaar"].Points[i].SetValueY(100);
                        }
                        else
                        {
                            chart1.Series["Op tijd klaar"].Points[i].SetValueY(1);
                        }
                        int ii = emp.results[j].quality * 50;
                        if (ii <= 0)
                        {
                            ii = 1;
                        }
                        chart1.Series["Kwaliteit"].Points[i].SetValueY(ii);
                        continue;
                    }
                }
            }
            chart1.ChartAreas[0].AxisY.Maximum = 100;
        }