Ejemplo n.º 1
0
 private void listViewEmployee_Click(object sender, EventArgs e)
 {
     if (listViewEmployee.SelectedItems.Count != 0)
     {
         UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), listViewEmployee.SelectedItems[0].Index);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
 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("Нет данных для обновленя");
     }
 }
Ejemplo n.º 5
0
 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("Нет данных для сохранения");
     }
 }
Ejemplo n.º 6
0
        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("Нет данных для удаления");
            }
        }
Ejemplo n.º 7
0
 private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     treeView1.SelectedNode = e.Node;
     UpdListEmployee(CSQL.GetEmployeesByDepartmentID(treeView1.SelectedNode.Tag.ToString()), 0);
 }