private void GetTasks(MySqlConnection conn)
        {
            MySqlCommand command = new MySqlCommand("SELECT id, Performer, Name, Status, NeedTime, EndTime FROM `tasks` WHERE Performer = '" + id + "'", conn);

            command.ExecuteNonQuery();

            MySqlDataAdapter adapter = new MySqlDataAdapter(command);

            tasksList = new ObservableCollection <TaskTable>();
            dt        = new DataTable("tasks");
            dbHandler db = new dbHandler();

            adapter.Fill(dt);

            foreach (DataRow row in dt.Rows)
            {
                var name      = Convert.ToString(row[2]);
                var status    = Convert.ToString(row[3]);
                var managerId = db.GetManager(Convert.ToInt32(row[1]));
                var manager   = db.GetUser(managerId);

                tasksList.Add(new TaskTable(name, status, manager));
            }

            TasksDG.ItemsSource = tasksList;
            adapter.Update(dt);
        }
Esempio n. 2
0
        private void GetExList(MySqlConnection conn)
        {
            DataTable dt = new DataTable("ex");
            dbHandler db = new dbHandler();

            MySqlCommand command = new MySqlCommand("SELECT id, FullName, Grade FROM `users` WHERE TypeUser = '******'", conn);

            command.ExecuteNonQuery();
            MySqlDataAdapter adapter = new MySqlDataAdapter(command);

            adapter.Fill(dt);

            foreach (DataRow row in dt.Rows)
            {
                var fullName  = Convert.ToString(row[1]);
                var grade     = Convert.ToString(row[2]);
                var managerId = db.GetManager(Convert.ToInt32(row[0]));
                var manager   = db.GetUser(managerId);
                exList.Add(new ExecutorTable(fullName, grade, manager));
            }
        }