Exemple #1
0
        private void FillLog()
        {
            if (rbtSummary.Checked == true)
            {
                FillLogSummary();
            }
            else
            {
                DataTable dt = DataAccess.DataSet.Tables["ClockEvents"];

                int i = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    if (i < 17)
                    {
                        String type = dr["EventType"].ToString();
                        Debug.WriteLine("Attempting to parse date: " + dr["DT_Created"].ToString() + " for event " + dr["EventID"].ToString());
                        DateTime created = DateTime.Parse(dr["DT_Created"].ToString());
                        ClockEvent thisEvent = new ClockEvent(type, created);
                        lbxLog.Items.Add(thisEvent.ToString());
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
Exemple #2
0
        }//FillDataSet

        public void InsertEvent(ClockEvent clockEvent)
        {
            try
            {
                using (Connection = new SQLiteConnection(ConnectionString))
                {
                    String eventID       = GetNextClockEventID();
                    String eventType     = clockEvent.EventType;
                    String eventDateTime = clockEvent.DT_Created.ToString("yyyy-MM-dd HH:mm:ss");

                    String query =
                        "INSERT INTO ClockEvents " +
                        "VALUES (@eventID, @eventType, @eventDateTime)";

                    Connection.Open();

                    Command = new SQLiteCommand(query, Connection);
                    Command.Parameters.AddWithValue("@eventID", eventID);
                    Command.Parameters.AddWithValue("@eventType", eventType);
                    Command.Parameters.AddWithValue("@eventDateTime", eventDateTime);

                    Command.ExecuteNonQuery();

                    Connection.Close();
                }
                FillDataSet();
            }
            catch (Exception ex)
            {
                //TODO: Specify exception
                System.Windows.Forms.MessageBox.Show("Error in InsertEvent(): " + ex.Message);
            }
        }//InsertEvent()
Exemple #3
0
        private void FillLog()
        {
            if (rbtSummary.Checked == true)
            {
                FillLogSummary();
            }
            else
            {
                DataTable dt = DataAccess.DataSet.Tables["ClockEvents"];

                int i = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    if (i < 17)
                    {
                        String type = dr["EventType"].ToString();
                        Debug.WriteLine("Attempting to parse date: " + dr["DT_Created"].ToString() + " for event " + dr["EventID"].ToString());
                        DateTime   created   = DateTime.Parse(dr["DT_Created"].ToString());
                        ClockEvent thisEvent = new ClockEvent(type, created);
                        lbxLog.Items.Add(thisEvent.ToString());
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }//FillLog()
Exemple #4
0
        public void InsertEvent(ClockEvent clockEvent)
        {
            try
                {
                    using (Connection = new SQLiteConnection(ConnectionString))
                    {
                        String eventID = GetNextClockEventID();
                        String eventType = clockEvent.EventType;
                        String eventDateTime = clockEvent.DT_Created.ToString("yyyy-MM-dd HH:mm:ss");

                        String query =
                            "INSERT INTO ClockEvents " +
                            "VALUES (@eventID, @eventType, @eventDateTime)";

                        Connection.Open();

                        Command = new SQLiteCommand(query, Connection);
                        Command.Parameters.AddWithValue("@eventID", eventID);
                        Command.Parameters.AddWithValue("@eventType", eventType);
                        Command.Parameters.AddWithValue("@eventDateTime", eventDateTime);

                        Command.ExecuteNonQuery();

                        Connection.Close();
                    }
                    FillDataSet();
                }
                catch (Exception ex)
                {
                    //TODO: Specify exception
                    System.Windows.Forms.MessageBox.Show("Error in InsertEvent(): " + ex.Message);
                }
        }