private void butOK_Click(object sender, EventArgs e) { if (textDescript.Text.Trim() == "") { MsgBox.Show(this, "Please enter a description."); return; } if (_feeSchedCur == null) { MsgBox.Show(this, "Please select a fee schedule."); return; } if (comboBoxAdjType.SelectedIndex == -1) { MsgBox.Show(this, "Please select an adjustment type.\r\nYou may need to create discount plan adjustment types within definition setup."); return; } DiscountPlanCur.Description = textDescript.Text; DiscountPlanCur.FeeSchedNum = _feeSchedCur.FeeSchedNum; DiscountPlanCur.DefNum = _listAdjTypeDefs[comboBoxAdjType.SelectedIndex].DefNum; DiscountPlanCur.IsHidden = checkHidden.Checked; if (DiscountPlanCur.IsNew) { DiscountPlans.Insert(DiscountPlanCur); } else { DiscountPlans.Update(DiscountPlanCur); } DialogResult = DialogResult.OK; }
///<summary></summary> public static DiscountPlan CreateDiscountPlan(string description, long defNum = 0, long feeSchedNum = 0, bool isHidden = false) { DiscountPlan discountPlan = new DiscountPlan() { Description = description, DefNum = defNum, FeeSchedNum = feeSchedNum, IsHidden = isHidden, }; DiscountPlans.Insert(discountPlan); return(discountPlan); }