private void btnAddProducator_Click(object sender, EventArgs e)
        {
            if (txtProducator.Text.Length >= 3 && txtWebsite.Text.Length > 5 && isNumber(txtTelefon.Text))
            {
                if (db.PRODUCATORs.Any(x => x.PRODUCATOR_ID == objId))
                {
                    var prod = db.PRODUCATORs.First <PRODUCATOR>();
                    prod.NUME_PRODUCATOR = txtProducator.Text;
                    prod.TELEFON         = int.Parse(txtTelefon.Text);
                    prod.WEBSITE         = txtWebsite.Text;
                    db.SaveChanges();
                }
                else
                {
                    var producator = new PRODUCATOR()
                    {
                        NUME_PRODUCATOR = txtProducator.Text, WEBSITE = txtWebsite.Text, TELEFON = int.Parse(txtTelefon.Text)
                    };
                    db.PRODUCATORs.Add(producator);
                    db.SaveChanges();
                }
            }
            else
            {
                MessageBox.Show("Introdu datele corect!");
            }

            this.Close();
        }
 public adaugaProducator(PRODUCATOR obj)
 {
     InitializeComponent();
     db = new Entities();
     if (obj == null)
     {
     }
     else
     {
         objId = obj.PRODUCATOR_ID;
         txtProducator.Text = obj.NUME_PRODUCATOR;
         txtTelefon.Text    = obj.TELEFON.ToString();
         txtWebsite.Text    = obj.WEBSITE;
     }
 }