public void CreateSaleReceipt_ServiceDontContainsSuchSaleReceipt_SaleReceiptCreated() { //A var receipt = new SaleReceipt { DocNumber = "1-1-5-54-28400-105", Line = new List <QuickBooksOnlineAccess.Models.Services.QuickBooksOnlineServicesSdk.CreateSaleReceipts.Line> { new QuickBooksOnlineAccess.Models.Services.QuickBooksOnlineServicesSdk.CreateSaleReceipts.Line() { Qty = 3, ItemValue = "21", ItemName = "testSku1", UnitPrice = 12.3m, } }, CustomerValue = "3", CustomerName = "Francine" }; //A var createSaleReceipts = this._quickBooksOnlineServiceSdk.CreateSaleReceipts(receipt); createSaleReceipts.Wait(); //A var getSaleRceipts = this._quickBooksOnlineServiceSdk.GetSalesReceipt(receipt.DocNumber); var salesReceiptsResponse = getSaleRceipts.Result; //A salesReceiptsResponse.SaleReceipts.Where(x => x.DocNumber == receipt.DocNumber).ToList().Count.Should().BeGreaterThan(0); }
public async Task <IActionResult> Edit(int id, [Bind("SaleReceiptId,ReceiptDate,Quantity,SalePrice")] SaleReceipt saleReceipt) { if (id != saleReceipt.SaleReceiptId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(saleReceipt); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SaleReceiptExists(saleReceipt.SaleReceiptId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(saleReceipt)); }
public void InsertRecord(SaleReceipt sale) { using (var db = new MotorcycleShopsEntities()) { db.SaleReceipts.Add(sale); db.SaveChanges(); } }
public async Task <IActionResult> Create([Bind("SaleReceiptId,ReceiptDate,Quantity,SalePrice")] SaleReceipt saleReceipt) { if (ModelState.IsValid) { _context.Add(saleReceipt); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(saleReceipt)); }
public static SaleReceipt ToQBSaleReceipt(this Models.CreateOrders.Order source) { var saleReceipt = new SaleReceipt() { DocNumber = source.DocNumber, CustomerName = source.CustomerName, CustomerValue = source.CustomerValue, PrivateNote = source.PrivateNote, TnxDate = source.TnxDate, Line = source.LineItems.Select(x => x.ToQBSaleReceiptLineItem()), CustomFields = (source.CustomFields ?? Enumerable.Empty <Models.CreateOrders.CustomField>()).Select(x => x.ToQBCustomField()), }; return(saleReceipt); }
public static Intuit.Ipp.Data.SalesReceipt ToIppSaleReceipt(this SaleReceipt saleReceipt) { var ippSaleReceipt = new Intuit.Ipp.Data.SalesReceipt { DocNumber = saleReceipt.DocNumber, Line = saleReceipt.Line.Select(x => x.ToIppSaleReceiptLine()).ToArray(), TxnDate = saleReceipt.TnxDate, TxnDateSpecified = true, CustomerRef = new ReferenceType { Value = saleReceipt.CustomerValue, name = saleReceipt.CustomerName }, CurrencyRef = new ReferenceType { name = "United States Dollar", Value = "USD" }, PrivateNote = saleReceipt.PrivateNote, CustomField = (saleReceipt.CustomFields ?? Enumerable.Empty <Models.Services.QuickBooksOnlineServicesSdk.CreateSaleReceipts.CustomField>()).Select(x => x.ToQBCustomField()).TakeWhile((cf, i) => i < 2).ToArray(), }; return(ippSaleReceipt); }