Esempio n. 1
0
        private void processTimeFile()
        {
            Business.Employees = new List<Person>();

            string line;
            TimeEntry entry=null;

            try
            {
                using (StreamReader file = new StreamReader(txtTimeFile.Text))
                {
                    file.ReadLine();
                    while ((line = file.ReadLine()) != null)
                    {
                        entry = new TimeEntry(line);
                        Person employee = Business.Employees.Find(person => person.Id == entry.EmployeeNumber);
                        if (employee == null)
                        {
                            employee = new Person();
                            employee.Id = entry.EmployeeNumber;
                            employee.Name = entry.Name;
                            employee.AddTimeEntry(entry);
                            Business.Employees.Add(employee);
                        }
                        else
                        {
                            employee.AddTimeEntry(entry);
                        }
                    }

                    file.Close();
                }
            }
            catch (Exception ex)
            {
                txtOutput.Text = ex.Message + Environment.NewLine + entry==null?String.Empty:entry.RawEntryString;
            }

            int selectedInx = cbxIds.SelectedIndex;
            cbxIds.Items.Clear();
            foreach( Person person in Business.Employees)
            {
                cbxIds.Items.Add(person.Id);
            }
            cbxIds.SelectedIndex = selectedInx;
        }
Esempio n. 2
0
 public void AddTimeEntry( TimeEntry entry)
 {
     _timeEntries.Add(entry);
 }
Esempio n. 3
0
 public void AddTimeEntry(TimeEntry entry)
 {
     _timeEntries.Add(entry);
 }