Exemplo n.º 1
0
        public List <string[]> return_schedule_trainer(string id)
        {
            SqlCommand command = new SqlCommand("SELECT * FROM [schedule] where trainer_id = '" + id + "'", db.GetConnection());

            activity        activity   = new activity();
            List <activity> activities = activity.return_activities();

            db.openConnection();
            SqlDataReader   reader = command.ExecuteReader();
            List <string[]> data   = new List <string[]>();

            while (reader.Read())
            {
                data.Add(new string[6]);

                data[data.Count - 1][0] = reader[0].ToString();
                data[data.Count - 1][1] = reader[1].ToString();
                data[data.Count - 1][2] = activities.Find(item => item.Id == (Convert.ToInt32(reader[2].ToString()))).activity_name;
                data[data.Count - 1][3] = reader[3].ToString().Substring(0, 5);
                data[data.Count - 1][4] = reader[4].ToString();
                data[data.Count - 1][5] = reader[5].ToString();
            }
            reader.Close();
            db.closeConnection();

            return(data);
        }
Exemplo n.º 2
0
        private void metro7_click(object sender, MouseEventArgs e)
        {
            activity        activity   = new activity();
            List <activity> activities = activity.return_activities();

            metroComboBox7.DataSource    = activities;
            metroComboBox7.DisplayMember = "activity_name";
            metroComboBox7.ValueMember   = "Id";
        }