private void butOK_Click(object sender, System.EventArgs e) { if (textDunMessage.Text == "" && textMessageBold.Text == "" && textEmailSubject.Text == "" && textEmailBody.Text == "") { MsgBox.Show(this, "All messages cannot be blank."); return; } if (listBillType.SelectedIndex == 0) { DunningCur.BillingType = 0; } else { DunningCur.BillingType = DefC.Short[(int)DefCat.BillingTypes][listBillType.SelectedIndex - 1].DefNum; } if (radioAny.Checked) { DunningCur.AgeAccount = 0; } else if (radio30.Checked) { DunningCur.AgeAccount = 30; } else if (radio60.Checked) { DunningCur.AgeAccount = 60; } else if (radio90.Checked) { DunningCur.AgeAccount = 90; } if (radioU.Checked) { DunningCur.InsIsPending = YN.Unknown; } else if (radioY.Checked) { DunningCur.InsIsPending = YN.Yes; } else if (radioN.Checked) { DunningCur.InsIsPending = YN.No; } DunningCur.DunMessage = textDunMessage.Text; DunningCur.MessageBold = textMessageBold.Text; DunningCur.EmailBody = textEmailBody.Text; DunningCur.EmailSubject = textEmailSubject.Text; if (IsNew) { Dunnings.Insert(DunningCur); } else { Dunnings.Update(DunningCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textDaysInAdvance.errorProvider1.GetError(textDaysInAdvance) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDunMessage.Text == "" && textMessageBold.Text == "" && textEmailSubject.Text == "" && textEmailBody.Text == "") { MsgBox.Show(this, "All messages cannot be blank."); return; } _dunningCur.BillingType = 0; if (listBillType.SelectedIndex > 0) { _dunningCur.BillingType = _listBillingTypeDefs[listBillType.SelectedIndex - 1].DefNum; } _dunningCur.AgeAccount = (byte)(30 * new List <RadioButton> { radioAny, radio30, radio60, radio90 }.FindIndex(x => x.Checked)); //0, 30, 60, or 90 _dunningCur.InsIsPending = (YN) new List <RadioButton> { radioU, radioY, radioN }.FindIndex(x => x.Checked); //0=Unknown, 1=Yes, 2=No _dunningCur.DaysInAdvance = 0; //default will be 0 if (!radioAny.Checked) { _dunningCur.DaysInAdvance = PIn.Int(textDaysInAdvance.Text); //blank=0 } _dunningCur.DunMessage = textDunMessage.Text; _dunningCur.MessageBold = textMessageBold.Text; _dunningCur.EmailBody = textEmailBody.Text; _dunningCur.EmailSubject = textEmailSubject.Text; _dunningCur.IsSuperFamily = checkSuperFamily.Checked; if (PrefC.HasClinicsEnabled) { _dunningCur.ClinicNum = _listClinics[comboClinics.SelectedIndex].ClinicNum; } if (IsNew) { Dunnings.Insert(_dunningCur); } else { Dunnings.Update(_dunningCur); } DialogResult = DialogResult.OK; }