Пример #1
0
 private void bindingSourceEmp_CurrentItemChanged(object sender, EventArgs e)
 {
     if (bindingSourceEmp.Current != null)
     {
         _RecordedEmploye        = (BO_Employe)bindingSourceEmp.Current;
         textBox1.Text           = _RecordedDept.Dname;
         textBox2.Text           = _RecordedEmploye.Nom;
         textBox3.Text           = _RecordedEmploye.Job;
         textBox4.Text           = _RecordedEmploye.Salaire.ToString();
         textBox2.Enabled        = true;
         buttonUpdateEmp.Enabled = true;
     }
     else
     {
         _RecordedEmploye        = null;
         textBox1.Text           = string.Empty;
         textBox2.Text           = string.Empty;
         textBox3.Text           = string.Empty;
         textBox4.Text           = string.Empty;
         textBox2.Enabled        = false;
         buttonUpdateEmp.Enabled = false;
         if (bindingSourceDept.Current != null)
         {
             textBox1.Text = _RecordedDept.Dname;
         }
     }
 }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            label4.Text      = string.Empty;
            _RecordedDept    = new BO_Departement();
            _RecordedEmploye = new BO_Employe();

            this.FillingComboBox();
            if (bindingSourceDept.Current != null)
            {
                _RecordedDept = (BO_Departement)bindingSourceDept.Current;
            }
            this.FillingDataGridView(_RecordedDept.Deptno);
        }
Пример #3
0
        public static int UpdateEmp(BO_Employe newEmploye)
        {
            int         retour  = 0;
            RestRequest request = new RestRequest("UpdateEmp", Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(newEmploye);
            IRestResponse <int> response = Client.Execute <int>(request);

            if (response.ResponseStatus == ResponseStatus.Completed)
            {
                retour = response.Data;
            }
            return(retour);
        }
Пример #4
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);
                }
            }
        }