Exemplo n.º 1
0
        private void TimesheetDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            int ID = int.Parse(TimesheetDataGridView.Rows[e.RowIndex].Cells["IDColumn"].Value.ToString());

            TimesheetRecord iTimesheetRecord = m_timesheets.FindById(ID);

            switch (TimesheetDataGridView.Columns[e.ColumnIndex].Name)
            {
            case "ClientColumn":
                iTimesheetRecord.Client = TimesheetDataGridView.Rows[e.RowIndex].Cells["ClientColumn"].Value.ToString();
                break;

            case "ProjectColumn":
                iTimesheetRecord.Project = TimesheetDataGridView.Rows[e.RowIndex].Cells["ProjectColumn"].Value.ToString();
                break;

            case "DateColumn":
                iTimesheetRecord.TaskDate.FromString(TimesheetDataGridView.Rows[e.RowIndex].Cells["DateColumn"].Value.ToString());
                break;

            case "TaskColumn":
                iTimesheetRecord.TaskTitle = TimesheetDataGridView.Rows[e.RowIndex].Cells["TaskColumn"].Value.ToString();
                break;

            case "StartTimeColumn":
                iTimesheetRecord.StartTime.FromString(TimesheetDataGridView.Rows[e.RowIndex].Cells["StartTimeColumn"].Value.ToString());
                break;

            case "EndTimeColumn":
                iTimesheetRecord.EndTime.FromString(TimesheetDataGridView.Rows[e.RowIndex].Cells["EndTimeColumn"].Value.ToString());
                break;
            }
            m_timesheets.Update(iTimesheetRecord);
        }
Exemplo n.º 2
0
        private void TaskAddButton_Click(object sender, EventArgs e)
        {
            TimesheetRecord iTimesheetRecord = new TimesheetRecord()
            {
                Client    = ClientComboBox.Text,
                Project   = ProjectComboBox.Text,
                TaskDate  = TaskDateDateTimePicker.Value,
                TaskTitle = TaskTitleTextBox.Text,
                StartTime = StartTimeDateTimePicker.Value,
                EndTime   = EndTimeDateTimePicker.Value
            };

            m_timesheets.Insert(iTimesheetRecord);

            StartTimeDateTimePicker.Value = EndTimeDateTimePicker.Value;

            RefreshTimesheetDataGridView();
        }