private void btnConfirma_Click(object sender, EventArgs e) { Enum.TryParse(cbTip.Text, out TipActivitate tip); _instance.Denumire = cbDomenii.Text; _instance.tip = tip; _instance.SetTitluProiect(tbTitlu.Text); _instance.SetLocatie(tbLocatie.Text); _instance.dataIncepere = dtpInceput.Value; _instance.dataIncheiere = dtpIncheiere.Value; _instance.Prioritate = cbPrioritate.Text; try { int progres = int.Parse(tbProgres.Text); _instance.SetProgres(progres); } catch (CustomException ex) { MessageBox.Show(ex.ToString()); } this.Close(); }
private void btnConfirma_Click(object sender, EventArgs e) { bool isDifferent = true; CustomException ex = new CustomException(); if (_instance.Denumire == cbDomenii.Text) { isDifferent = false; } Enum.TryParse(cbTip.Text, out TipActivitate tip); if (_instance.tip == tip && isDifferent) { isDifferent = false; } if (_instance.GetTitluProiect() == tbTitlu.Text && isDifferent) { isDifferent = false; } if (_instance.GetLocatie() == tbLocatie.Text && isDifferent) { isDifferent = false; } if (_instance.dataIncepere == dtpInceput.Value && isDifferent) { isDifferent = false; } if (_instance.dataIncheiere == dtpIncheiere.Value && isDifferent) { isDifferent = false; } if (_instance.Prioritate == cbPrioritate.Text && isDifferent) { isDifferent = false; } if (_instance.GetProgres() == int.Parse(tbProgres.Text) && isDifferent) { isDifferent = false; } if (isDifferent == true) { _instance.Denumire = cbDomenii.Text; _instance.tip = tip; _instance.SetTitluProiect(tbTitlu.Text); _instance.SetLocatie(tbLocatie.Text); _instance.dataIncepere = dtpInceput.Value; _instance.dataIncheiere = dtpIncheiere.Value; _instance.Prioritate = cbPrioritate.Text; _instance.SetProgres(int.Parse(tbProgres.Text)); } else { MessageBox.Show(ex.Message); } this.Close(); }