private void gridCustomerQuotes_TitleAddClick(object sender, EventArgs e) { FormJobQuoteEdit FormJQE = new FormJobQuoteEdit(new JobQuote() { IsNew = true }); FormJQE.ShowDialog(); if (FormJQE.DialogResult != DialogResult.OK || FormJQE.JobQuoteCur == null) { return; } _listJobQuotes.Add(FormJQE.JobQuoteCur); FillGridQuotes(); }
private void gridQuotes_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (!(gridQuotes.Rows[e.Row].Tag is JobQuote)) { return; //should never happen } JobQuote jq = (JobQuote)gridQuotes.Rows[e.Row].Tag; FormJobQuoteEdit FormJQE = new FormJobQuoteEdit(jq); FormJQE.ShowDialog(); if (FormJQE.DialogResult != DialogResult.OK) { return; } _listJobQuotes.RemoveAll(x => x.JobQuoteNum == jq.JobQuoteNum); //should remove only one if (FormJQE.JobQuoteCur != null) //re-add altered version, iff the jobquote was modified. { _listJobQuotes.Add(FormJQE.JobQuoteCur); } FillGridQuotes(); }