示例#1
0
 private void removeAngajatButton_Click(object sender, EventArgs e)
 {
     try
     {
         Angajat angajat = (Angajat)angajatiDataGriedView.SelectedRows[0].DataBoundItem;
         _controller.deleteAngajat(angajat);
         errorLabel.Text = "";
     }
     catch (ValidationException ex)
     {
         errorLabel.Text = ex.Message;
     }
 }
        private void dataGridProduct_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridProduct.CurrentRow.Index != -1)
            {
                angajat.Id = Convert.ToInt32(dataGridProduct.CurrentRow.Cells["Id"].Value);


                angajat          = Datab.Angajats.Where(x => x.Id == angajat.Id).FirstOrDefault();
                txt_nume.Text    = angajat.Name;
                txt_an.Text      = angajat.An.ToString();
                txt_adresa.Text  = angajat.Adresa;
                txt_vanzari.Text = angajat.Vanzari.ToString();
                //comboBox.Text = products.CategoryId.ToString();


                btn_save.Text      = "Update";
                btn_delete.Enabled = true;
            }
        }
示例#3
0
 private void updateAngajatButton_Click(object sender, EventArgs e)
 {
     try
     {
         int    angajatID;
         string numeAngajat;
         string functie;
         int    salariu;
         try
         {
             angajatID   = Int32.Parse(angajatIdTextField.Text);
             numeAngajat = numeAngajatTextBox.Text;
             functie     = functieTextBox.Text;
             salariu     = Int32.Parse(salariuTextBox.Text);
         }
         catch (ArgumentNullException ex1)
         {
             errorLabel.Text = "unul din fielduri e gol";
             return;
         }
         catch (FormatException ex)
         {
             errorLabel.Text = "unul din fielduri e invalid";
             return;
         }
         Angajat angajat = new Angajat()
         {
             functie = functie,
             Nume    = numeAngajat,
             Salariu = salariu,
             ID      = angajatID
         };
         _controller.updateAngajat(angajat);
         errorLabel.Text = "";
     }
     catch (ValidationException ex)
     {
         errorLabel.Text = ex.Message;
     }
 }