public void CreateDuePayment(DuePayment duePayment)
 {
     using (var context = Persistence.Persistence.CreateContext())
     {
         context.DuePayments.AddObject(duePayment);
         context.SaveChanges();
     }
 }
示例#2
0
 public static HomeInvoice Create(DuePayment payment)
 {
     HomeInvoice hi = new HomeInvoice();
     hi.DueYear = payment.DueInvoice.DueYear.DueYear1;
     hi.DuesAmount = payment.DueInvoice.DueAmount;
     hi.PaymentAmount = payment.PaymentAmount.GetValueOrDefault(0);
     hi.CheckImageUNC = GetFullyQualifiedCheckImageUNC(payment.CheckImageUNC);
     hi.DuePaymentId = payment.DuePaymentsId;
     return hi;
 }
 public void UpdateDuePayment(DuePayment duePayment)
 {
     using (var context = Persistence.Persistence.CreateContext())
     {
         var dp = context.DuePayments.Where(d => d.DuePaymentsId == duePayment.DuePaymentsId).FirstOrDefault();
         if (dp != null)
         {
             dp.CashPayment = duePayment.CashPayment;
             dp.CheckImageUNC = duePayment.CheckImageUNC;
             dp.DueInvoicesId = duePayment.DueInvoicesId;
             dp.ForfeitDueToForeclosure = duePayment.ForfeitDueToForeclosure;
             dp.PaymentAmount = duePayment.PaymentAmount;
             context.SaveChanges();
         }
     }
 }
        public AddPaymentViewModel(Home home, DuePayment selectedDuePayment)
        {
            DueInvoices = new ObservableCollection<Models.DueInvoiceOwed>();
            using (var context = Persistence.Persistence.CreateContext())
            {
                var list = (from di in context.DueInvoices
                            where di.HomeId == home.HomeId
                            select di).ToList();
                list.ForEach(d => DueInvoices.Add(Models.DueInvoiceOwed.Create(d)));
                OnPropertyChanged("DueInvoices");
            }
            if (selectedDuePayment != null)
            {
                _duePayment = selectedDuePayment;
                this.CheckImageUNC = selectedDuePayment.CheckImageUNC;
                this.PaymentAmount = selectedDuePayment.PaymentAmount ?? 0;
                this.CashPayment = selectedDuePayment.CashPayment;
                this.Forfeited = selectedDuePayment.ForfeitDueToForeclosure;
                var sdi = DueInvoices.Where(d => d.DueInvoicesId == selectedDuePayment.DueInvoicesId).FirstOrDefault();
                if (sdi != null)
                    SelectedDueInvoice = sdi;

            }
        }
        public DuePayment CreatePayment()
        {
            if (SelectedDueInvoice == null) return null;
            DuePayment dp = null;
            if (_duePayment == null)
            {
                dp = new DuePayment();
                dp.DuePaymentsId = Guid.NewGuid();
            }
            else
                dp = _duePayment;
            dp.PaymentAmount = this.PaymentAmount;
            dp.CheckImageUNC = this.CheckImageUNC;
            dp.DueInvoicesId = SelectedDueInvoice.DueInvoicesId;
            dp.CashPayment = this.CashPayment;
            dp.ForfeitDueToForeclosure = this.Forfeited;

            if (!string.IsNullOrWhiteSpace(this.CheckImageUNCUpload))
            {
                IImageFileService ifs = ImageFileService.Create(this.CheckImageUNCUpload);
                var newFile = ifs.CreateLocallyStoredFile(SystemContext.CheckImagePath);
                if (!string.IsNullOrWhiteSpace(newFile))
                {
                    dp.CheckImageUNC = newFile;
                }
            }
            return dp;
        }
示例#6
0
 public AddPayment(Home home, DuePayment selectedDuePayment)
 {
     InitializeComponent();
     this.DataContext = new AddPaymentViewModel(home, selectedDuePayment);
 }
示例#7
0
 /// <summary>
 /// Create a new DuePayment object.
 /// </summary>
 /// <param name="dueInvoicesId">Initial value of the DueInvoicesId property.</param>
 /// <param name="duePaymentsId">Initial value of the DuePaymentsId property.</param>
 public static DuePayment CreateDuePayment(global::System.Guid dueInvoicesId, global::System.Guid duePaymentsId)
 {
     DuePayment duePayment = new DuePayment();
     duePayment.DueInvoicesId = dueInvoicesId;
     duePayment.DuePaymentsId = duePaymentsId;
     return duePayment;
 }
示例#8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DuePayments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDuePayments(DuePayment duePayment)
 {
     base.AddObject("DuePayments", duePayment);
 }