private void FormApptViewEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) { ApptViewItems.DeleteAllForView(ApptViewCur); ApptViews.Delete(ApptViewCur); } }
private void butDelete_Click(object sender, System.EventArgs e) { //this does mess up the item orders a little, but missing numbers don't actually hurt anything. if (MessageBox.Show(Lan.g(this, "Delete this category?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } ApptViewItems.DeleteAllForView(ApptViewCur); ApptViews.Delete(ApptViewCur); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (listOps.SelectedIndices.Count == 0 || listProv.SelectedIndices.Count == 0) { MessageBox.Show(Lan.g(this, "At least one operatory and one provider must be selected.")); return; } if (textDescription.Text == "") { MessageBox.Show(Lan.g(this, "A description must be entered.")); return; } if (displayedElements.Count == 0) { MessageBox.Show(Lan.g(this, "At least one row type must be displayed.")); return; } ApptViewItems.DeleteAllForView(ApptViewCur); //start with a clean slate for (int i = 0; i < Operatories.ListShort.Length; i++) { if (listOps.SelectedIndices.Contains(i)) { ApptViewItem ApptViewItemCur = new ApptViewItem(); ApptViewItemCur.ApptViewNum = ApptViewCur.ApptViewNum; ApptViewItemCur.OpNum = Operatories.ListShort[i].OperatoryNum; ApptViewItems.Insert(ApptViewItemCur); } } for (int i = 0; i < Providers.List.Length; i++) { if (listProv.SelectedIndices.Contains(i)) { ApptViewItem ApptViewItemCur = new ApptViewItem(); ApptViewItemCur.ApptViewNum = ApptViewCur.ApptViewNum; ApptViewItemCur.ProvNum = Providers.List[i].ProvNum; ApptViewItems.Insert(ApptViewItemCur); } } for (int i = 0; i < displayedElements.Count; i++) { ApptViewItem ApptViewItemCur = (ApptViewItem)displayedElements[i]; ApptViewItemCur.ApptViewNum = ApptViewCur.ApptViewNum; //elementDesc and elementColor already handled. ApptViewItemCur.ElementOrder = i; ApptViewItems.Insert(ApptViewItemCur); } ApptViewCur.Description = textDescription.Text; ApptViewCur.RowsPerIncr = PIn.PInt(textRowsPerIncr.Text); ApptViews.Update(ApptViewCur); //same whether isnew or not DialogResult = DialogResult.OK; }