Ejemplo n.º 1
0
 private void FillingComboBox()
 {
     bindingSourceDept.DataSource = BLL_OAI.GetAllDept();
     comboBoxDept.DataSource      = bindingSourceDept;
     comboBoxDept.ValueMember     = "Deptno";
     comboBoxDept.DisplayMember   = "Dname";
 }
Ejemplo n.º 2
0
        private void FillingDataGridView(int deptno)
        {
            List <BO_Employe> employes;
            string            titre = string.Empty;

            if (deptno != 0)
            {
                employes = BLL_OAI.GetEmpByDeptno(deptno);
                titre    = BLL_OAI.GetDeptByDeptno(deptno).Dname;
            }
            else
            {
                employes = BLL_OAI.GetAllEmp();
                titre    = "TOUS";
            }
            label2.Text = titre;
            employes.Sort();
            bindingSourceEmp.DataSource = employes;
            dataGridViewEmp.DataSource  = bindingSourceEmp;
            this.ModelingByDataGridView();
        }
Ejemplo n.º 3
0
        private void buttonUpdateEmp_Click(object sender, EventArgs e)
        {
            if (bindingSourceEmp.Current != null)
            {
                _RecordedEmploye = (BO_Employe)bindingSourceEmp.Current;
                string oldName  = _RecordedEmploye.Nom;
                string newName  = textBox2.Text.ToUpper();
                int    resultat = 0;
                _RecordedEmploye.Nom = newName;

                string message = $"{oldName} => {newName}";

                DialogResult dialogResult = MessageBox.Show(message, "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                if (dialogResult == DialogResult.Yes)
                {
                    resultat = BLL_OAI.UpdateEmp(_RecordedEmploye);
                }

                if (resultat != 0)
                {
                    this.FillingDataGridView(_RecordedDept.Deptno);
                }
            }
        }