public void FormFill() { //загрузка перечня пользователей UsersData usd = new UsersData(); listOfUsers = usd.UsersFind(); //загрузка перечня проектов Workspaces workspaces = new Workspaces(); listOfWorkspaces = workspaces.WorkspacesFind(); foreach (DatumWSR i in listOfWorkspaces) { comboBoxWs.Items.Add(i.name); } comboBoxWs.SelectedIndex = 0; FillCombos(); }
private void buttonRun_Click(object sender, EventArgs e) { dataGridView1.Rows.Clear(); label6.Text = "Загрузка перечня..."; TaskData td = new TaskData(); UsersData usd = new UsersData(); List <Datum> listOfUsers = usd.UsersFind(); Workspaces workspaces = new Workspaces(); List <DatumWSR> ws = workspaces.WorkspacesFind(); string workspaceGid = ws[comboBoxWs.SelectedIndex].gid; ProjectNames pn = new ProjectNames(); List <Datum> listOfProjects = pn.ProjectsFind(workspaceGid);//краткий перечень проектов string projectGid; if (comboBoxProject.SelectedIndex >= 0) { projectGid = listOfProjects[comboBoxProject.SelectedIndex].gid; } else { projectGid = null; } List <Datum> listOfTasks = td.TasksFind(projectGid); string assignee = listOfUsers[comboBoxUser.SelectedIndex].gid; TaskFullData tfd = new TaskFullData(); int n = 1; bool yes = false; int c1 = listOfTasks.Count(); int t = 1; label6.Text = "Обработка данных..."; foreach (Datum i in listOfTasks) { yes = false; DataTaskFull dtf = tfd.TasksFind(i.gid); string follw = ""; foreach (TheElement ftf in dtf.followers) { follw += ftf.name + "; "; } string proj = ""; foreach (TheElement ftf in dtf.projects) { proj += ftf.name + "; "; } if (dtf.assignee != null) { if (dtf.assignee.gid == assignee) { yes = true; } } bool compCheck = false; if (checkBoxNotDone.Checked == false) { compCheck = true; } if (yes & (dtf.completed == compCheck || dtf.completed == false)) { dataGridView1.Rows.Add(t, i.name, dtf.assignee.name, follw, dtf.due_on, dtf.completed, proj, dtf.notes); t++; } progressBar1.Value = Convert.ToInt32(n * 100 / c1); n++; } label6.Text = "Данные загружены"; }