private void addButton_Click(object sender, EventArgs e) { if (addMensSeats.EditValue == null && addWomensSeats.EditValue == null) { Dialog.ShowError("Please reserve at least one seat"); return; } var row = new MelaveMalkaSeat { DateAdded = DateTime.Now, Year = year, Person = personSelector.SelectedPerson, MensSeats = addMensSeats.EditValue == null ? new int?() : (int)addMensSeats.Value, WomensSeats = addWomensSeats.EditValue == null ? new int?() : (int)addWomensSeats.Value }; Program.Table <MelaveMalkaSeat>().Rows.Add(row); var totalSeats = (row.MensSeats ?? 0) + (row.WomensSeats ?? 0); if (totalSeats == 1) { InfoMessage.Show(MdiParent, "One seat has been reserved for " + row.Person.VeryFullName); } else { InfoMessage.Show(MdiParent, totalSeats + " seats have been reserved for " + row.Person.VeryFullName); } addPanel.Hide(); personSelector.EditValue = null; }
private void commit_Click(object sender, EventArgs e) { if (!commit.Visible) { Debug.Assert(false, "How was commit clicked?"); return; } var payment = CurrentPayment; if (payment == null) { XtraMessageBox.Show("Something's wrong."); return; } if (!ValidateCreation()) { return; } try { paymentsBindingSource.EndEdit(); } catch (Exception ex) { XtraMessageBox.Show("Couldn't add payment.\r\n" + ex.Message, "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (commit.CommitType == CommitType.Create) { Program.Table <PledgeLink>().Rows.AddRange(pledgeLinks.Links); pledgeLinks.Links.Clear(); InfoMessage.Show(String.Format(CultureInfo.CurrentCulture, "A {0:c} payment has been added for {1}", payment.Amount, payment.Person.FullName)); AddNew(); } }
private void personSelector_EditValueChanged(object sender, EventArgs e) { if (personSelector.SelectedPerson == null) { return; } if (year != MelaveMalkaInfo.CurrentYear && !Dialog.Warn("You're trying to invite someone to the " + year + " Melave Malka.\nAre you sure you want to do that?")) { personSelector.SelectedPerson = null; return; } if (String.IsNullOrWhiteSpace(source.Text)) { Dialog.ShowError("Please select a source"); personSelector.SelectedPerson = null; return; } Program.Table <MelaveMalkaInvitation>().Rows.Add(new MelaveMalkaInvitation { Person = personSelector.SelectedPerson, DateAdded = DateTime.Now, Year = year, Source = source.Text }); InfoMessage.Show(MdiParent, personSelector.SelectedPerson.VeryFullName + " are now invited by the " + source.Text); personSelector.SelectedPerson = null; DefaultSource = source.Text; }
public ImportForm(ViewModel viewModel) { InitializeComponent(); this.viewModel = viewModel; // Don't reset focused row when list changes. We bind FocusedRow ourselves. peopleView.DataController.AllowCurrentControllerRow = false; viewModelBindingSource.DataSource = viewModel; viewModel.PropertyChanged += ViewModel_PropertyChanged; startDate.EditValue = DateTime.Today.AddDays(-14); personSelector.Properties.NewPersonTemplate = e => Genderizer.Create().SetFirstName(viewModel.CurrentPayment.FirstName, new Person { Address = viewModel.CurrentPayment.Address, City = viewModel.CurrentPayment.City, FullName = viewModel.CurrentPayment.FirstName + " " + viewModel.CurrentPayment.LastName, LastName = viewModel.CurrentPayment.LastName, Phone = viewModel.CurrentPayment.Phone, Source = "Credit Card Import", State = viewModel.CurrentPayment.State, Zip = viewModel.CurrentPayment.Zip }); viewModel.ImportCallback = (info, payment, pledge) => { var pledgeMessage = pledge == null ? "" : $"and {pledge.Type} pledge "; InfoMessage.Show($"A {payment.Amount:C} payment {pledgeMessage}has been imported to {payment.Person.FullName}."); }; }
async void OnCopyCommandExecute(object obj) { IsBudgetItemCopyPanelShow = false; IsCopyProcess = true; var result = await UIMessager.Services.Execeptions.ExceptionНandling.HandleBaseActionAsync <bool>(CopyBudgetItemAsync, UIMessager.Services.Message.MsgError.BaseType.Copying); IsCopyProcess = false; if (result.IsSuccess) { InfoMessage.Show(global::Resources.Properties.Resources.mOkCoping, null); _OnSuccessCoping?.Invoke(CurrentShipOwner); } }
private void sendPreview_ItemClick(object sender, ItemClickEventArgs e) { if (String.IsNullOrWhiteSpace(previewAddressItem.EditValue as string)) { Dialog.ShowError("Please enter a preview address"); return; } Email.Hosted.Send( from: Email.JournalAddress, to: new MailAddress(previewAddressItem.EditValue.ToString(), "Preview: " + Environment.UserName), subject: SelectedInvitee.EmailSubject, body: SelectedInvitee.EmailSource, html: true ); InfoMessage.Show("Sent preview to " + previewAddressItem.EditValue); }
void AddTicket() { var idDup = tickets.Rows.FirstOrDefault(t => t.TicketId == ticketId.Value); if (idDup != null) { if (DialogResult.No == XtraMessageBox.Show( "Ticket #" + ticketId.Value + " was already given to " + idDup.Person.VeryFullName + ".\r\nAre you sure you want to add a duplicate ticket?", Dialog.DefaultTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2 )) { return; } } if (personSelector.SelectedPerson == null) { return; } Program.Table <RaffleTicket>().Rows.Add(lastTicket = new RaffleTicket { Year = year, Person = personSelector.SelectedPerson, TicketId = (int)ticketId.Value, Paid = isPaid.Checked, Comments = String.IsNullOrWhiteSpace(comments.Text) ? null : comments.Text, DateAdded = DateTime.Now }); InfoMessage.Show("Ticket #" + ticketId.Value + " was registered for " + personSelector.SelectedPerson.VeryFullName + ", " + (isPaid.Checked ? "paid" : "unpaid")); if (ModifierKeys == Keys.Shift) { ticketId.Value = NextID; ticketId.Focus(); } else { personSelector.SelectedPerson = null; //The EditValueChanged handler will reset other fields personSelector.Focus(); } }
private void commit_Click(object sender, EventArgs e) { if (!commit.Visible) { Debug.Assert(false, "How was commit clicked?"); return; } var pledge = CurrentPledge; if (pledge == null) { XtraMessageBox.Show("Something's wrong."); return; } if (person.SelectedPerson == null) { XtraMessageBox.Show("Please select the person who made the pledge.", "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!(amount.EditValue is decimal)) { XtraMessageBox.Show("Amount cannot be negative", "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { pledgesBindingSource.EndEdit(); } catch (Exception ex) { XtraMessageBox.Show("Couldn't add pledge.\r\n" + ex.Message, "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (commit.CommitType == CommitType.Create) { InfoMessage.Show("A " + pledge.Amount.ToString("c", CultureInfo.CurrentCulture) + " " + pledge.Type + " pledge has been added for " + pledge.Person.FullName); AddNew(); date.EditValue = pledge.Date; } }
private void addCaller_EditValueChanged(object sender, EventArgs e) { var person = addCaller.EditValue as Person; if (person == null) { return; } addCaller.EditValue = null; if (person.Callers.Any(c => c.Year == year)) { Dialog.ShowError(person.FullName + " is already a caller for the " + year + " Melave Malka"); return; } Program.Table <Caller>().Rows.Add(new Caller { Person = person, Year = year, DateAdded = DateTime.Now, }); InfoMessage.Show(person.FullName + " has been added as a caller for the " + year + " Melave Malka"); }
private void add_Click(object sender, EventArgs e) { #region Validation if (amount.Value <= 0) { XtraMessageBox.Show("Please select an amount to bill.", "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (paymentMethod.SelectedIndex < 0) { XtraMessageBox.Show("Please select a payment method.", "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (paymentMethod.Text == "Check") { if (!(checkDate.EditValue is DateTime)) { XtraMessageBox.Show("Please enter the date on the check.", "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!String.IsNullOrWhiteSpace(checkNumber.Text)) { Payment duplicate = personSelector.SelectedPerson.Payments .FirstOrDefault(p => String.Equals(p.CheckNumber, checkNumber.Text, StringComparison.CurrentCultureIgnoreCase)); if (duplicate != null && !Dialog.Warn(String.Format(CultureInfo.CurrentCulture, "{0} #{1} for {2} has already been entered ({3:d}, {4:c}).\r\nIs that correct?", duplicate.Method, duplicate.CheckNumber, duplicate.Person.FullName, duplicate.Date, duplicate.Amount))) { return; } } } #endregion var actualComments = String.IsNullOrWhiteSpace(this.comments.Text) ? null : this.comments.Text; Pledge pledge = new Pledge { Person = personSelector.SelectedPerson, Date = DateTime.Now, Type = PledgeType, SubType = "", Account = Account, Amount = amount.Value, Comments = actualComments }; Program.Table <Pledge>().Rows.Add(pledge); string messagePrefix = personSelector.SelectedPerson.FullName + " have been added to the Shalach Manos list with a " + amount.Value.ToString("c0", CultureInfo.CurrentCulture); Payment payment = null; switch (paymentMethod.Text) { case "Unpaid": InfoMessage.Show(messagePrefix + " unpaid pledge."); break; case "Cash": Program.Table <Payment>().Rows.Add(payment = new Payment { Person = personSelector.SelectedPerson, Date = DateTime.Now, Method = paymentMethod.Text, Account = Account, Amount = amount.Value, Comments = actualComments }); InfoMessage.Show(messagePrefix + " cash payment."); break; case "Check": Program.Table <Payment>().Rows.Add(payment = new Payment { Person = personSelector.SelectedPerson, Date = checkDate.DateTime, Method = paymentMethod.Text, CheckNumber = checkNumber.Text, Account = Account, Amount = amount.Value, Comments = actualComments }); InfoMessage.Show(messagePrefix + " check."); break; } if (payment != null) { Program.Table <PledgeLink>().Rows.Add(new PledgeLink { Amount = amount.Value, Payment = payment, Pledge = pledge }); } personSelector.SelectedPerson = null; personSelector.Focus(); }