private void listViewEmployee_Click(object sender, EventArgs e) { if (listViewEmployee.SelectedItems.Count != 0) { UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), listViewEmployee.SelectedItems[0].Index); } }
private void Form1_Load(object sender, EventArgs e) { List <CDepartment> Departments = CSQL.GetDepartments(); SetNodes(treeView1, Departments, CBranch.GetDepartmentsByParentDepartmentID(Departments, "").ToList()[0] as CDepartment); treeView1.SelectedNode = treeView1.Nodes[0]; UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), 0); }
private void ButtonUpdDept_Click(object sender, EventArgs e) { CSQL.UpdateDeptIDInEmployee(EMPOLOYEE); treeView1.NodeMouseClick -= treeView1_NodeMouseDeptToEmp_Click; treeView1.NodeMouseClick += treeView1_NodeMouseClick; Button bn = this.Controls.Find("UpdDept", true).FirstOrDefault() as Button; splitContainer1.Panel2.Enabled = true; UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), listViewEmployee.SelectedItems[0].Index); bn.Dispose(); }
private void buttonInsEmp_Click(object sender, EventArgs e) { if (listViewEmployee.SelectedItems.Count != 0) { CSQL.InsertIntoEmployee(GetDateFromEditors()); UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), listViewEmployee.SelectedItems[0].Index); } else { MessageBox.Show("Нет данных для обновленя"); } }
private void buttonUpbEmp_Click(object sender, EventArgs e) { if (GetDateFromEditors().ID != "") { try { CSQL.UpdateEmployee(GetDateFromEditors()); UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), listViewEmployee.SelectedItems[0].Index); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Нет данных для сохранения"); } }
private void ButtonDelEmp_Click(object sender, EventArgs e) { if (listViewEmployee.SelectedItems.Count != 0) { if (MessageBox.Show("Вы уверены, что хотите удалить выбранного сотрудника?", "Удаление", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { CSQL.DeleteFromEmployee(GetDateFromEditors()); UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), listViewEmployee.SelectedItems[0].Index); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } else { MessageBox.Show("Нет данных для удаления"); } }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { treeView1.SelectedNode = e.Node; UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), 0); }