コード例 #1
0
        public PledgeEditPopup(Pledge pledge)
        {
            InitializeComponent();
            ClientSize = pledgeEdit.Size;

            pledgeEdit.CurrentPledge = this.pledge = pledge;
            Program.Table<Pledge>().RowRemoved += PledgeEditPopup_RowRemoved;
        }
コード例 #2
0
ファイル: AdPane.cs プロジェクト: ShomreiTorah/Journal
        private void pledgeAdder_EditValueChanged(object sender, EventArgs e)
        {
            if (pledgeAdder.SelectedPerson == null) return;

            if (!journal.ConfirmModification())
                return;

            var pledge = ad.Row.CreatePledge();
            pledge.Person = pledgeAdder.SelectedPerson;
            pledge.Amount = ad.AdType.DefaultPrice;

            pledgeAdder.SelectedPerson = null;

            var newPledges = new Pledge[pledges.Rows.Count + 1];
            pledges.Rows.CopyTo(newPledges, 0);
            newPledges[pledges.Rows.Count] = pledge;
            if (!CheckAdjustPledges("Add Pledge", newPledges: newPledges))
                return;

            Program.Table<Pledge>().Rows.Add(pledge);
        }
コード例 #3
0
ファイル: AuctionItem.cs プロジェクト: ShomreiTorah/Billing
 ///<summary>Updates this instance's values after a change in a corresponding pledge.</summary>
 ///<param name="existingPledge">The pledge to update from, or null to null out this pledge.</param>
 public void UpdateFromPledge(Pledge existingPledge)
 {
     if (existingPledge != null) {
         Amount = existingPledge.Amount;
         Note = existingPledge.Note;
     } else
         Note = null;
 }
コード例 #4
0
            public void DoImport()
            {
                var pledge = new Pledge {
                    Person = Person,
                    Date = Date,
                    Type = Type,
                    SubType = SubType,
                    Note = Note,
                    Account = Account,
                    Amount = Amount,
                    Comments = Comments
                };
                Program.Table<Pledge>().Rows.Add(pledge);
                pledge.Modifier = Modifier;

                if (AmountPaid != 0) {
                    var payment = new Payment {
                        Person = Person,
                        Date = Date,
                        Method = PaymentMethod,
                        CheckNumber = CheckNumber,
                        Account = Account,
                        Amount = AmountPaid,
                        Comments = Comments
                    };
                    Program.Table<Payment>().Rows.Add(payment);
                    payment.Modifier = Modifier;

                    Program.Table<PledgeLink>().Rows.Add(new PledgeLink {
                        Amount = AmountPaid,
                        Payment = payment,
                        Pledge = pledge
                    });
                }
            }
コード例 #5
0
partial         void ValidatePledge(Pledge newValue, Action<string> error);
コード例 #6
0
partial         void OnPledgeChanged(Pledge oldValue, Pledge newValue);
コード例 #7
0
ファイル: ViewModel.cs プロジェクト: ShomreiTorah/Billing
		public void Import() {
			if (!string.IsNullOrWhiteSpace(CurrentPayment.Email) && !AppFramework.Table<EmailAddress>().Rows
					.Any(r => r.Email.Equals(CurrentPayment.Email, StringComparison.OrdinalIgnoreCase))) {
				AppFramework.Table<EmailAddress>().Rows.Add(new EmailAddress {
					Email = CurrentPayment.Email,
					Name = CurrentPayment.FirstName + " " + CurrentPayment.LastName,
					DateAdded = CurrentPayment.Date,
					Person = Person
				});
			}

			var payment = new Payment {
				Account = Names.DefaultAccount,
				CheckNumber = CurrentPayment.FinalFour,
				Amount = CurrentPayment.Amount,
				Company = CurrentPayment.Company,
				Comments = TrimComments(Comments.Trim()),
				Date = CurrentPayment.Date,
				Method = "Credit Card",
				Person = Person,
			};
			AppFramework.Table<Payment>().Rows.Add(payment);
			AppFramework.Table<ImportedPayment>().Rows.Add(new ImportedPayment {
				DateImported = DateTime.Now,
				ExternalId = CurrentPayment.Id,
				ImportingUser = Environment.UserName,
				Payment = payment,
				Source = CurrentPayment.SourceName
			});
			Pledge pledge = null;
			if (CreatePledge) {
				pledge = new Pledge {
					Account = payment.Account,
					Amount = PledgeAmount,
					Comments = TrimComments("Created for credit card payment:\n" + Comments.Trim()),
					Date = payment.Date,
					Person = payment.Person,
					Type = PledgeType,
					SubType = PledgeSubType ?? "",
					Note = PledgeNote
				};

				AppFramework.Table<PledgeLink>().Rows.Add(new PledgeLink {
					Amount = pledge.Amount,
					Pledge = pledge,
					Payment = payment
				});
				AppFramework.Table<Pledge>().Rows.Add(pledge);
			}

			if (CurrentPayment.JournalInfo?.MensSeats != null || CurrentPayment.JournalInfo?.WomensSeats != null) {
				AppFramework.Table<MelaveMalkaSeat>().Rows.Add(new MelaveMalkaSeat {
					MensSeats = CurrentPayment.JournalInfo.MensSeats,
					WomensSeats = CurrentPayment.JournalInfo.WomensSeats,
					Person = payment.Person,
					Year = JournalAd.InferYear(payment.Date),
					DateAdded = DateTime.Now
				});
			}
			ImportCallback?.Invoke(CurrentPayment, payment, pledge);
			RefreshPayments();
		}
コード例 #8
0
        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();
        }