private void btn_save__Click(object sender, EventArgs e) { Recopie_(); if (current_.Control()) { if (!current_.Update) { Marque f = MarqueBLL.Save(current_); if (f != null ? f.Id > 0 : false) { current_.Id = f.Id; current_.Update = true; AddRow_(f); Messages.Succes(); } } else { if (MarqueBLL.Update(current_)) { UpdateRow_(current_); Messages.Succes(); } } Reset_(); } }
private void btn_save_Click(object sender, EventArgs e) { Marque f = new Marque(); f.Reference = txt_reference.Text.Trim(); f.Designation = txt_designation.Text.Trim(); if (f.Control()) { f = MarqueBLL.Save(f); if (f != null ? f.Id > 0 : false) { current.marques.Add(f); if (current.current != null ? current.current.Id > 0 : false) { current.current.Marque = f; } current.com_marque.Refresh(); current.com_marque.DisplayMember = "Designation"; current.com_marque.ValueMember = "Id"; current.com_marque.DataSource = new BindingSource(current.marques, null); current.com_marque.Text = f.Designation; current.com_marque.AutoCompleteCustomSource.Add(f.Designation); this.Close(); } } }