public virtual ViewResult Preview(long id) { var bill = _bills.Get(id); BillModel model; if (bill == null) { model = _modelFactory.GetBillModelByApplication(id); var application = _applications.Get(id); ViewBag.BillNumber = application.DisplayNumber; ViewBag.SaveDate = DateTimeProvider.Now; ViewBag.SendDate = null; } else { model = _modelFactory.GetBillModel(bill); ViewBag.BillNumber = bill.Number; ViewBag.SaveDate = bill.SaveDate; ViewBag.SendDate = bill.SendDate; } ViewBag.ApplicationId = id; return(View(model)); }
public async Task Update(UpdateBillDto dto) { var bill = await _billRepository.Get(dto.BillId); var amount = _amountFactory.Create(dto.AmountValue, dto.Currency); var supplier = await GetSupplier(dto.SupplierId); var category = await GetCategory(dto.CategoryId); bill.Update(dto.Name, amount, dto.PaymentDate, dto.PaymentStatus, supplier, category); await _billRepository.Update(bill); }
public HttpResponseMessage Get(int id) { var bills = _billRepository.Get(id); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, bills); return(response); }
public void Test_AddBill() { var model = _fixture.Create <BillModel>(); var number = _fixture.Create <int>(); _manager.Save(TestConstants.TestApplicationId, number, model, DateTimeProvider.Now, null); var billData = _billRepository.Get(TestConstants.TestApplicationId); billData.Number.ShouldBeEquivalentTo(number); billData.SendDate.Should().NotHaveValue(); Debug.Assert(model.PriceRuble != null, "model.PriceRuble != null"); billData.Price.Should().BeApproximately(model.PriceRuble.Value / billData.EuroToRuble, (decimal)0.0001); billData.ShouldBeEquivalentTo(model, options => options.ExcludingMissingProperties()); billData.ShouldBeEquivalentTo(model.BankDetails, options => options.ExcludingMissingProperties()); }
public IHttpActionResult Get([FromUri] string id) { var eBill = _billRepo.Get(b => b.Id == id && b.AgingStatus == Core.Common.AgingStatus.Regular); if (eBill == null) { return(NotFound()); } var dtoBill = ModelFactory.Create(eBill); return(Ok(dtoBill)); }
public FileHolder Get(long applicationId) { var bill = _bills.Get(applicationId); using (var stream = new MemoryStream()) using (var document = new Document(PageSize.A4, 30, 30, 30, 30)) { PdfWriter.GetInstance(document, stream); document.Open(); Fill(document, bill); document.Close(); return(new FileHolder { Name = "bill-" + bill.Number + ".pdf", Data = stream.ToArray() }); } }
public void Send(long applicationId, long userId) { var bill = _bills.Get(applicationId); var application = _applications.Get(applicationId); var subject = string.Format("Счет на оплату № {0} от {1}", bill.Number, bill.SaveDate.ToString("dd MMMM yyyy")); var body = subject; var from = EmailsHelper.DefaultFrom; var to = _admins.GetAll().Select(x => x.Email).ToArray() .Union(EmailsHelper.SplitAndTrimEmails(application.ClientEmails)) .Distinct() .ToArray(); var files = new[] { _pdf.Get(applicationId) }; foreach (var item in to) { _mail.Send(new EmailMessage(subject, body, from, item, userId) { Files = files, }); } }
public VBillWithOrganization Get(int Id) { return(_repository.Get(Id).ToServiceLayer()); }
public Bill GetBill(int id) { return(Repository.Get(id)); }
public Bill Get(int id) { return(billRepository.Get(id)); }