Exemple #1
0
        void AddPayment()
        {
            using (var frm = new frmPayment())
            {
                if (frm.ShowDialog() == DialogResult.Cancel) return;

                var cst = CurrentCustomerId;
                var amount = double.Parse(frm.amountTextBox.Text.Trim());
                var comments = frm.commentsTextBox.Text.Trim();
                var From = frm.fromDateTimePicker.Value;
                var To = frm.toDateTimePicker.Value;
                Dal.AddSubscription(CurrentCustomerId, amount, comments, From, To);
            }
            //  paymentBindingSource.ResetBindings(true);
            customerBindingSource.ResetBindings(true);
        }
Exemple #2
0
        private void btnAddSubscr_Click(object sender, EventArgs e)
        {
            using (var frm = new frmPayment())
            {
                frm.ToDateIsValid = (d) =>
                {
                    var pay = _dal.GetPaymentsPerCustomer(_custId);
                    DateTime max = DateTime.MinValue;
                    if (pay.Rows.Count > 0)
                        max = pay.AsEnumerable().Cast<DataRow>().Max(r => r.Field<DateTime>("To"));
                    return d > max;
                };
                if (frm.ShowDialog() == DialogResult.Cancel) return;

                var cst = _custId;
                var amount = double.Parse(frm.amountTextBox.Text.Trim());
                var comments = frm.commentsTextBox.Text.Trim();
                var From = frm.fromDateTimePicker.Value;
                var To = frm.toDateTimePicker.Value;
                _dal.AddSubscription(_custId, amount, comments, From, To);
            }

            LoadPaymentsPerCustomer();
        }