public EditTimeRecord(TimeSheetDetailData data, Mode mode)
        {
            InitializeComponent();

            m_data = data;
            m_mode = mode;
        }
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (m_mode == ReportMode.DetailReportMode)
                return;

            TimeSheetDetailData data = new TimeSheetDetailData();
            data.m_workId = "-1";
            data.m_date = DBHelper.DateToDBDate(DateTime.Now);
            data.m_workStartTime = DBHelper.DateToDBDateTime(DateTime.Now.Subtract(new TimeSpan(0,15,0)));
            data.m_workEndTime = DBHelper.DateToDBDateTime(DateTime.Now);

            DisplayEditDialog(data, EditTimeRecord.Mode.AddMode);
        }
        private void DisplayEditDialog(TimeSheetDetailData data, EditTimeRecord.Mode mode )
        {
            EditTimeRecord dlg = new EditTimeRecord(data, mode);
            dlg.textBoxTimeAccrued.Text = data.m_minsAccrued;
            dlg.textBoxPMONumber.Text = data.m_PMONumber;
            dlg.textBoxWorkEndTime.Text = data.m_workEndTime;
            dlg.textBoxWorkStartDate.Text = data.m_workStartTime;
            dlg.textBoxDate.Text = data.m_date;
            dlg.textBoxWorkId.Text = data.m_workId;

            if ( dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK )
            {
                LoadData(m_now);
            }
        }
        private void AddToDataGridView(TimeSheetDetailData data, Color c)
        {
            try
            {
                int nNewRow = dataGridView1.Rows.Add();

                int nColCount = 0;

                dataGridView1.Rows[nNewRow].Tag = data;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = data.m_workId;
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = data.m_date;
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = data.m_workStartTime;
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = data.m_workEndTime;
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = data.m_PMONumber;
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = data.m_desc;
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;

                dataGridView1.Rows[nNewRow].Cells[nColCount].Value = TotalMinsToFriendlyTime(data.m_minsAccrued);
                dataGridView1.Rows[nNewRow].Cells[nColCount++].Style.ForeColor = c;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        private void LoadData(DateTime dateStart)
        {
            try
            {
                SetTitleText();

                dataGridView1.Rows.Clear();

                string sql = GenerateSQL(dateStart);

                SQLiteCommand command = new SQLiteCommand(sql, LocalSqllite.m_sqlLiteConnection);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    TimeSheetDetailData data = new TimeSheetDetailData();
                    data.m_workId = reader["work_id"].ToString();
                    data.m_date = reader["date"].ToString();
                    data.m_workStartTime = reader["work_start_time"].ToString();
                    data.m_workEndTime = reader["work_end_time"].ToString();
                    data.m_PMONumber = reader["pmo_number"].ToString();
                    data.m_desc = reader["description"].ToString();
                    data.m_minsAccrued = reader["mins_accrued"].ToString();

                    AddToDataGridView(data, Color.Black);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            SetWeekText();
        }