private void новаяЗадачаНаОсновеВыбраннойToolStripMenuItem_Click(object sender, EventArgs e) { if (task_listView.SelectedItems.Count != 0) { TaskActionForm taskAction = new TaskActionForm(); List <object[]> res = DataBase.SelectQuery("select * from users;", m_Cfg.DbConnectionString); if (res.Count > 0) { List <UserInfo> usr_lst = new List <UserInfo>(); for (int i = 0; i < res.Count; i++) { usr_lst.Add(new UserInfo((int)res[i][0], (string)res[i][1])); } taskAction.UserList = usr_lst; taskAction.confirm_end_task_btn.Enabled = false; taskAction.return_task_btn.Enabled = false; taskAction.edit_task.Text = "Создать задачу"; taskAction.TaskInfo = new TaskInfo(0, ((TaskInfo)task_listView.SelectedItems[0].Tag).TaskContent, ((TaskInfo)task_listView.SelectedItems[0].Tag).IspId, ((TaskInfo)task_listView.SelectedItems[0].Tag).SoglId, ((TaskInfo)task_listView.SelectedItems[0].Tag).DateBegin, ((TaskInfo)task_listView.SelectedItems[0].Tag).DateEnd, 0); DialogResult dr = taskAction.ShowDialog(); if (dr == DialogResult.OK) { DataBase.InsertTaskQuery(taskAction.TaskInfo, m_Cfg.DbConnectionString); refresh_btn_Click(null, null); } } } }
private void task_listView_MouseDoubleClick(object sender, MouseEventArgs e) { if (task_listView.SelectedItems.Count != 0) { TaskActionForm taskAction = new TaskActionForm(); // taskAction.SqlDbConnString = m_Cfg.DbConnectionString; List <object[]> res = DataBase.SelectQuery("select * from users;", m_Cfg.DbConnectionString); if (res.Count > 0) { List <UserInfo> usr_lst = new List <UserInfo>(); for (int i = 0; i < res.Count; i++) { usr_lst.Add(new UserInfo((int)res[i][0], (string)res[i][1])); } taskAction.UserList = usr_lst; taskAction.TaskInfo = (TaskInfo)task_listView.SelectedItems[0].Tag; DialogResult dr = taskAction.ShowDialog(); if (dr == DialogResult.OK) { DataBase.UpdateTaskQuery(taskAction.TaskInfo, m_Cfg.DbConnectionString); refresh_btn_Click(null, null); } } } }