private void salveazaBtt_Click(object sender, EventArgs e) { tabele.Furnizor req = new tabele.Furnizor(); try { req.NumeFurnizor = NumeFurnizorTxt.Text.ToString(); req.CodFurnizor = CodFurnizorTxt.Text.ToString(); req.AdresaSediuSocial = AdresaSediuSocialTxt.Text.ToString(); req.AdresaDeLivrare = AdresaDeLivrareTxt.Text.ToString(); req.PersoanaDeContact = PersoanaDeContactTxt.Text.ToString(); req.Email = EmailTxtFurnizor.Text.ToString(); if (req.NumeFurnizor.Length * req.CodFurnizor.Length * req.AdresaSediuSocial.Length * req.AdresaDeLivrare.Length * req.PersoanaDeContact.Length * req.Email.Length == 0) { throw new ArgumentException("Camp necompletat!"); } else if (!IsValidEmail(req.Email)) { throw new ArgumentException("Email invalid!"); } else { metodeTabele.metodele add = new metodeTabele.metodele(); add.adaugaFurnizor(req); MessageBox.Show("Operatiune efectuata cu succes."); } } catch (Exception err) { MessageBox.Show(err.Message); } }
public void AutoPopulate(tabele.Furnizor furnizor) { NumeFurnizorTxt.Text = furnizor.NumeFurnizor.ToString(); CodFurnizorTxt.Text = furnizor.CodFurnizor.ToString(); AdresaSediuSocialTxt.Text = furnizor.AdresaSediuSocial.ToString(); AdresaDeLivrareTxt.Text = furnizor.AdresaDeLivrare.ToString(); PersoanaDeContactTxt.Text = furnizor.PersoanaDeContact.ToString(); EmailTxtFurnizor.Text = furnizor.Email.ToString(); // AlteDetaliiTextEdit.Text = furnizor.AlteDetalii.ToString(); return; }
public void searcF() { foreach (Control ctrl in mainContainer.Controls) { ctrl.Dispose(); } mainContainer.Controls.Add(new formFurnizor()); tabele.Furnizor x = new tabele.Furnizor(); metodeTabele.metodele str = new metodeTabele.metodele(); x = str.readFurnizor(cautaToken.Text.ToString()); MessageBox.Show(x.CodFurnizor.ToString()); }
private void modificaBtt_Click(object sender, EventArgs e) { tabele.Furnizor model = new tabele.Furnizor(); metodeTabele.metodele update = new metodeTabele.metodele(); model.NumeFurnizor = NumeFurnizorTxt.Text.ToString(); model.CodFurnizor = CodFurnizorTxt.Text.ToString(); model.AdresaSediuSocial = AdresaSediuSocialTxt.Text.ToString(); model.AdresaDeLivrare = AdresaDeLivrareTxt.Text.ToString(); model.PersoanaDeContact = PersoanaDeContactTxt.Text.ToString(); model.Email = EmailTxtFurnizor.Text.ToString(); update.modificaFurnizor(model); return; }
private void button1_Click(object sender, EventArgs e) { switch (dbToken.Text.ToString()) { case "Furnizor": String Nume = cautaToken.Text.ToString(); tabele.Furnizor fur = new tabele.Furnizor(); metodeTabele.metodele met = new metodeTabele.metodele(); fur = met.readFurnizor(Nume); MessageBox.Show(fur.CodFurnizor.ToString()); foreach (Control ctrl in mainContainer.Controls) { ctrl.Dispose(); } formFurnizor k = new formFurnizor(); mainContainer.Controls.Add(k); k.AutoPopulate(fur); break; case "Produs": searcP(); break; case "Client": searcC(); break; case "Utilizator": searcU(); break; } }