Exemplo n.º 1
0
 private void Form3_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.Enabled             = true;
     dataGridView1.DataSource = _dbM.employeesSelectAll();
     state = StateOfDataGrid.Employees;
     _company.Update();
 }
Exemplo n.º 2
0
 private void DataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (state == StateOfDataGrid.Departments)
         {
             string search = dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString();
             dataGridView1.DataSource = _dbM.employeesSelect(search);
             state = StateOfDataGrid.Employees;
         }
         else if (state == StateOfDataGrid.StructureOfCompany)
         {
             string search = dataGridView1.SelectedCells[0].OwningRow.Cells[1].Value.ToString();
             dataGridView1.DataSource = _dbM.employeesSelect(search);
             state = StateOfDataGrid.Employees;
         }
         else if (state == StateOfDataGrid.Employees)
         {
             int      id  = Convert.ToInt32(dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString());
             Employee emp = _company._employees.Find(x => x.ID == id);
             OpenFormEmployee(emp);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 3
0
 private void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = _company._departmentsTable;
         state = StateOfDataGrid.Departments;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 private void Button4_Click(object sender, EventArgs e)
 {
     try
     {
         dataGridView1.DataSource = _dbM.StructureOfCompany();
         state = StateOfDataGrid.StructureOfCompany;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
 private void Form2_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.Enabled = true;
     if (DatabaseManipulations._connect != null && DatabaseManipulations._connect.Connection)
     {
         _company = new Company();
         dataGridView1.DataSource = _company._departmentsTable;
         List <string> deps = new List <string>();
         _dbM = new DatabaseManipulations();
         DataTable departs = _dbM.StructureOfCompany();
         deps.Add("Все департаменты");
         foreach (DataRow row in departs.Rows)
         {
             string dep = (row[0].ToString() + "," + row[1].ToString()).Trim('_', ' ');
             deps.Add(dep);
         }
         comboBox1.DataSource = deps;
         state = StateOfDataGrid.Departments;
         SetActiveButton(true);
     }
 }
Exemplo n.º 6
0
        private void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable emps;
                if (comboBox1.SelectedItem.ToString() == "Все департаменты")
                {
                    emps = _dbM.employeesSelectAll();
                }
                else
                {
                    string search = comboBox1.SelectedItem.ToString().Trim('_', ' ').Split(',')[1];
                    emps = _dbM.employeesSelect(search);
                }
                state = StateOfDataGrid.Employees;

                dataGridView1.DataSource = emps;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }