Beispiel #1
0
        // PREPARE COMMAND
        // ---------------

        private static void PrepareCommand(SqlCommand command, TimesAdd time)
        {
            command.Parameters.AddWithValue("@id", time.id);
            command.Parameters.AddWithValue("@s_id", time.s_id);
            command.Parameters.AddWithValue("@b_id", time.b_id);
            command.Parameters.AddWithValue("@leaving", time.leaving);
            command.Parameters.AddWithValue("@delay", time.delay);
            command.Parameters.AddWithValue("@last_known_stop", time.last_known_stop);
            command.Parameters.AddWithValue("@next_stop", time.next_stop);
        }
Beispiel #2
0
        // UPDATE USER
        // -----------

        public static int Update(TimesAdd time)
        {
            Database db;

            db = new Database();
            db.Connect();

            SqlCommand command = db.CreateCommand(SQL_UPDATE);

            PrepareCommand(command, time);
            int ret = db.ExecuteNonQuery(command);

            db.Close();

            return(ret);
        }
Beispiel #3
0
        private static Collection <TimesAdd> Read2(SqlDataReader reader)
        {
            Collection <TimesAdd> times = new Collection <TimesAdd>();

            while (reader.Read())
            {
                int      i    = -1;
                TimesAdd time = new TimesAdd();
                time.id              = reader.GetInt32(++i);
                time.s_id            = reader.GetInt32(++i);
                time.b_id            = reader.GetInt32(++i);
                time.leaving         = reader.GetDateTime(++i);
                time.delay           = reader.GetInt32(++i);
                time.last_known_stop = reader.GetInt32(++i);
                times.Add(time);
            }
            return(times);
        }