コード例 #1
0
ファイル: Form1.cs プロジェクト: ajay61850/Sky
        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;
        }
コード例 #2
0
ファイル: DataTypes.cs プロジェクト: ajay61850/Sky
 public void AddTimeEntry( TimeEntry entry)
 {
     _timeEntries.Add(entry);
 }
コード例 #3
0
 public void AddTimeEntry(TimeEntry entry)
 {
     _timeEntries.Add(entry);
 }